2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef HEADER_SUPERTUX_VIDEO_TEXTURE_HPP
18 #define HEADER_SUPERTUX_VIDEO_TEXTURE_HPP
25 #include "supertux/globals.hpp"
26 #include "video/texture_manager.hpp"
28 /// bitset for drawing effects
30 /** Don't apply anything */
32 /** Draw the Surface upside down */
33 VERTICAL_FLIP = (1<<1),
34 /** Draw the Surface from left to down */
35 HORIZONTAL_FLIP = (1<<2),
39 typedef unsigned int DrawingEffect;
42 * This class is a wrapper around a texture handle. It stores the texture width
43 * and height and provides convenience functions for uploading SDL_Surfaces
49 friend class TextureManager;
50 /* The name under which this texture is cached by the texture manager,
51 * or the empty string if not. */
52 std::string cache_filename;
55 Texture() : cache_filename() {}
58 if (texture_manager && cache_filename != "")
59 /* The cache entry is now useless: its weak pointer to us has been
60 * cleared. Remove the entry altogether to save memory. */
61 texture_manager->reap_cache_entry(cache_filename);
64 virtual unsigned int get_texture_width() const = 0;
65 virtual unsigned int get_texture_height() const = 0;
66 virtual unsigned int get_image_width() const = 0;
67 virtual unsigned int get_image_height() const = 0;
70 Texture(const Texture&);
71 Texture& operator=(const Texture&);