4 Super Tux - Title Screen
7 bill@newbreedsoftware.com
8 http://www.newbreedsoftware.com/supertux/
10 April 11, 2000 - December 9, 2003
19 #include <SDL_image.h>
23 #include <sys/types.h>
31 #include "high_scores.h"
34 /* --- TITLE SCREEN --- */
38 SDL_Surface * title, * anim1, * anim2;
41 int done, quit, frame, pict;
53 title = load_image(DATA_PREFIX "/images/title/title.png", IGNORE_ALPHA);
54 anim1 = load_image(DATA_PREFIX "/images/title/title-anim2.png",
56 anim2 = load_image(DATA_PREFIX "/images/title/title-anim1.png",
60 /* Draw the title background: */
62 drawimage(title, 0, 0, UPDATE);
65 /* Draw the high score: */
67 sprintf(str, "High score: %d", load_hs());
68 drawcenteredtext(str, 460, letters_red, UPDATE);
71 /* --- Main title loop: --- */
85 while (SDL_PollEvent(&event))
87 if (event.type == SDL_QUIT)
89 /* Quit event - quit: */
93 else if (event.type == SDL_KEYDOWN)
97 key = event.key.keysym.sym;
99 if (key == SDLK_ESCAPE)
105 else if (key == SDLK_SPACE || key == SDLK_RETURN)
107 /* Space / Return: Continue: */
113 else if (event.type == SDL_JOYBUTTONDOWN)
115 /* Joystick button: Continue: */
123 /* Animate title screen: */
125 pict = (frame / 5) % 3;
128 drawpart(title, 560, 270, 80, 75, UPDATE);
130 drawimage(anim1, 560, 270, UPDATE);
132 drawimage(anim2, 560, 270, UPDATE);
139 while (!done && !quit);
144 SDL_FreeSurface(title);
145 SDL_FreeSurface(anim1);
146 SDL_FreeSurface(anim2);
149 /* Return to main! */