| 1 | // SuperTux |
| 2 | // Copyright (C) 2006 Matthias Braun <matze@braunis.de> |
| 3 | // |
| 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. |
| 8 | // |
| 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. |
| 13 | // |
| 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/>. |
| 16 | |
| 17 | #ifndef HEADER_SUPERTUX_VIDEO_SDL_SDL_TEXTURE_HPP |
| 18 | #define |
| 19 | |
| 20 | #include "video/texture.hpp" |
| 21 | |
| 22 | #include <SDL.h> |
| 23 | |
| 24 | #include "video/sampler.hpp" |
| 25 | |
| 26 | struct SDL_Texture; |
| 27 | |
| 28 | class SDLTexture final : public Texture |
| 29 | { |
| 30 | public: |
| 31 | SDLTexture(SDL_Texture* texture, int width, int height, const Sampler& sampler); |
| 32 | SDLTexture(const SDL_Surface& sdl_surface, const Sampler& sampler); |
| 33 | virtual ~SDLTexture(); |
| 34 | |
| 35 | virtual int get_texture_width() const override { return m_width; } |
| 36 | virtual int get_texture_height() const override { return m_height; } |
| 37 | |
| 38 | virtual int get_image_width() const override { return m_width; } |
| 39 | virtual int get_image_height() const override { return m_height; } |
| 40 | |
| 41 | SDL_Texture *get_texture() const { return m_texture; } |
| 42 | const Sampler& get_sampler() const { return m_sampler; } |
| 43 | |
| 44 | private: |
| 45 | SDL_Texture* m_texture; |
| 46 | int m_width; |
| 47 | int m_height; |
| 48 | Sampler m_sampler; |
| 49 | |
| 50 | private: |
| 51 | SDLTexture(const SDLTexture&) = delete; |
| 52 | SDLTexture& operator=(const SDLTexture&) = delete; |
| 53 | }; |
| 54 | |
| 55 | #endif |
| 56 | |
| 57 | /* EOF */ |
| 58 | |