Recarga de texturas en el cambio de modo de video
This commit is contained in:
@@ -151,22 +151,27 @@ void Game::checkEventHandler()
|
||||
|
||||
case SDL_SCANCODE_F:
|
||||
screen->switchVideoMode();
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F1:
|
||||
screen->setWindowSize(1);
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F2:
|
||||
screen->setWindowSize(2);
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F3:
|
||||
screen->setWindowSize(3);
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F4:
|
||||
screen->setWindowSize(4);
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -201,7 +206,7 @@ void Game::renderDebugInfo()
|
||||
return;
|
||||
}
|
||||
|
||||
// Pinta la rejilla
|
||||
// Pinta la rejilla
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 16);
|
||||
for (int i = 0; i < 240; i += 8)
|
||||
{
|
||||
@@ -258,3 +263,11 @@ void Game::checkScreenBorders()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Recarga las texturas
|
||||
void Game::reLoadTextures()
|
||||
{
|
||||
map->reLoadTextures();
|
||||
player->reLoadTextures();
|
||||
scoreboard->reLoadTexture();
|
||||
}
|
||||
@@ -58,6 +58,9 @@ private:
|
||||
// Comprueba si el jugador está en el borde y se ha de cambiar el mapa
|
||||
void checkScreenBorders();
|
||||
|
||||
// Recarga las texturas
|
||||
void reLoadTextures();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Debug *debug);
|
||||
|
||||
@@ -669,3 +669,10 @@ std::string Map::getEnemyFile()
|
||||
{
|
||||
return enemy_file;
|
||||
}
|
||||
|
||||
// Recarga las texturas
|
||||
void Map::reLoadTextures()
|
||||
{
|
||||
texture_tile->reLoad();
|
||||
fillMapTexture();
|
||||
}
|
||||
@@ -123,6 +123,9 @@ public:
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
std::string getEnemyFile();
|
||||
|
||||
// Recarga las texturas
|
||||
void reLoadTextures();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -481,3 +481,9 @@ int Player::checkActors()
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
// Recarga las texturas
|
||||
void Player::reLoadTextures()
|
||||
{
|
||||
texture->reLoad();
|
||||
}
|
||||
@@ -119,6 +119,9 @@ public:
|
||||
|
||||
// Pasa la referencia del mapa
|
||||
void setMap(Map *map);
|
||||
|
||||
// Recarga las texturas
|
||||
void reLoadTextures();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user