aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/je_graphic.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Graphics/je_graphic.h')
-rw-r--r--src/libjin/Graphics/je_graphic.h91
1 files changed, 91 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..fb6b19e
--- /dev/null
+++ b/src/libjin/Graphics/je_graphic.h
@@ -0,0 +1,91 @@
+#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 "je_gl.h"
+#include "je_bitmap.h"
+
+namespace JinEngine
+{
+ namespace Graphics
+ {
+
+ //
+ // Graphic
+ // |-Texture
+ // |-Canvas
+ //
+
+ ///
+ /// 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();
+
+ ///
+ ///
+ ///
+ 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);
+
+ ///
+ ///
+ ///
+ inline int getWidth() const { return mSize.w; }
+
+ ///
+ ///
+ ///
+ inline int getHeight() const { return mSize.h; }
+
+ ///
+ ///
+ ///
+ inline GLuint getTexture() const { return mTexture; }
+
+ ///
+ ///
+ ///
+ void setFilter(GLint min, GLint max);
+
+ protected:
+ GLuint mTexture;
+
+ private:
+ JinEngine::Math::Vector2<uint> mSize;
+ // Screen coordinates and uv coordinates.
+ float mVertexCoords[8];
+ float mTextureCoords[8];
+
+ };
+
+ } // namespace Graphics
+} // namespace JinEngine
+
+#endif // defined(jin_graphics)
+
+#endif // __JE_GRAPHIC_H \ No newline at end of file