00001 // SuperTux 00002 // Copyright (C) 2006 Matthias Braun <matze@braunis.de> 00003 // 00004 // This program is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 00017 #ifndef HEADER_SUPERTUX_VIDEO_SURFACE_HPP 00018 #define HEADER_SUPERTUX_VIDEO_SURFACE_HPP 00019 00020 #include <string> 00021 #include <memory> 00022 00023 #include "math/vector.hpp" 00024 #include "math/rect.hpp" 00025 #include "video/surface_ptr.hpp" 00026 #include "video/texture_ptr.hpp" 00027 00028 class SurfaceData; 00029 00033 class Surface 00034 { 00035 public: 00036 static SurfacePtr create(const std::string& file); 00037 static SurfacePtr create(const std::string& file, const Rect& rect); 00038 00039 private: 00040 TexturePtr texture; 00041 SurfaceData* surface_data; 00042 Rect rect; 00043 bool flipx; 00044 00045 private: 00046 Surface(const std::string& file); 00047 Surface(const std::string& file, const Rect& rect); 00048 Surface(const Surface&); 00049 00050 public: 00051 ~Surface(); 00052 00053 SurfacePtr clone() const; 00054 00056 void hflip(); 00057 bool get_flipx() const; 00058 00059 TexturePtr get_texture() const; 00060 SurfaceData* get_surface_data() const; 00061 int get_x() const; 00062 int get_y() const; 00063 int get_width() const; 00064 int get_height() const; 00065 Vector get_position() const; 00066 00068 Vector get_size() const; 00069 00070 private: 00071 Surface& operator=(const Surface&); 00072 }; 00073 00074 #endif 00075 00076 /* EOF */