diff options
Diffstat (limited to 'src/lua/graphics/Canvas.h')
-rw-r--r-- | src/lua/graphics/Canvas.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/lua/graphics/Canvas.h b/src/lua/graphics/Canvas.h new file mode 100644 index 0000000..d80ff79 --- /dev/null +++ b/src/lua/graphics/Canvas.h @@ -0,0 +1,59 @@ +#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() + { + delete canvas; + } + jin::graphics::Canvas* canvas; + + }; + +} // graphics +} // lua +} // jin + +#endif
\ No newline at end of file |