X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fvideo%2Ftexture.hpp;h=bf87c65df0a36d81c5d5045f24c39157df8f6f15;hb=394afb555fd97f21a5d7bb473c749535e01df085;hp=8322e3c7a13051cfe6c52dbba7e1697b32e8748c;hpb=efc61e9d05b077f13a76982590fb0bd6a9d8dc61;p=supertux.git diff --git a/src/video/texture.hpp b/src/video/texture.hpp index 8322e3c7a..bf87c65df 100644 --- a/src/video/texture.hpp +++ b/src/video/texture.hpp @@ -1,7 +1,7 @@ // $Id$ // -// SuperTux - A Jump'n Run -// Copyright (C) 2004 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -16,6 +16,7 @@ // 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. + #ifndef __TEXTURE_HPP__ #define __TEXTURE_HPP__ @@ -23,25 +24,40 @@ #include /** - * This class is a very simple wrapper around a texture handle + * This class is a wrapper around a texture handle. It stores the texture width + * and height and provides convenience functions for uploading SDL_Surfaces + * into the texture */ class Texture { -public: +protected: + friend class TextureManager; GLuint handle; unsigned int width; unsigned int height; - + +public: Texture(unsigned int width, unsigned int height, GLenum glformat); Texture(SDL_Surface* surface, GLenum glformat); - ~Texture(); + virtual ~Texture(); + + GLuint get_handle() const + { + return handle; + } + + unsigned int get_width() const + { + return width; + } + + unsigned int get_height() const + { + return height; + } - void upload_texture(SDL_Surface* image, int src_x, int src_y, int dst_x, int dst_y, - int width, int height); private: void set_texture_params(); }; - #endif -