bill@newbreedsoftware.com
http://www.newbreedsoftware.com/supertux/
- April 11, 2000 - December 9, 2003
+ April 11, 2000 - December 29, 2003
*/
#include <stdio.h>
#include "screen.h"
#include "high_scores.h"
#include "menu.h"
+#include "type.h"
/* --- TITLE SCREEN --- */
int title(void)
{
- SDL_Surface * title, * anim1, * anim2;
+ texture_type title, anim1, anim2;
SDL_Event event;
SDLKey key;
int done, quit, frame, pict, last_highscore;
/* Init menu variables */
initmenu();
+ clearscreen(0, 0, 0);
updatescreen();
-
/* Load images: */
- title = load_image(DATA_PREFIX "/images/title/title.png", IGNORE_ALPHA);
- anim1 = load_image(DATA_PREFIX "/images/title/title-anim2.png",
- IGNORE_ALPHA);
- anim2 = load_image(DATA_PREFIX "/images/title/title-anim1.png",
- IGNORE_ALPHA);
+ texture_load(&title,DATA_PREFIX "/images/title/title.png", IGNORE_ALPHA);
+ texture_load(&anim1,DATA_PREFIX "/images/title/title-anim2.png", IGNORE_ALPHA);
+ texture_load(&anim2,DATA_PREFIX "/images/title/title-anim1.png", IGNORE_ALPHA);
/* --- Main title loop: --- */
/* Draw the title background: */
- drawimage(title, 0, 0, NO_UPDATE);
+ texture_draw(&title, 0, 0, NO_UPDATE);
/* Draw the high score: */
last_highscore = load_hs();
sprintf(str, "High score: %d", last_highscore);
- drawcenteredtext(str, 460, letters_red, NO_UPDATE);
+ drawcenteredtext(str, 460, letters_red, NO_UPDATE, 1);
while (!done && !quit)
{
+
frame++;
if (event.type == SDL_QUIT)
{
/* Quit event - quit: */
-
quit = 1;
}
else if (event.type == SDL_KEYDOWN)
key = event.key.keysym.sym;
- /* Check for menu events */
+ /* Check for menu events */
menu_event(key);
-
+
if (key == SDLK_ESCAPE)
{
/* Escape: Quit: */
}
- if(menu_change)
+ if(use_gl || menu_change)
{
/* Draw the title background: */
- drawimage(title, 0, 0, NO_UPDATE);
+ texture_draw_bg(&title, NO_UPDATE);
/* Draw the high score: */
sprintf(str, "High score: %d", last_highscore);
- drawcenteredtext(str, 460, letters_red, NO_UPDATE);
+ drawcenteredtext(str, 460, letters_red, NO_UPDATE, 1);
}
/* Don't draw menu, if quit is true */
pict = (frame / 5) % 3;
if (pict == 0)
- drawpart(title, 560, 270, 80, 75, NO_UPDATE);
+ texture_draw_part(&title, 560, 270, 80, 75, NO_UPDATE);
else if (pict == 1)
- drawimage(anim1, 560, 270, NO_UPDATE);
+ texture_draw(&anim1, 560, 270, NO_UPDATE);
else if (pict == 2)
- drawimage(anim2, 560, 270, NO_UPDATE);
-
+ texture_draw(&anim2, 560, 270, NO_UPDATE);
- SDL_Flip(screen);
+ flipscreen();
/* Pause: */
/* Free surfaces: */
- SDL_FreeSurface(title);
- SDL_FreeSurface(anim1);
- SDL_FreeSurface(anim2);
+ texture_free(&title);
+ texture_free(&anim1);
+ texture_free(&anim2);
/* Return to main! */