diff options
author | chai <chaifix@163.com> | 2018-10-19 08:36:44 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-10-19 08:36:44 +0800 |
commit | 7d5f055547e70fa93ee9ac944e62f8d657b9dc55 (patch) | |
tree | 081782a1541854db4b8eb69c4b43081f52711286 /src/libjin/Graphics/je_drawable.h | |
parent | 02dd1f38008594048f0e28bad01e7c6d18844198 (diff) |
*修改文件名
Diffstat (limited to 'src/libjin/Graphics/je_drawable.h')
-rw-r--r-- | src/libjin/Graphics/je_drawable.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/src/libjin/Graphics/je_drawable.h b/src/libjin/Graphics/je_drawable.h new file mode 100644 index 0000000..13464f0 --- /dev/null +++ b/src/libjin/Graphics/je_drawable.h @@ -0,0 +1,90 @@ +#ifndef __LIBJIN_DRAWABLE +#define __LIBJIN_DRAWABLE +#include "../core/je_configuration.h" +#if LIBJIN_MODULES_RENDER + +#include "../math/je_quad.h" +#include "../math/je_vector2.hpp" + +#include "je_gl.h" +#include "je_bitmap.h" + +namespace jin +{ + namespace graphics + { + /// + /// + /// + class Drawable + { + public: + /// + /// + /// + Drawable(int w = 0, int h = 0); + + /// + /// + /// + Drawable(const Bitmap* bitmap); + + /// + /// + /// + virtual ~Drawable(); + + /// + /// + /// + void setAnchor(int x, int y); + + /// + /// + /// + void draw(int x, int y, float sx = 1, float sy = 1, float r = 0); + + /// + /// + /// + void draw(const math::Quad& slice, int x, int y, float sx = 1, float sy = 1, float r = 0, float ax = 0, float ay = 0); + + /// + /// + /// + inline int getWidth() const { return size.w; } + + /// + /// + /// + inline int getHeight() const { return size.h; } + + /// + /// + /// + inline GLuint getTexture() const { return texture; } + + /// + /// + /// + void setFilter(GLint min, GLint max); + + protected: + static const int DRAWABLE_V_SIZE = 8; + + GLuint texture; + GLuint vbo; + /* TODO: vertex buffer object */ + /* GLuint vbo; */ + jin::math::Vector2<unsigned int> size; + jin::math::Vector2<int> anchor; + float vertex_coords[DRAWABLE_V_SIZE]; + float texture_coords[DRAWABLE_V_SIZE]; + + }; + + } // namespace render +} // namespace jin + +#endif // LIBJIN_MODULES_RENDER +#endif // __LIBJIN_DRAWABLE
\ No newline at end of file |