aboutsummaryrefslogtreecommitdiff
path: root/src/lua/graphics/Canvas.h
blob: 4494db4407466e2a20d9b2b0085e121105044973 (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
56
57
58
59
60
#ifndef __JIN_LUA_GRAPHICS_CANVAS_H
#define __JIN_LUA_GRAPHICS_CANVAS_H
#include "libjin/jin.h"
#include "../luaopen_types.h"

namespace jin
{
namespace lua
{
namespace graphics
{

    class Canvas : public Object
    {
    public:
        static Canvas* createCanvas(int w, int h);

        int getWidth()
        {
            return canvas->getWidth();
        }
        int getHeight()
        {
            return canvas->getHeight();
        }
        void setAnchor(int x, int y)
        {
            canvas->setAnchor(x, y);
        }
        inline const jin::graphics::Canvas* getRawCanvas() const
        {
            return canvas;
        }
        void bind()
        {
            canvas->bind();
        }

        void draw(int x, int y, float sx, float sy, float r)
        {
            canvas->draw(x, y, sx, sy, r);
        }

        static void unbind();

    private:
		Canvas() {}
        ~Canvas()
        {
            delete canvas;
        }
        jin::graphics::Canvas* canvas;

    };

} // graphics
} // lua
} // jin

#endif // __JIN_LUA_GRAPHICS_CANVAS_H