summaryrefslogtreecommitdiff
path: root/lib/glshape.cc
diff options
context:
space:
mode:
authorpixel <pixel>2003-04-04 15:06:29 +0000
committerpixel <pixel>2003-04-04 15:06:29 +0000
commitfeba563611f39efe4f71cf09347d5aa9cd13ada6 (patch)
tree8081c7ba2946b255e23d82bb69221bc54f0f6381 /lib/glshape.cc
parent986a589d45841832e3655892f65b773193e277af (diff)
Finished filling
Diffstat (limited to 'lib/glshape.cc')
-rw-r--r--lib/glshape.cc54
1 files changed, 29 insertions, 25 deletions
diff --git a/lib/glshape.cc b/lib/glshape.cc
index 5572e4d..9257257 100644
--- a/lib/glshape.cc
+++ b/lib/glshape.cc
@@ -48,6 +48,12 @@ void mogltk::glshape::pixel(int x, int y, ColorP c) {
box(x, y, x, y, c);
}
+void mogltk::glshape::obox(int x1, int y1, int x2, int y2, ColorP c) {
+ ENTER;
+ shape::obox(x1, y1, x2, y2, c);
+ LEAVE;
+}
+
void mogltk::glshape::obox(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4) {
ENTER;
@@ -155,32 +161,30 @@ void mogltk::glshape::Leave(bool was2D) {
mogltk::engine::glbase_o->Leave2DMode();
}
-class filldrawer : public mogltk::fillwalker {
- public:
- filldrawer(mogltk::shape * _s, mogltk::ColorP _c = DOS_WHITE) : s(_s), c(_c), oldx(-1), oldy(-1) { }
- virtual ~filldrawer() { }
- virtual void step(int x, int y) {
- if (oldy != y)
- oldx = -1;
- if (oldx == -1) {
- oldx = x;
- } else {
- s->hline(oldx, x, y, c);
- oldx = -1;
- }
- oldy = y;
+void mogltk::glshape::fdraw(fill * f, ColorP c, int sx, int sy) {
+ ENTERT;
+
+ texture * t = f->GetTexture();
+
+ if (!t) {
+ filldrawer * w = new filldrawer(f, t = f->Talloc(), c);
+ f->walk(w);
+ delete w;
}
- private:
- mogltk::shape * s;
- mogltk::ColorP c;
- int oldx, oldy;
-};
-void mogltk::glshape::fdraw(fill * f, ColorP c) {
- ENTER;
- filldrawer * w = new filldrawer(this, c);
- f->walk(w);
- delete w;
+ c.Bind();
+ t->Bind();
+ int w = t->GetWidth();
+ int h = t->GetHeight();
+ int x = f->GetMinX() + sx;
+ int y = f->GetMinY() + sy;
+
+ glBegin(GL_TRIANGLE_STRIP);
+ glTexCoord2i(0, 0); glVertex2i(x , y );
+ glTexCoord2i(w, 0); glVertex2i(x + w, y );
+ glTexCoord2i(0, h); glVertex2i(x , y + h);
+ glTexCoord2i(w, h); glVertex2i(x + w, y + h);
+ glEnd();
+
LEAVE;
}
- \ No newline at end of file