aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/render/drawable.h
blob: baf6c97b4b859aea74fb2c774436a67435842890 (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
#ifndef __JIN_DRAWABLE
#define __JIN_DRAWABLE
#include "3rdparty/GLee/GLee.h"
namespace jin 
{
namespace render
{
    class Drawable
    {
    public:
       
        Drawable();
        virtual ~Drawable();
        
        void init(int w = 0, int h = 0);
        
        void setAnchor(int x, int y); 
        
        void draw(int x, int y, float sx, float sy, float r);

		inline int Drawable::getWidth() const
		{
			return width;
		}

		inline int Drawable::getHeight() const 
		{
			return height;
		}

        inline GLuint getTexture() const 
		{ 
			return texture; 
		};

    protected:
#define DRAWABLE_V_SIZE 8
        void setVertices(float* v, float* t);
        
        GLuint texture; 
        
        int width, height;
        
        /* anchor point */ 
        int ancx, ancy;
        
        // render coords
        float* textCoord;
        float* vertCoord;

    };
}
}// jin

#endif