🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Registering object that uses an interface

Started by
0 comments, last by WitchLord 16 years, 10 months ago
Hi, Is there a way to register a CPP object with AngelScript and tell it that the object implements an interface. In the script you would do this :

interface IMyInterface
{
    void MyInterfaceFunction();
}

class CMyClass : IMyInterface
{
     void MyInterfaceFunction();
}

So how would you do this exact thing in CPP ??

...
    pEngine->RegisterInterface("IMyInterface");
    pEngine->RegisterInterfaceMethod("IMyInterface", "void MyInterfaceFunction()");

    // how do I register this object as an object implementing the interface ???
    pEngine->RegisterObjectType("CMyClass", sizeof(CMyClass), asOBJ_CLASS);
...

Advertisement
No, that's not possible.

I want to implement support for this in the future. For this to work I'll most likely have to set some specific rules that the C++ class implementation must follow, e.g. inherit from a specific class defined by AngelScript.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement