in_sdl.c and in_svgalib.c now use the new Key_Event api properly

This commit is contained in:
Bill Currie 2000-11-17 21:34:07 +00:00
parent 8f1ff1bddc
commit b798113da8
2 changed files with 17 additions and 17 deletions

View file

@ -169,7 +169,7 @@ IN_SendKeyEvents (void)
// If we're not directly handled and still above 255 // If we're not directly handled and still above 255
// just force it to 0 // just force it to 0
if(sym > 255) sym = 0; if(sym > 255) sym = 0;
Key_Event(sym, state); Key_Event(sym, -1, state);
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
@ -184,14 +184,14 @@ IN_SendKeyEvents (void)
case 1: case 1:
case 2: case 2:
case 3: case 3:
Key_Event(K_MOUSE1 + but - 1, event.type Key_Event(K_MOUSE1 + but - 1, 0, event.type
== SDL_MOUSEBUTTONDOWN); == SDL_MOUSEBUTTONDOWN);
break; break;
case 4: case 4:
Key_Event(K_MWHEELUP, event.type == SDL_MOUSEBUTTONDOWN); Key_Event(K_MWHEELUP, 0, event.type == SDL_MOUSEBUTTONDOWN);
break; break;
case 5: case 5:
Key_Event(K_MWHEELDOWN, event.type == SDL_MOUSEBUTTONDOWN); Key_Event(K_MWHEELDOWN, 0, event.type == SDL_MOUSEBUTTONDOWN);
break; break;
} }
break; break;
@ -286,10 +286,10 @@ void IN_Frame(void)
mouse_buttonstate = (i & ~0x06) | ((i & 0x02)<<1) | ((i & 0x04)>>1); mouse_buttonstate = (i & ~0x06) | ((i & 0x02)<<1) | ((i & 0x04)>>1);
for (i=0 ; i<3 ; i++) { for (i=0 ; i<3 ; i++) {
if ( (mouse_buttonstate & (1<<i)) && !(mouse_oldbuttonstate & (1<<i)) ) if ( (mouse_buttonstate & (1<<i)) && !(mouse_oldbuttonstate & (1<<i)) )
Key_Event (K_MOUSE1 + i, true); Key_Event (K_MOUSE1 + i, 0, true);
if ( !(mouse_buttonstate & (1<<i)) && (mouse_oldbuttonstate & (1<<i)) ) if ( !(mouse_buttonstate & (1<<i)) && (mouse_oldbuttonstate & (1<<i)) )
Key_Event (K_MOUSE1 + i, false); Key_Event (K_MOUSE1 + i, 0, false);
} }
mouse_oldbuttonstate = mouse_buttonstate; mouse_oldbuttonstate = mouse_buttonstate;
} }

View file

@ -80,7 +80,7 @@ static void keyhandler(int scancode, int state)
#if 0 #if 0
Con_Printf("scancode=%x (%d%s)\n", scancode, sc, scancode&0x80?"+128":""); Con_Printf("scancode=%x (%d%s)\n", scancode, sc, scancode&0x80?"+128":"");
#endif #endif
Key_Event(scantokey[sc], state == KEY_EVENTPRESS); Key_Event(scantokey[sc], -1, state == KEY_EVENTPRESS);
} }
@ -90,11 +90,11 @@ static void mousehandler(int buttonstate, int dx, int dy, int dz, int drx, int d
mx += dx; mx += dx;
my += dy; my += dy;
if (drx > 0) { if (drx > 0) {
Key_Event(K_MWHEELUP, 1); Key_Event(K_MWHEELUP, 0, 1);
Key_Event(K_MWHEELUP, 0); Key_Event(K_MWHEELUP, 0, 0);
} else if (drx < 0) { } else if (drx < 0) {
Key_Event(K_MWHEELDOWN, 1); Key_Event(K_MWHEELDOWN, 0, 1);
Key_Event(K_MWHEELDOWN, 0); Key_Event(K_MWHEELDOWN, 0, 0);
} }
} }
@ -318,24 +318,24 @@ void IN_Commands(void)
/* Perform button actions */ /* Perform button actions */
if ((mouse_buttonstate & MOUSE_LEFTBUTTON) && if ((mouse_buttonstate & MOUSE_LEFTBUTTON) &&
!(mouse_oldbuttonstate & MOUSE_LEFTBUTTON)) !(mouse_oldbuttonstate & MOUSE_LEFTBUTTON))
Key_Event (K_MOUSE1, true); Key_Event (K_MOUSE1, 0, true);
else if (!(mouse_buttonstate & MOUSE_LEFTBUTTON) && else if (!(mouse_buttonstate & MOUSE_LEFTBUTTON) &&
(mouse_oldbuttonstate & MOUSE_LEFTBUTTON)) (mouse_oldbuttonstate & MOUSE_LEFTBUTTON))
Key_Event (K_MOUSE1, false); Key_Event (K_MOUSE1, 0, false);
if ((mouse_buttonstate & MOUSE_RIGHTBUTTON) && if ((mouse_buttonstate & MOUSE_RIGHTBUTTON) &&
!(mouse_oldbuttonstate & MOUSE_RIGHTBUTTON)) !(mouse_oldbuttonstate & MOUSE_RIGHTBUTTON))
Key_Event (K_MOUSE2, true); Key_Event (K_MOUSE2, 0, true);
else if (!(mouse_buttonstate & MOUSE_RIGHTBUTTON) && else if (!(mouse_buttonstate & MOUSE_RIGHTBUTTON) &&
(mouse_oldbuttonstate & MOUSE_RIGHTBUTTON)) (mouse_oldbuttonstate & MOUSE_RIGHTBUTTON))
Key_Event (K_MOUSE2, false); Key_Event (K_MOUSE2, 0, false);
if ((mouse_buttonstate & MOUSE_MIDDLEBUTTON) && if ((mouse_buttonstate & MOUSE_MIDDLEBUTTON) &&
!(mouse_oldbuttonstate & MOUSE_MIDDLEBUTTON)) !(mouse_oldbuttonstate & MOUSE_MIDDLEBUTTON))
Key_Event (K_MOUSE3, true); Key_Event (K_MOUSE3, 0, true);
else if (!(mouse_buttonstate & MOUSE_MIDDLEBUTTON) && else if (!(mouse_buttonstate & MOUSE_MIDDLEBUTTON) &&
(mouse_oldbuttonstate & MOUSE_MIDDLEBUTTON)) (mouse_oldbuttonstate & MOUSE_MIDDLEBUTTON))
Key_Event (K_MOUSE3, false); Key_Event (K_MOUSE3, 0, false);
mouse_oldbuttonstate = mouse_buttonstate; mouse_oldbuttonstate = mouse_buttonstate;
} }