Created
February 18, 2013 18:16
-
-
Save WideWord/4979390 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // main.exe | |
| ... | |
| using namespace timecraft; | |
| int main () { | |
| Core* core = new Core(); | |
| core->loadPlugin("testplugin"); // load testplugin.dll on windows, testplugin.so on linux | |
| Scene* scene = new Scene(); | |
| GameObject* go = scene->createGameObject(); | |
| Component* co = go->addComponent("TestPluginComponent"); | |
| int test = co->test(); | |
| // test == 7 | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // testplugin.dll | |
| #include "timecraft/scene/gameobject.h" | |
| class TestPluginComponent : public timecraft::Component { | |
| public: | |
| TestPluginComponent(timecraft::GameObject* obj) : timecraft::Component(obj) {} | |
| virtual int test () override { | |
| return 7; | |
| } | |
| }; | |
| extern "C" { | |
| __declspec(dllexport) void timecraftPluginMain () { | |
| regTCComponent(TestPluginComponent); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment