Exemple #1
0
MBoolean OptionKeyIsPressed( void )
{
	int arraySize;
	unsigned char* pressedKeys;
				                 
	SDLU_PumpEvents();          
	pressedKeys = SDL_GetKeyState( &arraySize );

	return pressedKeys[ SDLK_LALT ] || pressedKeys[ SDLK_RALT ];
}
Exemple #2
0
MBoolean ControlKeyIsPressed( void )
{
	int arraySize;
	unsigned char* pressedKeys;
				                 
	SDLU_PumpEvents();          
	pressedKeys = SDL_GetKeyState( &arraySize );

	return pressedKeys[ SDLK_LCTRL ] || pressedKeys[ SDLK_RCTRL ];
}
Exemple #3
0
void WaitForRegainFocus()
{
    do
    {  
        SDLU_PumpEvents();
        SDL_Delay(50);
    }
    while( !SDLU_IsForeground() );    

	DoFullRepaint();
}
Exemple #4
0
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 ];
}
Exemple #5
0
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;
}
Exemple #6
0
int SDLU_Button( void )
{
	SDLU_PumpEvents();
	return s_mouseButton;
}
Exemple #7
0
void SDLU_GetMouse( SDLU_Point* pt )
{
	SDLU_PumpEvents();
	*pt = s_mousePosition;
}