4 Super Tux - Title Screen
7 bill@newbreedsoftware.com
8 http://www.newbreedsoftware.com/supertux/
10 April 11, 2000 - April 12, 2000
19 #include <SDL_image.h>
22 #include <SDL_mixer.h>
27 #include <sys/types.h>
37 /* --- TITLE SCREEN --- */
41 SDL_Surface * title, * anim1, * anim2;
44 int done, quit, frame, pict;
55 title = load_image(DATA_PREFIX "/images/title/title.png", IGNORE_ALPHA);
56 anim1 = load_image(DATA_PREFIX "/images/title/title-anim2.png",
58 anim2 = load_image(DATA_PREFIX "/images/title/title-anim1.png",
62 /* Draw the title background: */
64 drawimage(title, 0, 0, UPDATE);
67 /* --- Main title loop: --- */
81 while (SDL_PollEvent(&event))
83 if (event.type == SDL_QUIT)
85 /* Quit event - quit: */
89 else if (event.type == SDL_KEYDOWN)
93 key = event.key.keysym.sym;
95 if (key == SDLK_ESCAPE)
101 else if (key == SDLK_SPACE || key == SDLK_RETURN)
103 /* Space / Return: Continue: */
109 else if (event.type == SDL_JOYBUTTONDOWN)
111 /* Joystick button: Continue: */
119 /* Animate title screen: */
121 pict = (frame / 5) % 3;
124 drawpart(title, 560, 270, 80, 75, UPDATE);
126 drawimage(anim1, 560, 270, UPDATE);
128 drawimage(anim2, 560, 270, UPDATE);
135 while (!done && !quit);
140 SDL_FreeSurface(title);
141 SDL_FreeSurface(anim1);
142 SDL_FreeSurface(anim2);
145 /* Return to main! */