[Super-tux-commit] supertux/src gameloop.cpp,1.157,1.158 intro.cpp,1.29,1.30 resources.cpp,1.44,1.45
Brought to you by:
wkendrick
From: Tobias G. <to...@us...> - 2004-07-26 15:48:48
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv708/src Modified Files: gameloop.cpp intro.cpp resources.cpp resources.h title.cpp worldmap.cpp Log Message: Made the SuperTux library again a bit more selfstanding. Moved global fonts to src/ and they are handled as static variables inside Menu:: and Button:: . Index: resources.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- resources.h 21 Jul 2004 16:51:53 -0000 1.13 +++ resources.h 26 Jul 2004 15:48:38 -0000 1.14 @@ -82,6 +82,14 @@ extern Menu* load_game_menu; extern Menu* save_game_menu; +extern Font* gold_text; +extern Font* white_text; +extern Font* blue_text; +extern Font* gray_text; +extern Font* white_small_text; +extern Font* white_big_text; +extern Font* yellow_nums; + void loadshared(); void unloadshared(); Index: intro.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/intro.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- intro.cpp 21 Jul 2004 16:51:53 -0000 1.29 +++ intro.cpp 26 Jul 2004 15:48:38 -0000 1.30 @@ -22,11 +22,12 @@ #include "app/defines.h" #include "video/font.h" #include "video/screen.h" +#include "resources.h" using namespace SuperTux; void draw_intro() { - display_text_file("intro.txt", 1); + display_text_file("intro.txt", 1, white_big_text , white_text, white_small_text, blue_text ); } Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.110 retrieving revision 1.111 diff -u -d -r1.110 -r1.111 --- title.cpp 25 Jul 2004 19:03:36 -0000 1.110 +++ title.cpp 26 Jul 2004 15:48:38 -0000 1.111 @@ -352,7 +352,7 @@ update_time = st_get_ticks(); break; case MNID_CREDITS: - display_text_file("CREDITS", SCROLL_SPEED_CREDITS); + display_text_file("CREDITS", SCROLL_SPEED_CREDITS, white_big_text , white_text, white_small_text, blue_text ); Menu::set_current(main_menu); break; case MNID_QUITMAINMENU: Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.100 retrieving revision 1.101 diff -u -d -r1.100 -r1.101 --- worldmap.cpp 25 Jul 2004 19:03:36 -0000 1.100 +++ worldmap.cpp 26 Jul 2004 15:48:38 -0000 1.101 @@ -784,7 +784,7 @@ if (!level->extro_filename.empty()) { // Display a text file - display_text_file(level->extro_filename, SCROLL_SPEED_MESSAGE); + display_text_file(level->extro_filename, SCROLL_SPEED_MESSAGE, white_big_text , white_text, white_small_text, blue_text ); } if (level->swap_x != -1 && level->swap_y != -1) { Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.157 retrieving revision 1.158 diff -u -d -r1.157 -r1.158 --- gameloop.cpp 25 Jul 2004 19:03:36 -0000 1.157 +++ gameloop.cpp 26 Jul 2004 15:48:38 -0000 1.158 @@ -851,13 +851,19 @@ // shrink_fade(Point((screen->w/2),(screen->h/2)), 1000); fadeout(256); + + DrawingContext context; + context.draw_text_center(white_text, "Loading...", + Vector(0, screen->h/2), LAYER_FOREGROUND1); + context.do_drawing(); + WorldMapNS::WorldMap worldmap; - + // Load the game or at least set the savegame_file variable worldmap.loadgame(slotfile); worldmap.display(); - + Menu::set_current(main_menu); st_pause_ticks_stop(); Index: resources.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- resources.cpp 25 Jul 2004 19:03:36 -0000 1.44 +++ resources.cpp 26 Jul 2004 15:48:38 -0000 1.45 @@ -28,6 +28,7 @@ #include "audio/sound_manager.h" #include "app/setup.h" #include "door.h" +#include "gui/button.h" Surface* img_waves[3]; Surface* img_water; @@ -76,9 +77,41 @@ "/sounds/explosion.wav" }; + +Font* gold_text; +Font* blue_text; +Font* gray_text; +Font* yellow_nums; +Font* white_text; +Font* white_small_text; +Font* white_big_text; + /* Load graphics/sounds shared between all levels: */ void loadshared() { + + /* Load global images: */ + gold_text = new Font(datadir + "/images/fonts/gold.png", Font::TEXT, 16,18); + blue_text = new Font(datadir + "/images/fonts/blue.png", Font::TEXT, 16,18,3); + white_text = new Font(datadir + "/images/fonts/white.png", + Font::TEXT, 16,18); + gray_text = new Font(datadir + "/images/fonts/gray.png", + Font::TEXT, 16,18); + white_small_text = new Font(datadir + "/images/fonts/white-small.png", + Font::TEXT, 8,9, 1); + white_big_text = new Font(datadir + "/images/fonts/white-big.png", + Font::TEXT, 20,22, 3); + yellow_nums = new Font(datadir + "/images/fonts/numbers.png", + Font::NUM, 32,32); + + Menu::default_font = white_text; + Menu::active_font = blue_text; + Menu::deactive_font = gray_text; + Menu::label_font = white_big_text; + Menu::field_font = gold_text; + + Button::info_font = white_small_text; + int i; sprite_manager = new SpriteManager(datadir + "/supertux.strf"); @@ -90,13 +123,13 @@ char img_name[1024]; for (int i = 0; i < GROWING_FRAMES; i++) - { - sprintf(img_name, "%s/images/shared/tux-grow-left-%i.png", datadir.c_str(), i+1); - growingtux_left[i] = new Surface(img_name, false); + { + sprintf(img_name, "%s/images/shared/tux-grow-left-%i.png", datadir.c_str(), i+1); + growingtux_left[i] = new Surface(img_name, false); - sprintf(img_name, "%s/images/shared/tux-grow-right-%i.png", datadir.c_str(), i+1); - growingtux_right[i] = new Surface(img_name, false); - } + sprintf(img_name, "%s/images/shared/tux-grow-right-%i.png", datadir.c_str(), i+1); + growingtux_right[i] = new Surface(img_name, false); + } smalltux.stand_left = sprite_manager->load("smalltux-stand-left"); smalltux.stand_right = sprite_manager->load("smalltux-stand-right"); @@ -165,56 +198,56 @@ img_water = new Surface(datadir + "/images/shared/water.png", false); img_waves[0] = new Surface(datadir + "/images/shared/waves-0.png", - true); + true); img_waves[1] = new Surface(datadir + "/images/shared/waves-1.png", - true); + true); img_waves[2] = new Surface(datadir + "/images/shared/waves-2.png", - true); + true); /* Pole: */ img_pole = new Surface(datadir + "/images/shared/pole.png", true); img_poletop = new Surface(datadir + "/images/shared/poletop.png", - true); + true); /* Flag: */ img_flag[0] = new Surface(datadir + "/images/shared/flag-0.png", - true); + true); img_flag[1] = new Surface(datadir + "/images/shared/flag-1.png", - true); + true); /* Cloud: */ img_cloud[0][0] = new Surface(datadir + "/images/shared/cloud-00.png", - true); + true); img_cloud[0][1] = new Surface(datadir + "/images/shared/cloud-01.png", - true); + true); img_cloud[0][2] = new Surface(datadir + "/images/shared/cloud-02.png", - true); + true); img_cloud[0][3] = new Surface(datadir + "/images/shared/cloud-03.png", - true); + true); img_cloud[1][0] = new Surface(datadir + "/images/shared/cloud-10.png", - true); + true); img_cloud[1][1] = new Surface(datadir + "/images/shared/cloud-11.png", - true); + true); img_cloud[1][2] = new Surface(datadir + "/images/shared/cloud-12.png", - true); + true); img_cloud[1][3] = new Surface(datadir + "/images/shared/cloud-13.png", - true); + true); /* Bad guys: */ @@ -230,22 +263,22 @@ door = sprite_manager->load("door"); for (int i = 0; i < DOOR_OPENING_FRAMES; i++) { - sprintf(img_name, "%s/images/shared/door-%i.png", datadir.c_str(), i+1); - door_opening[i] = new Surface(img_name, false); + sprintf(img_name, "%s/images/shared/door-%i.png", datadir.c_str(), i+1); + door_opening[i] = new Surface(img_name, false); } /* Distros: */ img_distro[0] = new Surface(datadir + "/images/tilesets/coin1.png", - true); + true); img_distro[1] = new Surface(datadir + "/images/tilesets/coin2.png", - true); + true); img_distro[2] = new Surface(datadir + "/images/tilesets/coin3.png", - true); + true); img_distro[3] = new Surface(datadir + "/images/tilesets/coin2.png", - true); + true); /* Tux life: */ @@ -263,17 +296,29 @@ Send a mail to me: neo...@us..., if you have another opinion. :) */ for (i = 0; i < NUM_SOUNDS; i++) - SoundManager::get()->add_sound(SoundManager::get()->load_sound(datadir + soundfilenames[i]),i); + SoundManager::get + ()->add_sound(SoundManager::get + ()->load_sound(datadir + soundfilenames[i]),i); /* Herring song */ - herring_song = SoundManager::get()->load_music(datadir + "/music/SALCON.MOD"); - level_end_song = SoundManager::get()->load_music(datadir + "/music/leveldone.mod"); + herring_song = SoundManager::get + ()->load_music(datadir + "/music/SALCON.MOD"); + level_end_song = SoundManager::get + ()->load_music(datadir + "/music/leveldone.mod"); } - /* Free shared data: */ void unloadshared(void) { + /* Free global images: */ + delete gold_text; + delete white_text; + delete blue_text; + delete gray_text; + delete white_small_text; + delete white_big_text; + delete yellow_nums; + int i; free_special_gfx(); |