summaryrefslogtreecommitdiff
path: root/lib/glsprite.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/glsprite.cc')
-rw-r--r--lib/glsprite.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/glsprite.cc b/lib/glsprite.cc
index 478c0ef..18df7eb 100644
--- a/lib/glsprite.cc
+++ b/lib/glsprite.cc
@@ -35,3 +35,40 @@ void mogltk::glSprite::draw(int dx, int dy, ColorP c) {
if (!was2D)
mogltk::engine::glbase_o->Leave2DMode();
}
+
+void mogltk::glSprite::drawrotate(int cx, int cy, double a, ColorP c) {
+ bool was2D;
+
+ int sx, sy;
+
+ sx = GetSX() / 2;
+ sy = GetSY() / 2;
+
+ was2D = mogltk::engine::glbase_o->is2D();
+
+ if (!was2D)
+ mogltk::engine::glbase_o->Enter2DMode();
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glRotated(a, 0, 0, 1);
+ glTranslated(cx, cy, 0);
+
+ glMatrixMode(GL_TEXTURE);
+ glRotated(a, 0, 0, 1);
+
+ c.Bind();
+
+ Bind();
+ glBegin(GL_TRIANGLE_STRIP);
+ glTexCoord2i(GetPX() , GetPY() ); glVertex2i( - sx, - sy);
+ glTexCoord2i(GetPX() + GetSX(), GetPY() ); glVertex2i(GetSX() - sx, - sy);
+ glTexCoord2i(GetPX() , GetPY() + GetSY()); glVertex2i( - sx, GetSY() - sy);
+ glTexCoord2i(GetPX() + GetSX(), GetPY() + GetSY()); glVertex2i(GetSX() - sx, GetSY() - sy);
+ glEnd();
+
+ glPopMatrix();
+
+ if (!was2D)
+ mogltk::engine::glbase_o->Leave2DMode();
+}