diff options
author | Zack Middleton <zturtleman@gmail.com> | 2013-07-09 14:41:56 -0500 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2014-06-17 17:43:32 +0100 |
commit | ee8f1384e013d8da0636179a31c0e63162e6961b (patch) | |
tree | 026edc69895528c3952b0f3ab857628061753248 | |
parent | 55efee5e90bb048879458e9b3d2b98192f4e4484 (diff) |
SDL Mouse Button clean up
Make 'b' variable an int so that key values more than 255 will work (not currently an issue in ioq3 afaik).
Use SDL_BUTTON_* for easier transition to SDL2.
(SDL2 doesn't have SDL_BUTTON_WHEELUP or SDL_BUTTON_WHEELDOWN, X1/X2 are different values.)
-rw-r--r-- | src/sdl/sdl_input.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/sdl/sdl_input.c b/src/sdl/sdl_input.c index 82bb4dfc..070ba600 100644 --- a/src/sdl/sdl_input.c +++ b/src/sdl/sdl_input.c @@ -961,17 +961,17 @@ static void IN_ProcessEvents( void ) case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: { - unsigned char b; + int b; switch( e.button.button ) { - case 1: b = K_MOUSE1; break; - case 2: b = K_MOUSE3; break; - case 3: b = K_MOUSE2; break; - case 4: b = K_MWHEELUP; break; - case 5: b = K_MWHEELDOWN; break; - case 6: b = K_MOUSE4; break; - case 7: b = K_MOUSE5; break; - default: b = K_AUX1 + ( e.button.button - 8 ) % 16; break; + case SDL_BUTTON_LEFT: b = K_MOUSE1; break; + case SDL_BUTTON_MIDDLE: b = K_MOUSE3; break; + case SDL_BUTTON_RIGHT: b = K_MOUSE2; break; + case SDL_BUTTON_WHEELUP: b = K_MWHEELUP; break; + case SDL_BUTTON_WHEELDOWN: b = K_MWHEELDOWN; break; + case SDL_BUTTON_X1: b = K_MOUSE4; break; + case SDL_BUTTON_X2: b = K_MOUSE5; break; + default: b = K_AUX1 + ( e.button.button - SDL_BUTTON_X2 + 1 ) % 16; break; } Com_QueueEvent( 0, SE_KEY, b, ( e.type == SDL_MOUSEBUTTONDOWN ? qtrue : qfalse ), 0, NULL ); |