#include <surface.hpp>
Public Member Functions | |
~Surface () | |
SurfacePtr | clone () const |
void | hflip () |
flip the surface horizontally | |
bool | get_flipx () const |
TexturePtr | get_texture () const |
SurfaceData * | get_surface_data () const |
int | get_x () const |
int | get_y () const |
int | get_width () const |
int | get_height () const |
Vector | get_position () const |
Vector | get_size () const |
returns a vector containing width and height | |
Static Public Member Functions | |
static SurfacePtr | create (const std::string &file) |
static SurfacePtr | create (const std::string &file, const Rect &rect) |
Private Member Functions | |
Surface (const std::string &file) | |
Surface (const std::string &file, const Rect &rect) | |
Surface (const Surface &) | |
Surface & | operator= (const Surface &) |
Private Attributes | |
TexturePtr | texture |
SurfaceData * | surface_data |
Rect | rect |
bool | flipx |
The class basically holds a reference to a texture with additional UV coordinates that specify a rectangular area on this texture
Definition at line 33 of file surface.hpp.
Surface::Surface | ( | const std::string & | file | ) | [private] |
Definition at line 38 of file surface.cpp.
References VideoSystem::new_surface_data(), and surface_data.
Referenced by clone(), and create().
00038 : 00039 texture(texture_manager->get(file)), 00040 surface_data(), 00041 rect(0, 0, 00042 Size(texture->get_image_width(), 00043 texture->get_image_height())), 00044 flipx(false) 00045 { 00046 surface_data = VideoSystem::new_surface_data(*this); 00047 }
Surface::Surface | ( | const std::string & | file, | |
const Rect & | rect | |||
) | [private] |
Definition at line 49 of file surface.cpp.
References VideoSystem::new_surface_data(), and surface_data.
00049 : 00050 texture(texture_manager->get(file, rect_)), 00051 surface_data(), 00052 rect(0, 0, Size(rect_.get_width(), rect_.get_height())), 00053 flipx(false) 00054 { 00055 surface_data = VideoSystem::new_surface_data(*this); 00056 }
Surface::Surface | ( | const Surface & | ) | [private] |
Definition at line 58 of file surface.cpp.
References VideoSystem::new_surface_data(), and surface_data.
00058 : 00059 texture(rhs.texture), 00060 surface_data(), 00061 rect(rhs.rect), 00062 flipx(false) 00063 { 00064 surface_data = VideoSystem::new_surface_data(*this); 00065 }
Surface::~Surface | ( | ) |
Definition at line 67 of file surface.cpp.
References VideoSystem::free_surface_data(), and surface_data.
00068 { 00069 VideoSystem::free_surface_data(surface_data); 00070 }
SurfacePtr Surface::create | ( | const std::string & | file | ) | [static] |
Definition at line 27 of file surface.cpp.
References Surface().
Referenced by Background::Background(), CloudParticleSystem::CloudParticleSystem(), CometParticleSystem::CometParticleSystem(), GameSession::GameSession(), GhostParticleSystem::GhostParticleSystem(), InfoBox::InfoBox(), InfoBoxLine::InfoBoxLine(), Console::init_graphics(), LevelTime::LevelTime(), Tile::load_images(), Font::loadFontSurface(), Menu::Menu(), MouseCursor::MouseCursor(), SpriteData::parse_action(), Player::Player(), PlayerStatus::PlayerStatus(), RainParticleSystem::RainParticleSystem(), Background::set_image(), SnowParticleSystem::SnowParticleSystem(), TextScroller::TextScroller(), TitleScreen::TitleScreen(), and Yeti::Yeti().
00028 { 00029 return SurfacePtr(new Surface(file)); 00030 }
SurfacePtr Surface::create | ( | const std::string & | file, | |
const Rect & | rect | |||
) | [static] |
Definition at line 33 of file surface.cpp.
References rect, and Surface().
00034 { 00035 return SurfacePtr(new Surface(file, rect)); 00036 }
SurfacePtr Surface::clone | ( | ) | const |
Definition at line 73 of file surface.cpp.
References Surface().
00074 { 00075 SurfacePtr surface(new Surface(*this)); 00076 return surface; 00077 }
void Surface::hflip | ( | ) |
bool Surface::get_flipx | ( | ) | const |
Definition at line 85 of file surface.cpp.
References flipx.
Referenced by SDLRenderer::draw_surface(), SDLLightmap::draw_surface(), GLSurfaceData::get_uv_left(), and GLSurfaceData::get_uv_right().
00086 { 00087 return flipx; 00088 }
TexturePtr Surface::get_texture | ( | ) | const |
Definition at line 91 of file surface.cpp.
References texture.
Referenced by SDLRenderer::draw_surface(), SDLLightmap::draw_surface(), GLRenderer::draw_surface(), GLLightmap::draw_surface(), and SDLSurfaceData::SDLSurfaceData().
00092 { 00093 return texture; 00094 }
SurfaceData * Surface::get_surface_data | ( | ) | const |
Definition at line 97 of file surface.cpp.
References surface_data.
Referenced by SDLRenderer::draw_surface(), SDLLightmap::draw_surface(), GLRenderer::draw_surface(), and GLLightmap::draw_surface().
00098 { 00099 return surface_data; 00100 }
int Surface::get_x | ( | ) | const |
Definition at line 103 of file surface.cpp.
References Rect::left, and rect.
Referenced by get_position(), and SDLSurfaceData::SDLSurfaceData().
int Surface::get_y | ( | ) | const |
Definition at line 109 of file surface.cpp.
References rect, and Rect::top.
Referenced by get_position(), and SDLSurfaceData::SDLSurfaceData().
int Surface::get_width | ( | ) | const |
Definition at line 115 of file surface.cpp.
References Rect::get_width(), and rect.
Referenced by GLRenderer::draw_surface(), GLLightmap::draw_surface(), get_size(), and SDLSurfaceData::SDLSurfaceData().
int Surface::get_height | ( | ) | const |
Definition at line 121 of file surface.cpp.
References Rect::get_height(), and rect.
Referenced by GLRenderer::draw_surface(), GLLightmap::draw_surface(), get_size(), and SDLSurfaceData::SDLSurfaceData().
00122 { 00123 return rect.get_height(); 00124 }
Vector Surface::get_position | ( | ) | const |
Vector Surface::get_size | ( | ) | const |
returns a vector containing width and height
Definition at line 133 of file surface.cpp.
References get_height(), and get_width().
00134 { 00135 return Vector(get_width(), get_height()); 00136 }
TexturePtr Surface::texture [private] |
SurfaceData* Surface::surface_data [private] |
Definition at line 41 of file surface.hpp.
Referenced by get_surface_data(), Surface(), and ~Surface().
Rect Surface::rect [private] |
Definition at line 42 of file surface.hpp.
Referenced by create(), get_height(), get_width(), get_x(), and get_y().
bool Surface::flipx [private] |