diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-09-02 10:12:19 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-09-02 10:12:19 +0400 |
commit | 84dcfa181b0722655ceba3930a2daa0e27e72f93 (patch) | |
tree | bb39eccc758e18c3a65d3101306f71b008e8eaf1 /source/gameengine/GameLogic/SCA_JoystickManager.cpp | |
parent | 81ad271d157c70433b36af31581261ae8c2098a4 (diff) |
BGE Bugfix, SDL joysticks arrow keys didnt work when 2 joysticks were being used at the same time.
The event queue was running for every joystick sensor without checking if the events were for that joystick.
seperating the event queue for each joystick is overkill so instead deal with all joysticks events in once function.
Also removed some unused functions
Diffstat (limited to 'source/gameengine/GameLogic/SCA_JoystickManager.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_JoystickManager.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.cpp b/source/gameengine/GameLogic/SCA_JoystickManager.cpp index 08c36326712..a86770a6e0a 100644 --- a/source/gameengine/GameLogic/SCA_JoystickManager.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickManager.cpp @@ -44,7 +44,6 @@ SCA_JoystickManager::SCA_JoystickManager(class SCA_LogicManager* logicmgr) for (i=0; i<JOYINDEX_MAX; i++) { m_joystick[i] = SCA_Joystick::GetInstance( i ); } - //m_joystick = NULL; } @@ -59,14 +58,21 @@ SCA_JoystickManager::~SCA_JoystickManager() void SCA_JoystickManager::NextFrame(double curtime,double deltatime) { - set<SCA_ISensor*>::iterator it; - for (it = m_sensors.begin(); it != m_sensors.end(); it++) - { - SCA_JoystickSensor* joysensor = (SCA_JoystickSensor*)(*it); - if(!joysensor->IsSuspended()) + if (m_sensors.size()==0) { + return; + } + else { + set<SCA_ISensor*>::iterator it; + + SCA_Joystick::HandleEvents(); /* Handle all SDL Joystick events */ + + for (it = m_sensors.begin(); it != m_sensors.end(); it++) { - m_joystick[joysensor->GetJoyIndex()]->HandleEvents(); - joysensor->Activate(m_logicmgr, NULL); + SCA_JoystickSensor* joysensor = (SCA_JoystickSensor*)(*it); + if(!joysensor->IsSuspended()) + { + joysensor->Activate(m_logicmgr, NULL); + } } } } |