X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fvideo%2Ftexture_manager.cpp;h=218de7dbbf29e00643c608377e2f94fffa91831a;hb=08813a74da6ac1fd045a105e4e8105f1d7f716f0;hp=70b0e950c1522e60cba59f6eddf602e28a383253;hpb=f406067af6cbeb0a638078fe1d386d092583909c;p=supertux.git diff --git a/src/video/texture_manager.cpp b/src/video/texture_manager.cpp index 70b0e950c..218de7dbb 100644 --- a/src/video/texture_manager.cpp +++ b/src/video/texture_manager.cpp @@ -1,12 +1,10 @@ -// $Id$ -// // SuperTux // Copyright (C) 2006 Matthias Braun // -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,27 +12,18 @@ // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#include +// along with this program. If not, see . -#include "texture_manager.hpp" +#include "video/texture_manager.hpp" -#include -#include #include #include -#include -#include + #include "physfs/physfs_sdl.hpp" -#include "video_systems.hpp" -#include "gl_texture.hpp" -#include "glutil.hpp" -#include "gameconfig.hpp" -#include "file_system.hpp" -#include "log.hpp" -#include "texture.hpp" +#include "util/file_system.hpp" +#include "util/log.hpp" +#include "video/gl/gl_texture.hpp" +#include "video/video_systems.hpp" TextureManager* texture_manager = NULL; @@ -80,13 +69,13 @@ TextureManager::release(Texture* texture) #ifdef HAVE_OPENGL void -TextureManager::register_texture(GL::Texture* texture) +TextureManager::register_texture(GLTexture* texture) { textures.insert(texture); } void -TextureManager::remove_texture(GL::Texture* texture) +TextureManager::remove_texture(GLTexture* texture) { textures.erase(texture); } @@ -133,28 +122,28 @@ TextureManager::create_image_texture(const std::string& filename) // on error (when loading placeholder), try using empty surface try { - SDL_Surface* image = SDL_CreateRGBSurface(0, 1024, 1024, 8, 0, 0, 0, 0); - if(image == 0) { - throw err; - } - - Texture* result = 0; - try { - result = new_texture(image); - result->set_filename("-dummy-texture-.png"); - } catch(...) { - delete result; - SDL_FreeSurface(image); - throw err; - } - - SDL_FreeSurface(image); + SDL_Surface* image = SDL_CreateRGBSurface(0, 1024, 1024, 8, 0, 0, 0, 0); + if(image == 0) { + throw err; + } + + Texture* result = 0; + try { + result = new_texture(image); + result->set_filename("-dummy-texture-.png"); + } catch(...) { + delete result; + SDL_FreeSurface(image); + throw err; + } + + SDL_FreeSurface(image); log_warning << "Couldn't load texture '" << filename << "' (now using empty one): " << err.what() << std::endl; - return result; + return result; - // on error (when trying to use empty surface), give up + // on error (when trying to use empty surface), give up } catch (const std::runtime_error& err) { - throw err; + throw err; } } } @@ -179,12 +168,12 @@ TextureManager::save_textures() } for(ImageTextures::iterator i = image_textures.begin(); i != image_textures.end(); ++i) { - save_texture(dynamic_cast(i->second)); + save_texture(dynamic_cast(i->second)); } } void -TextureManager::save_texture(GL::Texture* texture) +TextureManager::save_texture(GLTexture* texture) { SavedTexture saved_texture; saved_texture.texture = texture; @@ -267,3 +256,5 @@ TextureManager::reload_textures() saved_textures.clear(); } #endif + +/* EOF */