diff options
author | pixel <pixel> | 2003-05-20 01:53:24 +0000 |
---|---|---|
committer | pixel <pixel> | 2003-05-20 01:53:24 +0000 |
commit | e0f0cfd81fbec4fc20a591409f1bef67e16d62e7 (patch) | |
tree | 141b2742806249e1746d92b79b392022c95cfb2a /lib | |
parent | e7595adabac15fd3a523327bf8c42655f989f9c2 (diff) |
Bugfixes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/engine.cc | 25 | ||||
-rw-r--r-- | lib/glshape.cc | 6 | ||||
-rw-r--r-- | lib/shape.cc | 38 |
3 files changed, 69 insertions, 0 deletions
diff --git a/lib/engine.cc b/lib/engine.cc index 036aa25..6792706 100644 --- a/lib/engine.cc +++ b/lib/engine.cc @@ -18,8 +18,18 @@ Uint32 mogltk::engine::curticks; mogltk::glbase * mogltk::engine::glbase_o = 0; mogltk::base * mogltk::engine::base_o = 0; +mogltk::engine::keyevent * mogltk::engine::keyevent_h = 0; + #define UPDATERATE 1000 +void mogltk::engine::keyevent::up(SDL_keysym) { + printm(M_INFO, "Generic keyevent::up called\n"); +} + +void mogltk::engine::keyevent::down(SDL_keysym) { + printm(M_INFO, "Generic keyevent::down called\n"); +} + int mogltk::engine::setup() throw(GeneralException) { if (inited) { printm(M_WARNING, _("mogltk::engine::setup() called twice, ignoring second call.\n")); @@ -175,6 +185,13 @@ void mogltk::engine::pollevents() { printm(M_INFO, "SDL keysym: %i - Unicode: %04x = `%c`- modifiers: %04x\n", event.key.keysym.sym, event.key.keysym.unicode, event.key.keysym.unicode, event.key.keysym.mod); if (event.key.keysym.sym == 27) hastoreturn = quitrequest = true; + if (keyevent_h) { + if (event.key.state == SDL_PRESSED) { + keyevent_h->down(event.key.keysym); + } else { + keyevent_h->up(event.key.keysym); + } + } break; case SDL_MOUSEMOTION: printm(M_INFO, "Mouse slept over the screen - (%i, %i)\n", event.motion.x, event.motion.y); @@ -186,6 +203,10 @@ void mogltk::engine::pollevents() { if (cursorvisible) hastoreturn = true; break; + case SDL_MOUSEBUTTONDOWN: + case SDL_MOUSEBUTTONUP: + printm(M_INFO, String("Mouse button %02x ") + (event.button.state == SDL_PRESSED ? "pressed" : "released") + " at (%i, %i)\n", event.button.button, event.button.x, event.button.y); + break; case SDL_QUIT: printm(M_INFO, "Quit requested\n"); hastoreturn = quitrequest = true; @@ -249,3 +270,7 @@ void mogltk::engine::unlockmouse() { locked = 0; } +void mogltk::engine::setkeyevent(keyevent * k) { + printm(M_INFO, "Setting up a new keyevent\n"); + keyevent_h = k; +} diff --git a/lib/glshape.cc b/lib/glshape.cc index 7662334..270279d 100644 --- a/lib/glshape.cc +++ b/lib/glshape.cc @@ -172,6 +172,9 @@ void mogltk::glshape::Leave(bool was2D) { void mogltk::glshape::fdraw(fill * f, ColorP c, int sx, int sy) { ENTERT; + if (!f) + return; + texture * t = f->GetTexture(); if (!t) { @@ -200,6 +203,9 @@ void mogltk::glshape::fdraw(fill * f, ColorP c, int sx, int sy) { void mogltk::glshape::sdraw(fill * f, ColorP c, int sx, int sy) { ENTERT; + if (!f) + return; + texture * t = f->GetSTexture(); if (!t) { diff --git a/lib/shape.cc b/lib/shape.cc index fcca584..f566f3d 100644 --- a/lib/shape.cc +++ b/lib/shape.cc @@ -115,6 +115,13 @@ void mogltk::fill::insert(int x1, int y1, int x2, int y2) { insert(x + i2, y); } +void mogltk::fill::insertfix(int x, int y) { + if (!header) + return; + + header->insertfix(x, y); +} + int mogltk::fill::GetMaxX() const { return maxX; } @@ -217,6 +224,31 @@ void mogltk::fill::sline::insert(int ax, int ay) { } } +void mogltk::fill::sline::insertfix(int ax, int ay) { + sline * f; + + if (ay == y) { + if (count() & 1) { + insert(ax, ay); + } + } else { + f = header->header->look(ay); + if (!f) + return; + + f->insertfix(ax, ay); + } +} + +int mogltk::fill::sline::count() const { + int r = 0; + + if (next) + r = next->count(); + + return r + 1; +} + void mogltk::fill::sline::walk(fillwalker * w) { if (pheader) pheader->walk(w); @@ -653,6 +685,8 @@ void mogltk::filldrawer::step(int x, int y) { void mogltk::shape::fdraw(fill * f, ColorP c, int sx, int sy) { ENTER; + if (!f) + return; if (!f->GetTexture()) { filldrawer * w = new filldrawer(f, f->Talloc(), c); f->walk(w); @@ -690,6 +724,10 @@ void mogltk::segdrawer::step(int x1, int y1, int x2, int y2) { void mogltk::shape::sdraw(fill * f, ColorP c, int sx, int sy) { ENTER; + + if (!f) + return; + if (!f->GetSTexture()) { segdrawer * w = new segdrawer(f, f->STalloc(), c); f->swalk(w); |