[Add] Added intro music.

This commit is contained in:
Allanis 2014-03-06 01:59:13 +00:00
parent 5af179ffaa
commit 88b9c1a48a
2 changed files with 12 additions and 1 deletions

BIN
snd/music/intro.ogg Normal file

Binary file not shown.

View File

@ -12,6 +12,7 @@
#include "log.h" #include "log.h"
#include "pack.h" #include "pack.h"
#include "font.h" #include "font.h"
#include "music.h"
#include "intro.h" #include "intro.h"
#define INTRO_FONT_SIZE 18. /**< Intro text font size. */ #define INTRO_FONT_SIZE 18. /**< Intro text font size. */
@ -103,6 +104,11 @@ int intro_display(void) {
density /= (double)intro_font.h; /* char / pixel. */ density /= (double)intro_font.h; /* char / pixel. */
vel = INTRO_SPEED / density; /* (char / s) * (pixel / char) = pixel / s */ vel = INTRO_SPEED / density; /* (char / s) * (pixel / char) = pixel / s */
/* Change music to intro music. */
music_load("intro");
music_play();
/* Prepare for intro loop. */
x = 100.; x = 100.;
y = 0.; y = 0.;
tlast = SDL_GetTicks(); tlast = SDL_GetTicks();
@ -123,6 +129,8 @@ int intro_display(void) {
/* Skip the boring intro we saw a million times already! */ /* Skip the boring intro we saw a million times already! */
if(event.key.keysym.sym == SDLK_ESCAPE) if(event.key.keysym.sym == SDLK_ESCAPE)
offset = max * (intro_font.h + 5.); offset = max * (intro_font.h + 5.);
else if(!isspace(event.key.keysym.sym))
break;
/* Purpose fallthrough. */ /* Purpose fallthrough. */
case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONDOWN:
offset += 250.; offset += 250.;
@ -162,8 +170,11 @@ int intro_display(void) {
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
SDL_Delay(10); /* No need to go burning our CPU now! */ SDL_Delay(10); /* No need to go burning our CPU now! */
} }
/* Stops music, normal music will start shortly after. */
music_stop();
/* Cleanup our mess. */ /* Cleanup our mess. */
intro_cleanup(); intro_cleanup();