aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/Drawable.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-09-02 10:08:58 +0800
committerchai <chaifix@163.com>2018-09-02 10:08:58 +0800
commit3bb587f0d7c471a70683fa7d26939d21968dea98 (patch)
tree6ef9e75b5159dda0a8d1dc4ef8640be4eacc6343 /src/libjin/Graphics/Drawable.cpp
parent862763a88f6b4a6cb6c034287c509a91776adf8b (diff)
*update
Diffstat (limited to 'src/libjin/Graphics/Drawable.cpp')
-rw-r--r--src/libjin/Graphics/Drawable.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/libjin/Graphics/Drawable.cpp b/src/libjin/Graphics/Drawable.cpp
index cab6c50..799498e 100644
--- a/src/libjin/Graphics/Drawable.cpp
+++ b/src/libjin/Graphics/Drawable.cpp
@@ -9,34 +9,22 @@ namespace jin
{
namespace graphics
{
- Drawable::Drawable(int w, int h):texture(0), width(w), height(h), ancx(0), ancy(0), textCoord(0), vertCoord(0)
+ Drawable::Drawable(int w, int h)
+ : texture(0)
+ , size()
+ , anchor()
{
}
Drawable::~Drawable()
{
glDeleteTextures(1, &texture);
- delete[] vertCoord;
- delete[] textCoord;
- }
-
- void Drawable::setVertices(float* v, float* t)
- {
- // render area
- if (vertCoord)
- delete[] vertCoord;
- vertCoord = v;
-
- // textrue
- if (textCoord)
- delete[] textCoord;
- textCoord = t;
}
void Drawable::setAnchor(int x, int y)
{
- ancx = x;
- ancy = y;
+ anchor.x = x;
+ anchor.y = y;
}
void Drawable::draw(int x, int y, float sx, float sy, float r)
@@ -45,7 +33,7 @@ namespace graphics
if (! textCoord||! vertCoord) return;
static jin::math::Matrix t;
- t.setTransformation(x, y, r, sx, sy, ancx, ancy);
+ t.setTransformation(x, y, r, sx, sy, anchor.x, anchor.y);
glEnable(GL_TEXTURE_2D);