4e6f6e1f1f84be9b15d3f90ccae59f2635a328a1
[supertux.git] / src / resources.cpp
1 //  $Id$
2 //
3 //  SuperTux
4 //  Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
5 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
6 //
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.
11 //
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.
16 //
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.
20 #include <config.h>
21
22 #include "sprite/sprite_manager.hpp"
23 #include "resources.hpp"
24 #include "file_system.hpp"
25 #include "tile_manager.hpp"
26 #include "object/gameobjs.hpp"
27 #include "object/player.hpp"
28 #include "gui/mousecursor.hpp"
29 #include "player_status.hpp"
30
31 MouseCursor* mouse_cursor = NULL;
32
33 Font* fixed_font = NULL;
34 Font* normal_font = NULL;
35 Font* small_font = NULL;
36 Font* big_font = NULL;
37
38 /* Load graphics/sounds shared between all levels: */
39 void load_shared()
40 {
41   /* Load the mouse-cursor */
42   mouse_cursor = new MouseCursor("images/engine/menu/mousecursor.png");
43   MouseCursor::set_current(mouse_cursor);
44
45   /* Load global images: */
46   fixed_font = new Font(Font::FIXED, "fonts/white.stf");
47   normal_font = new Font(Font::VARIABLE, "fonts/white.stf");
48   small_font = new Font(Font::VARIABLE, "fonts/white-small.stf", 1);
49   big_font = new Font(Font::VARIABLE, "fonts/white-big.stf", 3);
50
51   tile_manager   = new TileManager();
52   sprite_manager = new SpriteManager();
53
54   player_status = new PlayerStatus();
55 }
56
57 /* Free shared data: */
58 void unload_shared()
59 {
60   /* Free global images: */
61   delete normal_font;
62   delete small_font;
63   delete big_font;
64
65   delete sprite_manager;
66   sprite_manager = NULL;
67
68   /* Free mouse-cursor */
69   delete mouse_cursor;
70
71   delete player_status;
72   player_status = NULL;
73 }