Añadido sonido al sprite de la demo
This commit is contained in:
8
main.cpp
8
main.cpp
@@ -64,10 +64,10 @@ int main(int argc, char *argv[])
|
|||||||
JA_Init(48000, AUDIO_S16, 2);
|
JA_Init(48000, AUDIO_S16, 2);
|
||||||
|
|
||||||
JA_Music_t *music;
|
JA_Music_t *music;
|
||||||
JA_Sound_t *peiv;
|
JA_Sound_t *sound;
|
||||||
|
|
||||||
music = JA_LoadMusic(asset->get("music.ogg").c_str());
|
music = JA_LoadMusic(asset->get("music.ogg").c_str());
|
||||||
peiv = JA_LoadSound(asset->get("sound.wav").c_str());
|
sound = JA_LoadSound(asset->get("sound.wav").c_str());
|
||||||
int volume = 128;
|
int volume = 128;
|
||||||
|
|
||||||
// Inicializa el texto
|
// Inicializa el texto
|
||||||
@@ -124,10 +124,12 @@ int main(int argc, char *argv[])
|
|||||||
if (sprite->getPosX() + sprite->getWidth() > options->gameWidth or sprite->getPosX() < 0)
|
if (sprite->getPosX() + sprite->getWidth() > options->gameWidth or sprite->getPosX() < 0)
|
||||||
{
|
{
|
||||||
sprite->setVelX(sprite->getVelX() * -1);
|
sprite->setVelX(sprite->getVelX() * -1);
|
||||||
|
JA_PlaySound(sound);
|
||||||
}
|
}
|
||||||
if (sprite->getPosY() + sprite->getHeight() > options->gameHeight or sprite->getPosY() < 0)
|
if (sprite->getPosY() + sprite->getHeight() > options->gameHeight or sprite->getPosY() < 0)
|
||||||
{
|
{
|
||||||
sprite->setVelY(sprite->getVelY() * -1);
|
sprite->setVelY(sprite->getVelY() * -1);
|
||||||
|
JA_PlaySound(sound);
|
||||||
}
|
}
|
||||||
sprite->update();
|
sprite->update();
|
||||||
}
|
}
|
||||||
@@ -165,7 +167,7 @@ int main(int argc, char *argv[])
|
|||||||
delete text;
|
delete text;
|
||||||
|
|
||||||
// Finaliza jail_audio
|
// Finaliza jail_audio
|
||||||
JA_DeleteSound(peiv);
|
JA_DeleteSound(sound);
|
||||||
JA_DeleteMusic(music);
|
JA_DeleteMusic(music);
|
||||||
|
|
||||||
// Finaliza el objeto con la lista de recuros
|
// Finaliza el objeto con la lista de recuros
|
||||||
|
|||||||
Reference in New Issue
Block a user