diff --git a/src/motor.cpp b/src/motor.cpp index e2c2613..e2a7d0d 100644 --- a/src/motor.cpp +++ b/src/motor.cpp @@ -1,17 +1,13 @@ #include "motor.hpp" -// std::shared_ptr motor::instance() { -// static std::shared_ptr instance(new motor()); - -// return instance; -// } +motor::motor() : _eventmanager(std::make_shared()) { +} void motor::init(std::string_view title, int32_t width, int32_t height, bool fullscreen) { _running = true; _window = std::make_shared(title, width, height, fullscreen); _renderer = _window->create_renderer(); - _eventmanager = std::make_shared(); _eventmanager->add_receiver(instance()); add_loopable(std::make_shared()); diff --git a/src/motor.hpp b/src/motor.hpp index 6827d96..d8db5c9 100644 --- a/src/motor.hpp +++ b/src/motor.hpp @@ -15,6 +15,7 @@ class motor : public eventreceiver, public singleton { public: virtual ~motor() = default; + motor(); // static std::shared_ptr instance(); diff --git a/src/scriptengine.cpp b/src/scriptengine.cpp index c5ccb85..513cb36 100644 --- a/src/scriptengine.cpp +++ b/src/scriptengine.cpp @@ -24,7 +24,7 @@ void scriptengine::run() { _lua.set_function("is_keydown", &statemanager::is_keydown, sm); const auto m = motor::instance(); - // m->get_eventmanager()->add_receiver(sm); + m->get_eventmanager()->add_receiver(sm); _lua.new_usertype("motor", "new", sol::factories(&motor::instance), @@ -40,8 +40,6 @@ void scriptengine::run() { local motor = motor.new() motor:init("Carimbo", 800, 600, false) - print(is_keydown(keyevent.a)) - motor:run() )";