Hopefully fixed waking up from sleep with axes.

This commit is contained in:
Aloshi 2013-03-25 08:16:54 -05:00
parent 0d7ac5a10a
commit dc50170370
4 changed files with 13 additions and 5 deletions

View file

@ -1,3 +1,6 @@
March 25, 2013
-Hopefully fixed waking up from sleep with axes.
March 19, 2013 March 19, 2013
-Finally added a "dim" or sleep mode. Change behavior with "--dimtime [positive integer time in seconds]", with 0 for off. -Finally added a "dim" or sleep mode. Change behavior with "--dimtime [positive integer time in seconds]", with 0 for off.

View file

@ -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; bool keyDown = false;
InputButton button = UNKNOWN; InputButton button = UNKNOWN;
@ -190,6 +190,8 @@ void InputManager::processEvent(SDL_Event* event)
{ {
inputVector.at(i)->onInput(button, keyDown); inputVector.at(i)->onInput(button, keyDown);
} }
return button;
} }
void InputManager::loadConfig() void InputManager::loadConfig()

View file

@ -20,7 +20,7 @@ namespace InputManager {
//enum for identifying input, regardless of configuration //enum for identifying input, regardless of configuration
enum InputButton { UNKNOWN, UP, DOWN, LEFT, RIGHT, BUTTON1, BUTTON2, MENU, SELECT, PAGEUP, PAGEDOWN}; 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<GuiComponent*> inputVector; extern std::vector<GuiComponent*> inputVector;
extern SDL_Event* lastEvent; //mostly for GuiInputConfig extern SDL_Event* lastEvent; //mostly for GuiInputConfig

View file

@ -10,6 +10,7 @@
#include "AudioManager.h" #include "AudioManager.h"
#include "platform.h" #include "platform.h"
#include "Log.h" #include "Log.h"
#include "InputManager.h"
#ifdef _RPI_ #ifdef _RPI_
#include <bcm_host.h> #include <bcm_host.h>
@ -180,10 +181,12 @@ int main(int argc, char* argv[])
case SDL_JOYBUTTONUP: case SDL_JOYBUTTONUP:
case SDL_KEYDOWN: case SDL_KEYDOWN:
case SDL_KEYUP: case SDL_KEYUP:
case SDL_JOYAXISMOTION:
if(InputManager::processEvent(&event) != InputManager::UNKNOWN)
{
sleeping = false; sleeping = false;
timeSinceLastEvent = 0; timeSinceLastEvent = 0;
case SDL_JOYAXISMOTION: }
InputManager::processEvent(&event);
break; break;
case SDL_QUIT: case SDL_QUIT: