diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-10-21 17:37:11 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-10-21 17:37:11 +0000 |
| commit | 142b5ad5143ddcfc9d7fee2563bee753a968f011 (patch) | |
| tree | bd526624da8bc8813dd338ef7b0fa628af5d4b1e | |
| parent | 37abbcbd2863f103d6a506490fb8bb3d4d7fff68 (diff) | |
| download | zcatch-142b5ad5143ddcfc9d7fee2563bee753a968f011.tar.gz zcatch-142b5ad5143ddcfc9d7fee2563bee753a968f011.zip | |
fixed mouse button remapping and added mouse wheel stuff
| -rw-r--r-- | src/engine/client/ec_inp.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/engine/client/ec_inp.c b/src/engine/client/ec_inp.c index dc21bdae..52919cff 100644 --- a/src/engine/client/ec_inp.c +++ b/src/engine/client/ec_inp.c @@ -317,10 +317,14 @@ void inp_update() keyboard_state[keyboard_current][KEY_MOUSE_1] = 0; keyboard_state[keyboard_current][KEY_MOUSE_2] = 0; keyboard_state[keyboard_current][KEY_MOUSE_3] = 0; + keyboard_state[keyboard_current][KEY_MOUSE_WHEEL_UP] = 0; + keyboard_state[keyboard_current][KEY_MOUSE_WHEEL_DOWN] = 0; i = SDL_GetMouseState(NULL, NULL); - if(i&SDL_BUTTON(1)) keyboard_state[keyboard_current][KEY_MOUSE_1] = 1; - if(i&SDL_BUTTON(2)) keyboard_state[keyboard_current][KEY_MOUSE_2] = 1; - if(i&SDL_BUTTON(3)) keyboard_state[keyboard_current][KEY_MOUSE_3] = 1; + if(i&SDL_BUTTON(1)) keyboard_state[keyboard_current][KEY_MOUSE_1] = 1; /* 1 is left */ + if(i&SDL_BUTTON(3)) keyboard_state[keyboard_current][KEY_MOUSE_2] = 1; /* 3 is right */ + if(i&SDL_BUTTON(2)) keyboard_state[keyboard_current][KEY_MOUSE_3] = 1; /* 2 is middle */ + if(i&SDL_BUTTON(4)) keyboard_state[keyboard_current][KEY_MOUSE_WHEEL_UP] = 1; + if(i&SDL_BUTTON(5)) keyboard_state[keyboard_current][KEY_MOUSE_WHEEL_DOWN] = 1; { SDL_Event event; @@ -346,7 +350,11 @@ void inp_update() case SDL_MOUSEBUTTONUP: action = INPFLAG_RELEASE; case SDL_MOUSEBUTTONDOWN: - key = KEY_MOUSE_1+event.button.button-1; + if(event.button.button == 1) key = KEY_MOUSE_1; + if(event.button.button == 3) key = KEY_MOUSE_2; + if(event.button.button == 2) key = KEY_MOUSE_3; + if(event.button.button == 4) key = KEY_MOUSE_WHEEL_UP; + if(event.button.button == 5) key = KEY_MOUSE_WHEEL_DOWN; break; /* other messages */ |