|
From: knittl <kn...@us...> - 2009-08-03 08:41:35
|
Module: performous
Branch: master
Commit: 92b69931658a60989a9b47e012d1eddb47d2f848
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Aug 3 02:54:49 2009 +0300
Keyboard now accepts numbers 1-5 too.
Guitars no longer report whammy and other controls as pick.
Events trapped actually get trapped and don't reach the screens.
---
game/joystick.cc | 22 +++++++++++-----------
game/main.cc | 2 +-
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 134498c..514fcc4 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -152,15 +152,15 @@ bool input::pushEvent(SDL_Event _e) {
}
devices[joy_id].addEvent(event);
return true;
- case SDLK_F5:
+ case SDLK_F5: case SDLK_5:
button++;
- case SDLK_F4:
+ case SDLK_F4: case SDLK_4:
button++;
- case SDLK_F3:
+ case SDLK_F3: case SDLK_3:
button++;
- case SDLK_F2:
+ case SDLK_F2: case SDLK_2:
button++;
- case SDLK_F1:
+ case SDLK_F1: case SDLK_1:
event.type = input::Event::PRESS;
break;
default:
@@ -180,15 +180,15 @@ bool input::pushEvent(SDL_Event _e) {
joy_id = UINT_MAX;
if(!devices[joy_id].assigned()) return false;
switch(_e.key.keysym.sym) {
- case SDLK_F5:
+ case SDLK_F5: case SDLK_5:
button++;
- case SDLK_F4:
+ case SDLK_F4: case SDLK_4:
button++;
- case SDLK_F3:
+ case SDLK_F3: case SDLK_3:
button++;
- case SDLK_F2:
+ case SDLK_F2: case SDLK_2:
button++;
- case SDLK_F1:
+ case SDLK_F1: case SDLK_1:
event.type = input::Event::RELEASE;
break;
default:
@@ -204,7 +204,7 @@ bool input::pushEvent(SDL_Event _e) {
}
case SDL_JOYAXISMOTION:
joy_id = _e.jaxis.which;
-
+ if (_e.jaxis.axis != 5 && _e.jaxis.axis != 6) return false;
event.type = input::Event::PICK;
for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
event.pressed[i] = devices[joy_id].pressed(i);
diff --git a/game/main.cc b/game/main.cc
index 26ff642..670a924 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -70,8 +70,8 @@ static void checkEvents_SDL(ScreenManager& sm, Window& window) {
}
break;
}
+ sm.getCurrentScreen()->manageEvent(event);
}
- sm.getCurrentScreen()->manageEvent(event);
switch(glGetError()) {
case GL_INVALID_ENUM: std::cerr << "OpenGL error: invalid enum" << std::endl; break;
case GL_INVALID_VALUE: std::cerr << "OpenGL error: invalid value" << std::endl; break;
|