From 7bca93fc97ddef180acaae1d782c9e16cf35a0c9 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Thu, 17 Jan 2013 19:04:27 +0000 Subject: Make the mousewheel work --- src/sdl/sdl_input.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/sdl') diff --git a/src/sdl/sdl_input.c b/src/sdl/sdl_input.c index 858b8d6e..95d5a350 100644 --- a/src/sdl/sdl_input.c +++ b/src/sdl/sdl_input.c @@ -802,18 +802,25 @@ static void IN_ProcessEvents( void ) int b; switch( e.button.button ) { - 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_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; + case 1: b = K_MOUSE1; break; + case 2: b = K_MOUSE3; break; + case 3: b = K_MOUSE2; break; + case 4: b = K_MOUSE4; break; + case 5: b = K_MOUSE5; break; + default: b = K_AUX1 + ( e.button.button - 8 ) % 16; break; } Com_QueueEvent( 0, SE_KEY, b, ( e.type == SDL_MOUSEBUTTONDOWN ? qtrue : qfalse ), 0, NULL ); } break; + case SDL_MOUSEWHEEL: + if( e.wheel.y > 0 ) + Com_QueueEvent( 0, SE_KEY, K_MWHEELUP, qtrue, 0, NULL ); + else + Com_QueueEvent( 0, SE_KEY, K_MWHEELDOWN, qtrue, 0, NULL ); + break; + case SDL_QUIT: Cbuf_ExecuteText(EXEC_NOW, "quit Closed window\n"); break; -- cgit