diff --git a/library/phx/display/display_system_window.hpp b/library/phx/display/display_system_window.hpp index 385f6d8d431bf3b42e23d300c585a1a2db9429d1..09d2587a0b3e86a8a611cd0951e1f90898909c3b 100644 --- a/library/phx/display/display_system_window.hpp +++ b/library/phx/display/display_system_window.hpp @@ -70,6 +70,10 @@ class PHOENIX_EXPORT DisplaySystemWindow : public DisplaySystem { void OnSDLEvent(const SDL_Event& event) override; boost::signals2::signal<void()> quit_signal_; }; + // DisplaySystemWindow never calls Update on sdl_event_receiver, so if no + // other SDLDevice like Mouse or Keyboard is present the quit signal is never + // fired. The rational behind that is that the SDL Events are only polled from + // within the DeviceSystem SDLEventReceiver sdl_event_receiver; }; diff --git a/library/phx/input/device.hpp b/library/phx/input/device.hpp index 995d210a3eaa2e825c1a14a30f4fbd12f96ff474..ffe52baa222e684f565ac107c64715cc34603a4b 100644 --- a/library/phx/input/device.hpp +++ b/library/phx/input/device.hpp @@ -36,6 +36,7 @@ class PHOENIX_EXPORT Device { class EventDistributer { public: + virtual ~EventDistributer() = default; virtual void Update() = 0; void AddDevice(Device* device); void RemoveDevice(Device* device); diff --git a/library/phx/input/sdl_device.hpp b/library/phx/input/sdl_device.hpp index 30e1947ea84c6940bda6bd683bcc836e7652ea46..6149a9a25c619a8f984c9c697903fdd1317d2440 100644 --- a/library/phx/input/sdl_device.hpp +++ b/library/phx/input/sdl_device.hpp @@ -49,6 +49,7 @@ class PHOENIX_EXPORT SDLDevice : public Device { protected: class SDLEventDistributer : public EventDistributer { public: + virtual ~SDLEventDistributer() = default; void Update() override; }; static SDLEventDistributer SDL_event_distributer; diff --git a/library/phx/input/tracked_device.hpp b/library/phx/input/tracked_device.hpp index a6ee0bb904daa675fb9a999b982c9c73b50b459e..7005d5f0557ddf5702258aba4d88bfd4baa09ed0 100644 --- a/library/phx/input/tracked_device.hpp +++ b/library/phx/input/tracked_device.hpp @@ -56,6 +56,7 @@ class PHOENIX_EXPORT TrackedDevice : public Device { protected: class OpenVREventDistributer : public EventDistributer { public: + virtual ~OpenVREventDistributer() = default; void Update() override; }; static OpenVREventDistributer vr_event_distributer; diff --git a/tests/src/test_engine.cpp b/tests/src/test_engine.cpp index e500e5b1f3680fc465e5d9584ffb449c0d82c65b..2d65f3073ee0698481ad9cc2f6ac3ef98ccf7c6c 100644 --- a/tests/src/test_engine.cpp +++ b/tests/src/test_engine.cpp @@ -32,7 +32,7 @@ #include "phx/core/logger.hpp" #include "phx/core/system.hpp" #include "phx/display/display_system_window.hpp" -#include "phx/input/input_system.hpp" +#include "phx/input/device_system.hpp" #include "phx/rendering/rendering_system.hpp" #include "phx/scripting/behavior.hpp" #include "phx/setup.hpp" @@ -338,11 +338,11 @@ SCENARIO("An engine can be setup by the default setup", "[phx][phx::Engine]") { REQUIRE(rendering_system != nullptr); REQUIRE(rendering_system->GetEngine() == engine.get()); } - THEN("It has an input system") { - phx::InputSystem* input_system = - engine->GetSystem<phx::InputSystem>(); - REQUIRE(input_system != nullptr); - REQUIRE(input_system->GetEngine() == engine.get()); + THEN("It has a device system") { + phx::DeviceSystem* device_system = + engine->GetSystem<phx::DeviceSystem>(); + REQUIRE(device_system != nullptr); + REQUIRE(device_system->GetEngine() == engine.get()); } THEN("A default empty scene has been created") { REQUIRE(engine->GetScene() != nullptr);