summaryrefslogtreecommitdiffstats
path: root/engine/include/flatsurface.h
blob: 3b6473498dd5fc79512506e112b5c7eacd3a6549 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef __FLATSURFACE_H__
#define __FLATSURFACE_H__

#include "object.hpp"
#include <SDL2/SDL.h>

class FlatSurface : public flat::core::object
{
    SDL_Surface * surface;
    SDL_Surface * parent;

    SDL_Rect * offset;
    SDL_Rect * viewport;

    bool hide;

public:

    FlatSurface(const char *filename, uint32_t format = SDL_PIXELFORMAT_RGBA32, SDL_Surface *parent = 0);
    FlatSurface(SDL_Surface *surface, SDL_Surface *parent = 0);

    FlatSurface(const FlatSurface&);

    ~FlatSurface();

    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