src/supertux/resources.cpp

Go to the documentation of this file.
00001 //  SuperTux
00002 //  Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
00003 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
00004 //
00005 //  This program is free software: you can redistribute it and/or modify
00006 //  it under the terms of the GNU General Public License as published by
00007 //  the Free Software Foundation, either version 3 of the License, or
00008 //  (at your option) any later version.
00009 //
00010 //  This program is distributed in the hope that it will be useful,
00011 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //  GNU General Public License for more details.
00014 //
00015 //  You should have received a copy of the GNU General Public License
00016 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 
00018 #include "supertux/resources.hpp"
00019 
00020 #include "gui/mousecursor.hpp"
00021 #include "sprite/sprite_manager.hpp"
00022 #include "supertux/player_status.hpp"
00023 #include "supertux/tile_manager.hpp"
00024 #include "video/font.hpp"
00025 
00026 MouseCursor* Resources::mouse_cursor = NULL;
00027 
00028 FontPtr Resources::fixed_font;
00029 FontPtr Resources::normal_font;
00030 FontPtr Resources::small_font;
00031 FontPtr Resources::big_font;
00032 
00033 /* Load graphics/sounds shared between all levels: */
00034 void
00035 Resources::load_shared()
00036 {
00037   /* Load the mouse-cursor */
00038   mouse_cursor = new MouseCursor("images/engine/menu/mousecursor.png");
00039   MouseCursor::set_current(mouse_cursor);
00040 
00041   /* Load global images: */
00042   fixed_font.reset(new Font(Font::FIXED, "fonts/white.stf"));
00043   normal_font.reset(new Font(Font::VARIABLE, "fonts/white.stf"));
00044   small_font.reset(new Font(Font::VARIABLE, "fonts/white-small.stf", 1));
00045   big_font.reset(new Font(Font::VARIABLE, "fonts/white-big.stf", 3));
00046 
00047   tile_manager   = new TileManager();
00048   sprite_manager = new SpriteManager();
00049 }
00050 
00051 /* Free shared data: */
00052 void
00053 Resources::unload_shared()
00054 {
00055   /* Free global images: */
00056   fixed_font.reset();
00057   normal_font.reset();
00058   small_font.reset();
00059   big_font.reset();
00060 
00061   delete sprite_manager;
00062   sprite_manager = NULL;
00063 
00064   /* Free mouse-cursor */
00065   delete mouse_cursor;
00066 }
00067 
00068 /* EOF */

Generated on Mon Apr 14 03:38:26 2014 for SuperTux by  doxygen 1.5.1