From 3bb587f0d7c471a70683fa7d26939d21968dea98 Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 2 Sep 2018 10:08:58 +0800 Subject: *update --- src/libjin/Graphics/Drawable.cpp | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'src/libjin/Graphics/Drawable.cpp') 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); -- cgit v1.1-26-g67d0