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.)
This commit is contained in:
Zack Middleton 2013-07-09 14:41:56 -05:00
parent 4776fb4767
commit 30fcabec65

View file

@ -912,17 +912,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 );