Hi to all,
I would like to know a way to executing scriptstring in script:
My problem is:
I have different C++ object that i would like to use the same Script interface:
getValue()
setValue(xxx)
C++
class Variant
{
std::string type;
enum
{
bool mb;
int mi;
}
Control(bool b) {mb = b);
Control(int i) {mi = i);
// operator de transtypage
operator bool() const {return mb};
operator int() const {return mi};
}
class IControl
{
Variant getValue()=0;
setValue(Variant v)=0;
}
class BoolControl:IControl
{
bool mb;
Variant getValue() {return Variant(mb); }
setValue(Variant v) { mb = v.mb; }
}
class IntControl:IControl
{
int mi;
Variant getValue() {return Variant(mi); }
setValue(Variant v) { mi = v.mi; }
}
If i declare the Control and Variant Class in AngelScript, is it possible to do something like this?
C++
Engine->RegisterGlobalProperty("Control control",aBoolControlPtr;assert( r >= 0 );
AngelScript
void doSomethingWithABool(bool b)
{
if (b) ....
else ....
}
doSomethingWithABool(control.getValue())
In two word , can i declare only the interface of IControl in AngelScript ?
And will the transypage operator be used by angelScript ?
Thanks for informations and sorry for the little specific domain ;)
[Edited by - DaesDemon on September 2, 2005 5:13:02 AM]