FOnline Development > Questions and Answers
AngelScript questions (not related to FOnline API)
JovankaB:
It's a single topic to ask all general questions about AngelScript scripting, or some weird stuff like DLLs,
not related to FOnline API directly (for example questions about arrays, objects, pointers etc).
wladimiiir:
How do I share an interface between C++ and AngelScript code? What I want is to define an interface in C++ code (.cpp) and then implement it somewhere in AngelScript code.
I am aware that I need to use:
--- Code: ---ASEngine->RegisterInterface("IAction");
--- End code ---
and then probably
--- Code: ---ASEngine->RegisterInterfaceMethod("IAction", "int test()");
--- End code ---
to register its methods.
But how do I bind it in my AS code so I can really use it?
Wipe:
Does it really have to be interface? With classess it's much easier ;)
wladimiiir:
OK, so actually the solution I wrote is sufficient, so if you want to use some shared interface, the only thing is that you have to register it in C++ code.
My problem was that I have created a new .cpp file where I wanted to declare my interface and do stuff with it. Registering interface in such a new file does not really register it and I had to move my declaration to fonline_test.cpp and register it there.
So my question is:
How do I make my new .cpp file get used by the engine. Is this even possible or I have to use fonline_tla.cpp and/or fonline_test.cpp files?
wladimiiir:
--- Quote from: Wipe on May 21, 2013, 09:40:27 am ---Does it really have to be interface? With classess it's much easier ;)
--- End quote ---
Is it? In which way? What I need is to be able to create new implementations of the interface, although, I think I might end up with some (abstract) classes.
Navigation
[0] Message Index
[#] Next page
Go to full version