diff options
author | chai <chaifix@163.com> | 2018-11-18 23:31:17 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-11-18 23:31:17 +0800 |
commit | f0f340dec7821cee103ab9267ef941a917ef4dc4 (patch) | |
tree | 2f77f6ce6bdc9f63f002c13d4c261e1d6a9c1729 /src/libjin/graphics/je_graphic.h | |
parent | fc7b4579e49aaeecc81919e247e03f68bd5abfd4 (diff) |
*目录改为小写
Diffstat (limited to 'src/libjin/graphics/je_graphic.h')
-rw-r--r-- | src/libjin/graphics/je_graphic.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/libjin/graphics/je_graphic.h b/src/libjin/graphics/je_graphic.h new file mode 100644 index 0000000..51c8e3d --- /dev/null +++ b/src/libjin/graphics/je_graphic.h @@ -0,0 +1,94 @@ +#ifndef __JE_GRAPHIC_H__ +#define __JE_GRAPHIC_H__ +#include "../core/je_configuration.h" +#if defined(jin_graphics) + +#include "../math/je_quad.h" +#include "../math/je_vector2.hpp" +#include "../math/je_transform.h" + +#include "je_gl.h" +#include "je_bitmap.h" + +namespace JinEngine +{ + namespace Graphics + { + + /// + /// Class inherites Graphic doesn't keep any state such as origin, scale and other properties. + /// + class Graphic + { + public: + /// + /// + /// + Graphic(int w = 0, int h = 0); + + /// + /// + /// + Graphic(const Bitmap* bitmap); + + /// + /// + /// + virtual ~Graphic(); + + /// + /// + /// + inline int getWidth() const { return mSize.w; } + + /// + /// + /// + inline int getHeight() const { return mSize.h; } + + /// + /// Get opengl texture token. + /// + /// @return OpenGL texture token. + /// + inline GLuint getGLTexture() const { return mTexture; } + + /// + /// + /// + void setFilter(GLint min, GLint max); + + /// + /// Render graphic single with given coordinates. + /// + void render(int x, int y, float sx = 1, float sy = 1, float r = 0, float ox = 0, float oy = 0) const; + + /// + /// Render part of graphic single with given coordinates. + /// + void render(const Math::Quad& slice, int x, int y, float sx = 1, float sy = 1, float r = 0, float ox = 0, float oy = 0) const; + + /// + /// Render with transform. + /// + void render(const Math::Transform& transform) const; + + /// + /// + /// + void render(const Math::Quad& slice, const Math::Transform& transform) const; + + protected: + Math::Vector2<uint> mSize; + + private: + GLuint mTexture; + + }; + + } // namespace Graphics +} // namespace JinEngine + +#endif // defined(jin_graphics) + +#endif // __JE_GRAPHIC_H__
\ No newline at end of file |