Skip to content

Instantly share code, notes, and snippets.

@WideWord
Created February 18, 2013 18:16
Show Gist options
  • Select an option

  • Save WideWord/4979390 to your computer and use it in GitHub Desktop.

Select an option

Save WideWord/4979390 to your computer and use it in GitHub Desktop.
// 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;
}
// 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