diff options
author | Nao Pross <naopross@thearcway.org> | 2019-01-25 01:11:57 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2019-01-25 01:11:57 +0100 |
commit | bcd14a356cafe58808b4c2a14782ebb194c6abc5 (patch) | |
tree | 3bc95288b0a0172bb447ccf218fb59821f22501a /engine/include/surface.hpp | |
parent | Delete bin and test/makefile update .gitignore (diff) | |
download | flatland-bcd14a356cafe58808b4c2a14782ebb194c6abc5.tar.gz flatland-bcd14a356cafe58808b4c2a14782ebb194c6abc5.zip |
Rename everything under engine/ to remove `flat' and be `.hpp'
Diffstat (limited to 'engine/include/surface.hpp')
-rw-r--r-- | engine/include/surface.hpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/engine/include/surface.hpp b/engine/include/surface.hpp new file mode 100644 index 0000000..5364e8e --- /dev/null +++ b/engine/include/surface.hpp @@ -0,0 +1,60 @@ +#ifndef __FLATSURFACE_H__ +#define __FLATSURFACE_H__ + +#include "core/object.hpp" +#include "core/labelled.hpp" +#include <SDL2/SDL.h> + +namespace flat { + +class surface : virtual public core::object, virtual public core::labelled +{ + SDL_Surface * sdl_surface; + SDL_Surface * parent; + + SDL_Rect * offset; + SDL_Rect * viewport; + + bool hide; + +public: + + surface(const char *filename, uint32_t format = SDL_PIXELFORMAT_RGBA32, SDL_Surface *parent = 0); + surface(SDL_Surface *surf, SDL_Surface *parent = 0); + + surface(const surface&); + + ~surface(); + + void setOffset(int, int, int w = -1, int h = -1); + + void setOffset(const SDL_Rect&); + + void setViewport(int x = 0, int y = 0, int w = -1, int h = -1); + + void setViewport(const SDL_Rect&); + + const SDL_Rect * getOffset() const; + + const SDL_Rect * getViewport() const; + + void setParent(SDL_Surface *parent); + + SDL_Surface * getParent(); + + SDL_Surface * getSurface(); + + void setHidden(bool); + + bool isHidden() const; + + void blit(); + + static SDL_Surface * loadOptimizedSurface(const char* filename, uint32_t format); + + static SDL_Surface * copySurface(SDL_Surface*); +}; + +} + +#endif |