From 589ee7ee7014a5f8918e1d99c0e04bff4f7a83cb Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 28 Jul 2018 10:39:31 +0800 Subject: *update --- src/libjin/Graphics/Drawable.h | 58 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/libjin/Graphics/Drawable.h (limited to 'src/libjin/Graphics/Drawable.h') diff --git a/src/libjin/Graphics/Drawable.h b/src/libjin/Graphics/Drawable.h new file mode 100644 index 0000000..c05d8a4 --- /dev/null +++ b/src/libjin/Graphics/Drawable.h @@ -0,0 +1,58 @@ +#ifndef __JIN_DRAWABLE +#define __JIN_DRAWABLE +#include "../modules.h" +#if JIN_MODULES_RENDER + +#include "../3rdparty/GLee/GLee.h" +namespace jin +{ +namespace graphics +{ + class Drawable + { + public: + Drawable(int w = 0, int h = 0); + virtual ~Drawable(); + + void setAnchor(int x, int y); + + void draw(int x, int y, float sx, float sy, float r); + + inline int Drawable::getWidth() const + { + return width; + } + + inline int Drawable::getHeight() const + { + return height; + } + + inline GLuint getTexture() const + { + return texture; + }; + + protected: + + const int DRAWABLE_V_SIZE = 8; + + void setVertices(float* v, float* t); + + GLuint texture; + + int width, height; + + /* anchor point */ + int ancx, ancy; + + // render coords + float* textCoord; + float* vertCoord; + + }; +} // render +} // jin + +#endif // JIN_MODULES_RENDER +#endif // __JIN_DRAWABLE \ No newline at end of file -- cgit v1.1-26-g67d0