aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/je_graphic.h
blob: fdc328dadc02effa5bf67f3b33e231df28b24987 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#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
    {

		/// 
		/// 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);

            /// 
            /// 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);

        protected:
            JinEngine::Math::Vector2<uint> mSize;

        private:
            GLuint mTexture;

        };
    
    } // namespace Graphics
} // namespace JinEngine

#endif // defined(jin_graphics)

#endif // __JE_GRAPHIC_H__