Añadida música
This commit is contained in:
@@ -22,6 +22,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input)
|
||||
eventHandler = new SDL_Event();
|
||||
text = new Text(asset->get("smb2.png"), asset->get("smb2.txt"), renderer);
|
||||
debugText = new Text(asset->get("debug.png"), asset->get("debug.txt"), renderer);
|
||||
music = JA_LoadMusic(asset->get("jd.ogg").c_str());
|
||||
|
||||
// Inicializa variables
|
||||
ticks = 0;
|
||||
@@ -64,6 +65,8 @@ Game::~Game()
|
||||
// Bucle para el juego
|
||||
section_t Game::run()
|
||||
{
|
||||
JA_PlayMusic(music);
|
||||
|
||||
while (section.name == SECTION_PROG_GAME)
|
||||
{
|
||||
// Sección juego jugando
|
||||
@@ -74,6 +77,8 @@ section_t Game::run()
|
||||
}
|
||||
}
|
||||
|
||||
JA_StopMusic();
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
@@ -103,6 +108,10 @@ void Game::update()
|
||||
debug = !debug;
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_M:
|
||||
(JA_GetMusicState() == JA_MUSIC_PLAYING) ? JA_PauseMusic() : JA_ResumeMusic();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F:
|
||||
screen->switchVideoMode();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user