Trabajando en la cache de los recursos de los items
This commit is contained in:
@@ -183,7 +183,7 @@ bool AnimatedSprite::loadFromFile(std::string filePath)
|
|||||||
if (file.good())
|
if (file.good())
|
||||||
{
|
{
|
||||||
// Procesa el fichero linea a linea
|
// 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))
|
while (std::getline(file, line))
|
||||||
{
|
{
|
||||||
// Si la linea contiene el texto [animation] se realiza el proceso de carga de una animación
|
// 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
|
// Cierra el fichero
|
||||||
printf("Closing file %s\n\n", filename.c_str());
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
// El fichero no se puede abrir
|
// El fichero no se puede abrir
|
||||||
|
|||||||
@@ -49,11 +49,6 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr
|
|||||||
grassSprite = new Sprite(0, 0, 256, 6, gameGrassTexture, renderer);
|
grassSprite = new Sprite(0, 0, 256, 6, gameGrassTexture, renderer);
|
||||||
powerMeterSprite = new Sprite(PLAY_AREA_CENTER_X - 20, 170, 40, 7, gamePowerMeterTexture, 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'
|
// Inicializa las variables necesarias para la sección 'Game'
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@@ -335,7 +330,12 @@ void Game::init()
|
|||||||
// Carga los recursos necesarios para la sección 'Game'
|
// Carga los recursos necesarios para la sección 'Game'
|
||||||
void Game::loadMedia()
|
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
|
// Texturas
|
||||||
balloon1Texture = new LTexture(renderer, asset->get("balloon1.png"));
|
balloon1Texture = new LTexture(renderer, asset->get("balloon1.png"));
|
||||||
@@ -388,7 +388,8 @@ void Game::loadMedia()
|
|||||||
// Musicas
|
// Musicas
|
||||||
gameMusic = JA_LoadMusic(asset->get("playing.ogg").c_str());
|
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
|
// Carga el fichero de puntos
|
||||||
|
|||||||
@@ -125,11 +125,12 @@ private:
|
|||||||
std::vector<Item *> items; // Vector con los items
|
std::vector<Item *> items; // Vector con los items
|
||||||
std::vector<SmartSprite *> smartSprites; // Vector con los smartsprites
|
std::vector<SmartSprite *> smartSprites; // Vector con los smartsprites
|
||||||
|
|
||||||
LTexture *balloon1Texture; // Textura para los globos
|
LTexture *balloon1Texture; // Textura para los globos
|
||||||
LTexture *balloon2Texture; // Textura para los globos
|
LTexture *balloon2Texture; // Textura para los globos
|
||||||
LTexture *balloon3Texture; // Textura para los globos
|
LTexture *balloon3Texture; // Textura para los globos
|
||||||
LTexture *balloon4Texture; // Textura para los globos
|
LTexture *balloon4Texture; // Textura para los globos
|
||||||
LTexture *bulletTexture; // Textura para las balas
|
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 *gameBuildingsTexture; // Textura con los edificios de fondo
|
||||||
LTexture *gameCloudsTexture; // Textura con las nubes de fondo
|
LTexture *gameCloudsTexture; // Textura con las nubes de fondo
|
||||||
@@ -140,10 +141,11 @@ private:
|
|||||||
|
|
||||||
LTexture *itemTexture; // Textura para los items
|
LTexture *itemTexture; // Textura para los items
|
||||||
|
|
||||||
std::vector<std::string> *balloon1Animation; // 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> *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> *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> *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 *text; // Fuente para los textos del juego
|
||||||
Text *textBig; // Fuente de texto grande
|
Text *textBig; // Fuente de texto grande
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ bool Menu::load(std::string file_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
printf("Closing file %s\n\n", filename.c_str());
|
printf("Closing file %s\n", filename.c_str());
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
// El fichero no se puede abrir
|
// El fichero no se puede abrir
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ void Text::initOffsetFromFile(std::string file)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
printf("Text loaded: %s\n\n", filename.c_str());
|
printf("Text loaded: %s\n", filename.c_str());
|
||||||
rfile.close();
|
rfile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user