Eliminado la variable global keystates

This commit is contained in:
2022-10-20 14:03:25 +02:00
parent 52ce550ba6
commit 04844b0a5b
3 changed files with 4 additions and 5 deletions

View File

@@ -106,6 +106,6 @@ const int BUTTON_L = 6;
const int BUTTON_R = 7; const int BUTTON_R = 7;
//Estado del teclado SDL //Estado del teclado SDL
const Uint8 *keystates; //const Uint8 *keystates;
#endif #endif

View File

@@ -332,7 +332,6 @@ bool GameDirector::checkPlayerBallonCollision()
//Comprueba y procesa la colisión entre las balas y los globos //Comprueba y procesa la colisión entre las balas y los globos
void GameDirector::processBulletBallonCollision() void GameDirector::processBulletBallonCollision()
{ {
bool result = false;
for (Uint8 i = 0; i < mMaxBalloons; i++) for (Uint8 i = 0; i < mMaxBalloons; i++)
{ {
for (Uint8 j = 0; j < mMaxBullets; j++) for (Uint8 j = 0; j < mMaxBullets; j++)
@@ -482,7 +481,7 @@ void GameDirector::checkMenaceLevel()
void GameDirector::checkGameInput() void GameDirector::checkGameInput()
{ {
//Obtiene el estado de las teclas pulsadas del teclado //Obtiene el estado de las teclas pulsadas del teclado
keystates = SDL_GetKeyboardState(NULL); const Uint8 *keystates = SDL_GetKeyboardState(NULL);
//Si está pulsada la tecla izquierda o el mando hacia la izquierda //Si está pulsada la tecla izquierda o el mando hacia la izquierda
if ((keystates[SDL_SCANCODE_LEFT] != 0) || (SDL_JoystickGetAxis(gGameController, 0) < -JOYSTICK_DEAD_ZONE)) if ((keystates[SDL_SCANCODE_LEFT] != 0) || (SDL_JoystickGetAxis(gGameController, 0) < -JOYSTICK_DEAD_ZONE))
@@ -553,7 +552,7 @@ void GameDirector::checkGameInput()
void GameDirector::checkMenuInput(Menu *menu) void GameDirector::checkMenuInput(Menu *menu)
{ {
//Obtiene el estado de las teclas pulsadas del teclado //Obtiene el estado de las teclas pulsadas del teclado
keystates = SDL_GetKeyboardState(NULL); const Uint8 *keystates = SDL_GetKeyboardState(NULL);
//Si está pulsada la tecla izquierda o el mando hacia la izquierda //Si está pulsada la tecla izquierda o el mando hacia la izquierda
if ((keystates[SDL_SCANCODE_UP] != 0) || (SDL_JoystickGetAxis(gGameController, 1) < -JOYSTICK_DEAD_ZONE)) if ((keystates[SDL_SCANCODE_UP] != 0) || (SDL_JoystickGetAxis(gGameController, 1) < -JOYSTICK_DEAD_ZONE))

View File

@@ -137,7 +137,7 @@ void Menu::setRectSize()
//y dos por la izquierda, uno de ellos para el selector //y dos por la izquierda, uno de ellos para el selector
for (i = 0; i < mTotalItems; i++) for (i = 0; i < mTotalItems; i++)
{ {
if (mMenuItem[i].label.length() > maxLength) if ((int)mMenuItem[i].label.length() > maxLength)
{ {
maxLength = mMenuItem[i].label.length(); maxLength = mMenuItem[i].label.length();
} }