4 // Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
5 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include "sprite/sprite_manager.hpp"
23 #include "gui/menu.hpp"
24 #include "gui/button.hpp"
25 #include "resources.hpp"
26 #include "file_system.hpp"
27 #include "tile_manager.hpp"
28 #include "object/gameobjs.hpp"
29 #include "object/player.hpp"
31 MouseCursor* mouse_cursor = NULL;
33 Font* gold_text = NULL;
34 Font* blue_text = NULL;
35 Font* gray_text = NULL;
36 Font* white_text = NULL;
37 Font* white_small_text = NULL;
38 Font* white_big_text = NULL;
40 /* Load graphics/sounds shared between all levels: */
43 /* Load the mouse-cursor */
44 mouse_cursor = new MouseCursor("images/engine/menu/mousecursor.png");
45 MouseCursor::set_current(mouse_cursor);
47 /* Load global images: */
48 gold_text = new Font(Font::FIXED,
49 "images/engine/fonts/gold.png",
50 "images/engine/fonts/shadow.png", 16, 18);
51 blue_text = new Font(Font::FIXED,
52 "images/engine/fonts/blue.png",
53 "images/engine/fonts/shadow.png", 16, 18, 3);
54 // white_text = new Font("images/engine/fonts/white.png",
55 // "images/engine/fonts/shadow.png", 16, 18);
56 white_text = new Font(Font::VARIABLE,
57 "images/engine/fonts/white.png", 16, 18);
58 gray_text = new Font(Font::FIXED,
59 "images/engine/fonts/gray.png",
60 "images/engine/fonts/shadow.png", 16, 18);
61 white_small_text = new Font(Font::VARIABLE,
62 "images/engine/fonts/white-small.png",
64 // "images/engine/fonts/shadow-small.png", 8, 9, 1);
65 white_big_text = new Font(Font::FIXED,
66 "images/engine/fonts/white-big.png",
67 "images/engine/fonts/shadow-big.png", 20, 22, 3);
69 Menu::default_font = white_text;
70 Menu::active_font = blue_text;
71 Menu::deactive_font = gray_text;
72 Menu::label_font = white_big_text;
73 Menu::field_font = gold_text;
75 Button::info_font = white_small_text;
77 sprite_manager = new SpriteManager();
78 tile_manager = new TileManager("images/tiles.strf");
82 for (int i = 0; i < GROWING_FRAMES; i++)
84 snprintf(img_name, sizeof(img_name), "images/creatures/tux_grow/left-%i.png", i+1);
85 growingtux_left[i] = new Surface(img_name);
87 snprintf(img_name, sizeof(img_name), "images/creatures/tux_grow/right-%i.png", i+1);
88 growingtux_right[i] = new Surface(img_name);
91 small_tux = new TuxBodyParts();
93 small_tux->body = sprite_manager->create("images/creatures/tux_small/small-tux-body.sprite");
94 small_tux->arms = sprite_manager->create("images/creatures/tux_small/small-tux-arms.sprite");
97 big_tux = new TuxBodyParts();
98 big_tux->head = sprite_manager->create("images/creatures/tux_big/big-tux-head.sprite");
99 big_tux->body = sprite_manager->create("images/creatures/tux_big/big-tux-body.sprite");
100 big_tux->arms = sprite_manager->create("images/creatures/tux_big/big-tux-arms.sprite");
101 big_tux->feet = sprite_manager->create("images/creatures/tux_big/big-tux-feet.sprite");
103 fire_tux = new TuxBodyParts();
104 fire_tux->head = sprite_manager->create("images/creatures/tux_big/big-fire-tux-head.sprite");
105 fire_tux->body = sprite_manager->create("images/creatures/tux_big/big-tux-body.sprite");
106 fire_tux->arms = sprite_manager->create("images/creatures/tux_big/big-tux-arms.sprite");
107 fire_tux->feet = sprite_manager->create("images/creatures/tux_big/big-tux-feet.sprite");
109 ice_tux = new TuxBodyParts();
110 ice_tux->head = sprite_manager->create("images/creatures/tux_big/big-ice-tux-head.sprite");
111 ice_tux->body = sprite_manager->create("images/creatures/tux_big/big-tux-body.sprite");
112 ice_tux->arms = sprite_manager->create("images/creatures/tux_big/big-tux-arms.sprite");
113 ice_tux->feet = sprite_manager->create("images/creatures/tux_big/big-tux-feet.sprite");
115 player_status = new PlayerStatus();
118 /* Free shared data: */
121 /* Free global images: */
126 delete white_small_text;
127 delete white_big_text;
134 for (int i = 0; i < GROWING_FRAMES; i++) {
135 delete growingtux_left[i];
136 delete growingtux_right[i];
139 delete sprite_manager;
140 sprite_manager = NULL;
144 /* Free mouse-cursor */