Hello All
First off I want to say that the angelscript sdk is very cool stuff.
I've decided that I would like to add scripting to my application and this feels like the right solution.
ok here's my question...
I have a class
class Component
{
public:
void setName (const CScriptString& componentName);
Component* const getChildComponent (int index);
void setBounds (int x, int y, int w, int h);
};
This is what I want the script to look like...
// Script...
void componentResized(Component& mainComponent)
{
mainComponent.getChildComponent (1).setBounds (0, 0, 25, 25);
}
So for now I want the application to pass a reference of the mainComponent to the script.
What's the proper way of doing this?
How do I register the class?
This is what I have so far in terms of "registration".
int r = -1;
// Register the class..
r = getEngine()->RegisterObjectType ("Component",
0,
asOBJ_REF | asOBJ_NOHANDLE);
assert (r >= 0);
// Register the methods..
r = getEngine()->RegisterObjectMethod ("Component",
"void setName(const string &in)",
asMETHOD (ProductPage, setName),
asCALL_THISCALL);
assert (r >= 0);
r = getEngine()->RegisterObjectMethod ("Component",
"Component& getChildComponent(int)",
asMETHOD (ProductPage, getChildComponent),
asCALL_THISCALL);
assert (r >= 0);
r = getEngine()->RegisterObjectMethod ("Component",
"void setBounds(int, int, int, int)",
asMETHODPR (ProductPage, setBounds, (int, int, int, int), void),
asCALL_THISCALL);
assert (r >= 0);
This is what I'm getting when I compile the script:
"Compiling void componentResized(Component&inout)
Only object types that support object handles can use &inout. Use ∈ or &out instead"
Thanks in advance!