-/*
- title.c
-
- Super Tux - Title Screen
-
- by Bill Kendrick
- bill@newbreedsoftware.com
- http://www.newbreedsoftware.com/supertux/
-
- April 11, 2000 - March 15, 2004
-*/
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
+// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
#include <iostream>
#include <stdio.h>
static bool walking;
static Timer random_timer;
-static int frame, i;
+static int frame;
static unsigned int last_update_time;
static unsigned int update_time;
{
Menu::current()->event(event);
}
- else
- {
- // FIXME: QUIT signal should be handled more generic, not locally
- if (event.type == SDL_QUIT)
- Menu::set_current(0);
- }
+ // FIXME: QUIT signal should be handled more generic, not locally
+ if (event.type == SDL_QUIT)
+ Menu::set_current(0);
}
/* Draw the background: */
display_credits();
Menu::set_current(main_menu);
break;
- case 5:
+ case 6:
Menu::set_current(0);
break;
}
#define MAX_VEL 10
#define SPEED 1
#define SCROLL 60
+#define ITEMS_SPACE 4
void display_credits()
{
int done;
int scroll, speed;
+ int y;
Timer timer;
- int n,d;
int length;
FILE* fi;
char temp[1024];
speed = 2;
done = 0;
- n = d = 0;
-
length = names.num_items;
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
white_big_text->drawf("- Credits -", 0, screen->h-scroll, A_HMIDDLE, A_TOP, 2);
- for(i = 0, n = 0, d = 0; i < length; i++,n++,d++)
+ y = 0;
+ for(int i = 0; i < length; i++)
{
- if(names.item[i] == "")
- n--;
- else
- {
- if(names.item[i][0] == ' ')
- white_small_text->drawf(names.item[i], 0, 60+screen->h+(n*18)+(d*18)-scroll-10, A_HMIDDLE, A_TOP, 1);
- else if(names.item[i][0] == ' ')
- white_text->drawf(names.item[i], 0, 60+screen->h+(n*18)+(d*18)-scroll, A_HMIDDLE, A_TOP, 1);
- else if(names.item[i+1][0] == '-' || names.item[i][0] == '-')
- white_big_text->drawf(names.item[i], 0, 60+screen->h+(n*18)+(d*18)-scroll, A_HMIDDLE, A_TOP, 3);
- else
- blue_text->drawf(names.item[i], 0, 60+screen->h+(n*18)+(d*18)-scroll, A_HMIDDLE, A_TOP, 1);
- }
+ switch(names.item[i][0])
+ {
+ case ' ':
+ white_small_text->drawf(names.item[i], 0, 60+screen->h+y-scroll, A_HMIDDLE, A_TOP, 1);
+ y += white_small_text->h+ITEMS_SPACE;
+ break;
+ case ' ':
+ white_text->drawf(names.item[i], 0, 60+screen->h+y-scroll, A_HMIDDLE, A_TOP, 1);
+ y += white_text->h+ITEMS_SPACE;
+ break;
+ case '-':
+ white_big_text->drawf(names.item[i], 0, 60+screen->h+y-scroll, A_HMIDDLE, A_TOP, 3);
+ y += white_big_text->h+ITEMS_SPACE;
+ break;
+ default:
+ blue_text->drawf(names.item[i], 0, 60+screen->h+y-scroll, A_HMIDDLE, A_TOP, 1);
+ y += blue_text->h+ITEMS_SPACE;
+ break;
+ }
}
flipscreen();
- if(60+screen->h+(n*18)+(d*18)-scroll < 0 && 20+60+screen->h+(n*18)+(d*18)-scroll < 0)
+ if(60+screen->h+y-scroll < 0 && 20+60+screen->h+y-scroll < 0)
done = 1;
scroll += speed;