aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/je_drawable.h
blob: 28fd28b5700522884543b33c4c5d10381e8198d6 (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
84
85
86
87
88
89
90
#ifndef __JE_DRAWABLE
#define __JE_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 JinEngine 
{
    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; */
            JinEngine::Math::Vector2<unsigned int> size;
            JinEngine::Math::Vector2<int> anchor;
            float vertex_coords[DRAWABLE_V_SIZE];
            float texture_coords[DRAWABLE_V_SIZE];
        
        };
    
    } // namespace render
} // namespace JinEngine

#endif // LIBJIN_MODULES_RENDER
#endif // __JE_DRAWABLE