diff --git a/changelog.txt b/changelog.txt index 92c8fa0d1..d880d47ef 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +March 25, 2013 +-Hopefully fixed waking up from sleep with axes. + March 19, 2013 -Finally added a "dim" or sleep mode. Change behavior with "--dimtime [positive integer time in seconds]", with 0 for off. diff --git a/src/InputManager.cpp b/src/InputManager.cpp index a1b85a37d..edb395cde 100644 --- a/src/InputManager.cpp +++ b/src/InputManager.cpp @@ -32,7 +32,7 @@ void InputManager::unregisterComponent(GuiComponent* comp) } } -void InputManager::processEvent(SDL_Event* event) +InputManager::InputButton InputManager::processEvent(SDL_Event* event) { bool keyDown = false; InputButton button = UNKNOWN; @@ -190,6 +190,8 @@ void InputManager::processEvent(SDL_Event* event) { inputVector.at(i)->onInput(button, keyDown); } + + return button; } void InputManager::loadConfig() diff --git a/src/InputManager.h b/src/InputManager.h index 09d2b7f8d..4e91ff939 100644 --- a/src/InputManager.h +++ b/src/InputManager.h @@ -20,7 +20,7 @@ namespace InputManager { //enum for identifying input, regardless of configuration enum InputButton { UNKNOWN, UP, DOWN, LEFT, RIGHT, BUTTON1, BUTTON2, MENU, SELECT, PAGEUP, PAGEDOWN}; - void processEvent(SDL_Event* event); + InputButton processEvent(SDL_Event* event); extern std::vector inputVector; extern SDL_Event* lastEvent; //mostly for GuiInputConfig diff --git a/src/main.cpp b/src/main.cpp index 69c3bebee..1fe4e2bc2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,6 +10,7 @@ #include "AudioManager.h" #include "platform.h" #include "Log.h" +#include "InputManager.h" #ifdef _RPI_ #include @@ -180,10 +181,12 @@ int main(int argc, char* argv[]) case SDL_JOYBUTTONUP: case SDL_KEYDOWN: case SDL_KEYUP: - sleeping = false; - timeSinceLastEvent = 0; case SDL_JOYAXISMOTION: - InputManager::processEvent(&event); + if(InputManager::processEvent(&event) != InputManager::UNKNOWN) + { + sleeping = false; + timeSinceLastEvent = 0; + } break; case SDL_QUIT: