From 831e814ce9bdb84e86c06c4a52008f6bdaaa00d6 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 16 Nov 2018 00:24:51 +0800 Subject: =?UTF-8?q?*=E5=90=88=E5=B9=B6master=E5=88=B0minimal=E5=88=86?= =?UTF-8?q?=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/Graphics/je_graphic.h | 52 +++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 30 deletions(-) (limited to 'src/libjin/Graphics/je_graphic.h') diff --git a/src/libjin/Graphics/je_graphic.h b/src/libjin/Graphics/je_graphic.h index fb6b19e..91c8b44 100644 --- a/src/libjin/Graphics/je_graphic.h +++ b/src/libjin/Graphics/je_graphic.h @@ -1,5 +1,5 @@ -#ifndef __JE_GRAPHIC_H -#define __JE_GRAPHIC_H +#ifndef __JE_GRAPHIC_H__ +#define __JE_GRAPHIC_H__ #include "../core/je_configuration.h" #if defined(jin_graphics) @@ -14,21 +14,14 @@ namespace JinEngine namespace Graphics { - // - // Graphic - // |-Texture - // |-Canvas - // - /// - /// Class inherites Graphic doesn't keep any state such as origin, scale and other - /// properties. + /// 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); @@ -42,16 +35,6 @@ namespace JinEngine /// virtual ~Graphic(); - /// - /// - /// - void draw(int x, int y, float sx = 1, float sy = 1, float r = 0, float ox = 0, float oy = 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); - /// /// /// @@ -63,24 +46,33 @@ namespace JinEngine inline int getHeight() const { return mSize.h; } /// - /// + /// Get opengl texture token. + /// + /// @return OpenGL texture token. /// - inline GLuint getTexture() const { return mTexture; } + 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; + protected: - GLuint mTexture; + Math::Vector2 mSize; private: - JinEngine::Math::Vector2 mSize; - // Screen coordinates and uv coordinates. - float mVertexCoords[8]; - float mTextureCoords[8]; - + GLuint mTexture; + }; } // namespace Graphics @@ -88,4 +80,4 @@ namespace JinEngine #endif // defined(jin_graphics) -#endif // __JE_GRAPHIC_H \ No newline at end of file +#endif // __JE_GRAPHIC_H__ \ No newline at end of file -- cgit v1.1-26-g67d0