+
+void display_credits()
+{
+ int done;
+ int scroll, speed;
+ timer_type timer;
+ int n,d;
+ int length;
+ FILE* fi;
+ char temp[1024];
+ string_list_type names;
+ string_list_init(&names);
+ char filename[1024];
+ sprintf(filename,"%s/CREDITS",DATA_PREFIX);
+ if((fi = fopen(filename,"r")) != NULL)
+ {
+ while(fgets(temp, sizeof(temp), fi) != NULL)
+ {
+ temp[strlen(temp)-1]='\0';
+ string_list_add_item(&names,temp);
+ }
+ fclose(fi);
+ }
+ else
+ {
+ string_list_add_item(&names,"Credits were not found!");
+ string_list_add_item(&names,"Shame on the guy, who");
+ string_list_add_item(&names,"forgot to include them");
+ string_list_add_item(&names,"in your SuperTux distribution.");
+ }
+
+
+ timer_init(&timer, SDL_GetTicks());
+ timer_start(&timer, 50);
+
+ scroll = 0;
+ speed = 1;
+ done = 0;
+
+ n = d = 0;
+
+ length = names.num_items;
+
+ SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+
+ while(done == 0)
+ {
+ /* in case of input, exit */
+ while(SDL_PollEvent(&event))
+ switch(event.type)
+ {
+ case SDL_KEYDOWN:
+ switch(event.key.keysym.sym)
+ {
+ case SDLK_DOWN:
+ speed -= 1;
+ break;
+ case SDLK_UP:
+ speed += 1;
+ break;
+ case SDLK_SPACE:
+ case SDLK_RETURN:
+ if(speed >= 0)
+ scroll += 60;
+ break;
+ case SDLK_ESCAPE:
+ done = 1;
+ break;
+ default:
+ break;
+ }
+ break;
+ case SDL_QUIT:
+ done = 1;
+ break;
+ default:
+ break;
+ }
+
+ /* draw the credits */
+
+ draw_background();
+
+ text_drawf(&white_big_text, "- Credits -", 0, screen->h-scroll, A_HMIDDLE, A_TOP, 2, NO_UPDATE);
+
+ for(i = 0, n = 0, d = 0; i < length; i++,n++,d++)
+ {
+ if(names.item[i] == "")
+ n--;
+ else
+ {
+ if(names.item[i][0] == ' ')
+ text_drawf(&white_small_text, names.item[i], 0, 60+screen->h+(n*18)+(d*18)-scroll-10, A_HMIDDLE, A_TOP, 1, NO_UPDATE);
+ else if(names.item[i][0] == ' ')
+ text_drawf(&white_text, names.item[i], 0, 60+screen->h+(n*18)+(d*18)-scroll, A_HMIDDLE, A_TOP, 1, NO_UPDATE);
+ else if(names.item[i+1][0] == '-' || names.item[i][0] == '-')
+ text_drawf(&white_big_text, names.item[i], 0, 60+screen->h+(n*18)+(d*18)-scroll, A_HMIDDLE, A_TOP, 1, NO_UPDATE);
+ else
+ text_drawf(&blue_text, names.item[i], 0, 60+screen->h+(n*18)+(d*18)-scroll, A_HMIDDLE, A_TOP, 1, NO_UPDATE);
+ }
+ }
+
+ texture_draw_part(&bkg_title, 0, 0, 0, 0, 640, 130, NO_UPDATE);
+
+ flipscreen();
+
+ if(60+screen->h+(n*18)+(d*18)-scroll < 0 && 20+60+screen->h+(n*18)+(d*18)-scroll < 0)
+ done = 1;
+
+ scroll += speed;
+ if(scroll < 0)
+ scroll = 0;
+
+ SDL_Delay(20);
+
+ if(timer_get_left(&timer) < 0)
+ {
+ frame++;
+ timer_start(&timer, 50);
+ }
+ }
+ string_list_free(&names);
+
+ SDL_EnableKeyRepeat(0, 0); // disables key repeating
+ show_menu = 1;
+ menu_set_current(&main_menu);
+}