Update CMake to 3.2.1 in .travis.yml
[supertux.git] / src / supertux / resources.cpp
1 //  SuperTux
2 //  Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
3 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
4 //
5 //  This program is free software: you can redistribute it and/or modify
6 //  it under the terms of the GNU General Public License as published by
7 //  the Free Software Foundation, either version 3 of the License, or
8 //  (at your option) any later version.
9 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 #include "supertux/resources.hpp"
19
20 #include "gui/mousecursor.hpp"
21 #include "sprite/sprite_manager.hpp"
22 #include "supertux/player_status.hpp"
23 #include "video/font.hpp"
24
25 MouseCursor* Resources::mouse_cursor = NULL;
26
27 FontPtr Resources::fixed_font;
28 FontPtr Resources::normal_font;
29 FontPtr Resources::small_font;
30 FontPtr Resources::big_font;
31
32 SurfacePtr Resources::checkbox;
33 SurfacePtr Resources::checkbox_checked;
34 SurfacePtr Resources::back;
35 SurfacePtr Resources::arrow_left;
36 SurfacePtr Resources::arrow_right;
37
38 Resources::Resources()
39 {
40   // Load the mouse-cursor
41   mouse_cursor = new MouseCursor("images/engine/menu/mousecursor.png",
42                                  "images/engine/menu/mousecursor-click.png",
43                                  "images/engine/menu/mousecursor-link.png");
44   MouseCursor::set_current(mouse_cursor);
45
46   // Load global images:
47   fixed_font.reset(new Font(Font::FIXED, "fonts/white.stf"));
48   normal_font.reset(new Font(Font::VARIABLE, "fonts/white.stf"));
49   small_font.reset(new Font(Font::VARIABLE, "fonts/white-small.stf", 1));
50   big_font.reset(new Font(Font::VARIABLE, "fonts/white-big.stf", 3));
51
52   /* Load menu images */
53   checkbox = Surface::create("images/engine/menu/checkbox-unchecked.png");
54   checkbox_checked = Surface::create("images/engine/menu/checkbox-checked.png");
55   back = Surface::create("images/engine/menu/arrow-back.png");
56   arrow_left = Surface::create("images/engine/menu/arrow-left.png");
57   arrow_right = Surface::create("images/engine/menu/arrow-right.png");
58 }
59
60 Resources::~Resources()
61 {
62   // Free menu images
63   checkbox.reset();
64   checkbox_checked.reset();
65   back.reset();
66   arrow_left.reset();
67   arrow_right.reset();
68
69   // Free global images:
70   fixed_font.reset();
71   normal_font.reset();
72   small_font.reset();
73   big_font.reset();
74
75   /* Free mouse-cursor */
76   if(mouse_cursor != NULL)
77   {
78     delete mouse_cursor;
79   }
80 }
81
82 /* EOF */