From 787393dd86d6c37b5680847dd4eef14406a86687 Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Tue, 27 Aug 2019 00:24:05 -0400 Subject: Created basic init script --- src/main.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 0597d48..b3d4744 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -139,15 +139,38 @@ void logicLoop(void) } } +struct Position : entityx::Component +{ + Position(float _x, float _y): x(_x), y(_y) {} + + float x,y; +}; + void LuaTest(void) { using namespace entityx; using namespace entityx::lua; + //export_component("Position", + // wrap_ctor([](float x, float y) { + // return Position(x, y); + // }), + // [](MemberRegister& m) { + // m.add("x", &Position::x); + // m.add("y", &Position::y); + // } + //); + lua_State* L = luaL_newstate(); luaL_openlibs(L); setup_entityx_api(L); + std::shared_ptr events(new EventManager()); + std::shared_ptr entities(new EntityManager(*events)); + new_entity_manager(L, entities, "manager"); + + luaL_dofile(L, "Scripts/init.lua"); + lua_close(L); } -- cgit v1.2.3