a7d20b878f58510d19f48b6c261e8e2b7541f7f2
[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 "resources.hpp"
23
24 #include "gui/mousecursor.hpp"
25 #include "sprite/sprite_manager.hpp"
26 #include "tile_manager.hpp"
27 #include "player_status.hpp"
28 #include "video/font.hpp"
29
30 MouseCursor* mouse_cursor = NULL;
31
32 Font* fixed_font = NULL;
33 Font* normal_font = NULL;
34 Font* small_font = NULL;
35 Font* big_font = NULL;
36
37 /* Load graphics/sounds shared between all levels: */
38 void load_shared()
39 {
40   /* Load the mouse-cursor */
41   mouse_cursor = new MouseCursor("images/engine/menu/mousecursor.png");
42   MouseCursor::set_current(mouse_cursor);
43
44   /* Load global images: */
45   fixed_font = new Font(Font::FIXED, "fonts/white.stf");
46   normal_font = new Font(Font::VARIABLE, "fonts/white.stf");
47   small_font = new Font(Font::VARIABLE, "fonts/white-small.stf", 1);
48   big_font = new Font(Font::VARIABLE, "fonts/white-big.stf", 3);
49
50   tile_manager   = new TileManager();
51   sprite_manager = new SpriteManager();
52
53   player_status = new PlayerStatus();
54 }
55
56 /* Free shared data: */
57 void unload_shared()
58 {
59   /* Free global images: */
60   delete normal_font;
61   delete small_font;
62   delete big_font;
63
64   delete sprite_manager;
65   sprite_manager = NULL;
66
67   /* Free mouse-cursor */
68   delete mouse_cursor;
69
70   delete player_status;
71   player_status = NULL;
72 }