small improvement for handling up to 8 mouse buttons

as we do int buttonIndex = ev.button.button - SDL_BUTTON_LEFT;
it's only consistent to do if(ev.button.button < SDL_BUTTON_LEFT + 8)

it doesn't really make any difference as long as SDL_BUTTON_LEFT is 1,
but this way it's safe for SDL3 or whatever future version might break
the ABI.
This commit is contained in:
Daniel Gibson 2015-12-13 03:49:29 +01:00
parent 32feff2be1
commit df90fce6a5

View file

@ -631,7 +631,7 @@ sysEvent_t Sys_GetEvent() {
default:
#if SDL_VERSION_ATLEAST(2, 0, 0)
// handle X1 button and above
if( ev.button.button <= 8 ) // doesn't support more than 8 mouse buttons
if( ev.button.button < SDL_BUTTON_LEFT + 8 ) // doesn't support more than 8 mouse buttons
{
int buttonIndex = ev.button.button - SDL_BUTTON_LEFT;
res.evValue = K_MOUSE1 + buttonIndex;