summaryrefslogtreecommitdiff
path: root/src/sdl
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2013-01-17 19:04:27 +0000
committerTim Angus <tim@ngus.net>2014-08-28 10:59:21 +0100
commit7bca93fc97ddef180acaae1d782c9e16cf35a0c9 (patch)
treecb0763d91e0c9ba22a801748daed4bd93fe45f33 /src/sdl
parentaf45b9f4614d7018146e68832de3bccb1c73f7e7 (diff)
Make the mousewheel work
Diffstat (limited to 'src/sdl')
-rw-r--r--src/sdl/sdl_input.c19
1 files changed, 13 insertions, 6 deletions
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;