added module system

This commit is contained in:
Ryzerth
2020-08-07 14:29:06 +02:00
parent 9d2b60b88e
commit 7759de96da
10 changed files with 203 additions and 20 deletions

26
modules/demo/src/main.cpp Normal file
View File

@@ -0,0 +1,26 @@
#include <imgui.h>
#include <module.h>
mod::API_t* API;
struct DemoContext_t {
std::string name;
};
MOD_EXPORT void* _INIT_(mod::API_t* _API, ImGuiContext* imctx, std::string _name) {
API = _API;
DemoContext_t* ctx = new DemoContext_t;
ctx->name = _name;
ImGui::SetCurrentContext(imctx);
return ctx;
}
MOD_EXPORT void _DRAW_MENU_(DemoContext_t* ctx) {
char buf[100];
sprintf(buf, "I'm %s", ctx->name.c_str());
ImGui::Button(buf);
}
MOD_EXPORT void _STOP_(DemoContext_t* ctx) {
delete ctx;
}