#pragma once #include #include #include "Event.hpp" #include #include "Pub_Sub.h" class Input : public VrEventPublisher { public: Input(); ~Input(); // Keep track of keys that are not released // Keep track of mouse up and downs in conjunction with dragging // Keep track of joystick buttons void consume_sf_events(sf::RenderWindow *window); void consume_vr_events(); void handle_held_keys(); void dispatch_events(); private: void transpose_sf_events(std::list event_queue); // Network controller class std::vector held_keys; std::vector held_mouse_buttons; std::vector keyboard_flags; std::vector mouse_flags; private: std::list> event_queue; }; class WindowHandler : public VrEventSubscriber { public: WindowHandler(sf::RenderWindow *window) : window_ref(window) { }; virtual void recieve_event(VrEventPublisher* p, std::unique_ptr event) override { if (event.get()->type == vr::Event::Closed) { window_ref->close(); } }; private: sf::RenderWindow* window_ref; };