Actualizada la clase Text

This commit is contained in:
2022-08-29 17:47:06 +02:00
parent 21c844a925
commit 822386c269
4 changed files with 62 additions and 81 deletions

View File

@@ -20,9 +20,15 @@ Game::Game(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Lang *lang,
mRoom = new Room(mAsset->get(mCurrentRoom), mRenderer, mAsset, mItemTracker);
mPlayer = new Player(mSpawnPoint, mAsset->get("player01.png"), mRenderer, mAsset, mInput, mRoom);
mEventHandler = new SDL_Event();
mTextureText = new LTexture();
mText = new Text(mAsset->get("smb2.txt"), mTextureText, renderer);
mText = new Text(mAsset->get("smb2.png"), mAsset->get("smb2.txt"), renderer);
mFade = new Fade(renderer);
// Inicializa variables
mTicks = 0;
mTicksSpeed = 15;
mSection.name = SECTION_PROG_GAME;
mSection.subsection = SECTION_GAME_PLAY;
}
Game::~Game()
@@ -49,10 +55,6 @@ Game::~Game()
delete mEventHandler;
mEventHandler = nullptr;
mTextureText->unload();
delete mTextureText;
mTextureText = nullptr;
delete mText;
mText = nullptr;
@@ -60,35 +62,9 @@ Game::~Game()
mFade = nullptr;
}
// Inicializa las variables necesarias para la sección 'Game'
void Game::init()
{
// Carga los recursos
loadMedia();
mTicks = 0;
mTicksSpeed = 15;
mSection.name = SECTION_PROG_GAME;
mSection.subsection = SECTION_GAME_PLAY;
}
// Carga los recursos necesarios para la sección 'Game'
bool Game::loadMedia()
{
bool success = true;
// Texturas
success &= loadTextureFromFile(mTextureText, mAsset->get("smb2.png"), mRenderer);
return success;
}
// Bucle para el juego
section_t Game::run()
{
init();
while (mSection.name == SECTION_PROG_GAME)
{
// Sección juego jugando