MBoolean OptionKeyIsPressed( void ) { int arraySize; unsigned char* pressedKeys; SDLU_PumpEvents(); pressedKeys = SDL_GetKeyState( &arraySize ); return pressedKeys[ SDLK_LALT ] || pressedKeys[ SDLK_RALT ]; }
MBoolean ControlKeyIsPressed( void ) { int arraySize; unsigned char* pressedKeys; SDLU_PumpEvents(); pressedKeys = SDL_GetKeyState( &arraySize ); return pressedKeys[ SDLK_LCTRL ] || pressedKeys[ SDLK_RCTRL ]; }
void WaitForRegainFocus() { do { SDLU_PumpEvents(); SDL_Delay(50); } while( !SDLU_IsForeground() ); DoFullRepaint(); }
void CheckKeys() { int player; int arraySize; unsigned char* pressedKeys; SDLU_PumpEvents(); pressedKeys = SDL_GetKeyState( &arraySize ); // Check for game keys for( player = 0; player < 2; player++ ) { if( pressedKeys[ playerKeys[player][0] ] ) hitKey[player].left++; else hitKey[player].left = 0; if( pressedKeys[ playerKeys[player][1] ] ) hitKey[player].right++; else hitKey[player].right = 0; if( pressedKeys[ playerKeys[player][2] ] ) hitKey[player].drop++; else hitKey[player].drop = 0; if( pressedKeys[ playerKeys[player][3] ] ) hitKey[player].rotate++; else hitKey[player].rotate = 0; } pauseKey = pressedKeys[ SDLK_ESCAPE ]; }
MBoolean AnyKeyIsPressed( void ) { int index; int arraySize; unsigned char* pressedKeys; SDLU_PumpEvents(); pressedKeys = SDL_GetKeyState( &arraySize ); // Only check ASCII keys. (Reason: some extended keys, like NUMLOCK or CAPSLOCK, // can be on all the time even if a key really isn't depressed.) if( arraySize > 128 ) arraySize = 128; for( index = 0; index < arraySize; index++ ) { if( pressedKeys[index] ) { return true; } } return false; }
int SDLU_Button( void ) { SDLU_PumpEvents(); return s_mouseButton; }
void SDLU_GetMouse( SDLU_Point* pt ) { SDLU_PumpEvents(); *pt = s_mousePosition; }