diff --git a/include/frontend.hpp b/include/frontend.hpp index e400eca..bf01d3e 100755 --- a/include/frontend.hpp +++ b/include/frontend.hpp @@ -44,11 +44,15 @@ struct PACKED VideoOutputData { #pragma pack(pop) struct SFEvent { - SFEvent(sf::Event::EventType type, sf::Keyboard::Key code, uint32_t unicode) : type(type), code(code), unicode(unicode) {} + SFEvent(sf::Event::EventType type, sf::Keyboard::Key code, uint32_t unicode, uint32_t joystickId, uint32_t button, sf::Joystick::Axis axis, float position) : type(type), code(code), unicode(unicode), joystickId(joystickId), button(button), axis(axis), position(position) {} sf::Event::EventType type; sf::Keyboard::Key code; uint32_t unicode; + uint32_t joystickId; + uint32_t button; + sf::Joystick::Axis axis; + float position; }; struct out_rect_data { diff --git a/source/WindowScreen.cpp b/source/WindowScreen.cpp index ef1f5f1..0279ab6 100755 --- a/source/WindowScreen.cpp +++ b/source/WindowScreen.cpp @@ -312,6 +312,10 @@ void WindowScreen::poll() { break; } + break; + case sf::Event::JoystickButtonPressed: + break; + case sf::Event::JoystickMoved: break; default: break; @@ -508,7 +512,12 @@ void WindowScreen::poll_window() { sf::Event event; this->events_access->lock(); while(this->m_win.pollEvent(event)) { - events_queue.emplace(event.type, event.key.code, event.text.unicode); + int joystickId = event.joystickConnect.joystickId; + if(event.type == sf::Event::JoystickButtonPressed) + joystickId = event.joystickButton.joystickId; + else if(event.type == sf::Event::JoystickMoved) + joystickId = event.joystickMove.joystickId; + events_queue.emplace(event.type, event.key.code, event.text.unicode, joystickId, event.joystickButton.button, event.joystickMove.axis, event.joystickMove.position); } this->events_access->unlock(); }