Trabajando en la cache de los recursos de los items

This commit is contained in:
2022-10-05 14:02:50 +02:00
parent 901757b9b2
commit 8076d8a765
5 changed files with 22 additions and 20 deletions

View File

@@ -183,7 +183,7 @@ bool AnimatedSprite::loadFromFile(std::string filePath)
if (file.good())
{
// Procesa el fichero linea a linea
printf("Reading file %s\n", filename.c_str());
std::cout << "Loading animation from file: " << filePath.c_str() << std::endl;
while (std::getline(file, line))
{
// Si la linea contiene el texto [animation] se realiza el proceso de carga de una animación
@@ -294,7 +294,6 @@ bool AnimatedSprite::loadFromFile(std::string filePath)
}
// Cierra el fichero
printf("Closing file %s\n\n", filename.c_str());
file.close();
}
// El fichero no se puede abrir

View File

@@ -49,11 +49,6 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr
grassSprite = new Sprite(0, 0, 256, 6, gameGrassTexture, renderer);
powerMeterSprite = new Sprite(PLAY_AREA_CENTER_X - 20, 170, 40, 7, gamePowerMeterTexture, renderer);
// Carga ficheros
loadScoreFile();
loadDemoFile();
// Inicializa las variables necesarias para la sección 'Game'
init();
}
@@ -335,7 +330,12 @@ void Game::init()
// Carga los recursos necesarios para la sección 'Game'
void Game::loadMedia()
{
std::cout << "** LOADING RESOURCES FOR GAME SECTION" << std::endl;
std::cout << std::endl
<< "** LOADING RESOURCES FOR GAME SECTION" << std::endl;
// Carga ficheros
loadScoreFile();
loadDemoFile();
// Texturas
balloon1Texture = new LTexture(renderer, asset->get("balloon1.png"));
@@ -388,7 +388,8 @@ void Game::loadMedia()
// Musicas
gameMusic = JA_LoadMusic(asset->get("playing.ogg").c_str());
std::cout << "** RESOURCES FOR GAME SECTION LOADED" << std::endl << std::endl;
std::cout << "** RESOURCES FOR GAME SECTION LOADED" << std::endl
<< std::endl;
}
// Carga el fichero de puntos

View File

@@ -125,11 +125,12 @@ private:
std::vector<Item *> items; // Vector con los items
std::vector<SmartSprite *> smartSprites; // Vector con los smartsprites
LTexture *balloon1Texture; // Textura para los globos
LTexture *balloon2Texture; // Textura para los globos
LTexture *balloon3Texture; // Textura para los globos
LTexture *balloon4Texture; // Textura para los globos
LTexture *bulletTexture; // Textura para las balas
LTexture *balloon1Texture; // Textura para los globos
LTexture *balloon2Texture; // Textura para los globos
LTexture *balloon3Texture; // Textura para los globos
LTexture *balloon4Texture; // Textura para los globos
LTexture *bulletTexture; // Textura para las balas
std::vector<LTexture *> itemTexture; // Vector con las texturas de los items
LTexture *gameBuildingsTexture; // Textura con los edificios de fondo
LTexture *gameCloudsTexture; // Textura con las nubes de fondo
@@ -140,10 +141,11 @@ private:
LTexture *itemTexture; // Textura para los items
std::vector<std::string> *balloon1Animation; // Información para la animación de los globos
std::vector<std::string> *balloon2Animation; // Información para la animación de los globos
std::vector<std::string> *balloon3Animation; // Información para la animación de los globos
std::vector<std::string> *balloon4Animation; // Información para la animación de los globos
std::vector<std::string> *balloon1Animation; // Información para la animación de los globos
std::vector<std::string> *balloon2Animation; // Información para la animación de los globos
std::vector<std::string> *balloon3Animation; // Información para la animación de los globos
std::vector<std::string> *balloon4Animation; // Información para la animación de los globos
std::vector<std::vector<std::string>> *itemAnimations; // Vector con las animaciones de los items
Text *text; // Fuente para los textos del juego
Text *textBig; // Fuente de texto grande

View File

@@ -157,7 +157,7 @@ bool Menu::load(std::string file_path)
}
// Cierra el fichero
printf("Closing file %s\n\n", filename.c_str());
printf("Closing file %s\n", filename.c_str());
file.close();
}
// El fichero no se puede abrir

View File

@@ -151,7 +151,7 @@ void Text::initOffsetFromFile(std::string file)
};
// Cierra el fichero
printf("Text loaded: %s\n\n", filename.c_str());
printf("Text loaded: %s\n", filename.c_str());
rfile.close();
}