summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/base.h2
-rw-r--r--include/glshape.h2
-rw-r--r--include/shape.h8
-rw-r--r--lib/base.cc6
-rw-r--r--lib/glshape.cc12
-rw-r--r--lib/shape.cc28
-rw-r--r--src/test.cc32
7 files changed, 72 insertions, 18 deletions
diff --git a/include/base.h b/include/base.h
index 4e4cd5a..25e914b 100644
--- a/include/base.h
+++ b/include/base.h
@@ -13,6 +13,8 @@ namespace mogltk {
int GetHeight(void);
virtual void Flip(void);
SDL_Surface * getsurface();
+ void Enter2DMode();
+ void Leave2DMode();
protected:
base(int, int, int, int);
void setsurface(SDL_Surface *) throw (GeneralException);
diff --git a/include/glshape.h b/include/glshape.h
index c2e8b59..fb5e1d9 100644
--- a/include/glshape.h
+++ b/include/glshape.h
@@ -16,7 +16,9 @@ namespace mogltk {
virtual void box(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP);
virtual void obox(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE);
virtual void obox(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP);
+ virtual void hline(int x1, int x2, int y, ColorP = DOS_WHITE);
virtual void hline(int x1, int x2, int y, ColorP, ColorP);
+ virtual void vline(int x, int y1, int y2, ColorP = DOS_WHITE);
virtual void vline(int x, int y1, int y2, ColorP, ColorP);
virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx = 0, int ty = 0, double = 1.0, ColorP = WHITE);
virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP = WHITE);
diff --git a/include/shape.h b/include/shape.h
index 6bbf94e..8152f5a 100644
--- a/include/shape.h
+++ b/include/shape.h
@@ -78,12 +78,20 @@ namespace mogltk {
virtual void arc(int x, int y, int r, int x1, int y1, int x2, int y2, ColorP = DOS_WHITE);
virtual void box(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE);
virtual void box3d(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, int = 2, bool = false);
+ virtual void box(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP);
virtual void obox(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE);
virtual void obox3d(int x1, int y1, int x2, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false);
+ virtual void obox(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP);
virtual void hline(int x1, int x2, int y, ColorP = DOS_WHITE);
virtual void hline3d(int x1, int x2, int y, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false);
+ virtual void hline(int x1, int x2, int y, ColorP, ColorP);
virtual void vline(int x, int y1, int y2, ColorP = DOS_WHITE);
virtual void vline3d(int x, int y1, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false);
+ virtual void vline(int x, int y1, int y2, ColorP, ColorP);
+ virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx = 0, int ty = 0, double = 1.0, ColorP = WHITE);
+ virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP = WHITE);
+ virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx = 0, int ty = 0, double = 1.0);
+ virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx1, int ty1, int tx2, int ty2);
virtual void window(int x1, int y1, int x2, int y2,
const String & title = "",
ColorP titlecolor = DOS_HIGH_WHITE,
diff --git a/lib/base.cc b/lib/base.cc
index 8741978..310dde3 100644
--- a/lib/base.cc
+++ b/lib/base.cc
@@ -69,3 +69,9 @@ void mogltk::base::setsurface(SDL_Surface * _surface) throw (GeneralException) {
SDL_Surface * mogltk::base::getsurface() {
return surface;
}
+
+void mogltk::base::Enter2DMode() {
+}
+
+void mogltk::base::Leave2DMode() {
+}
diff --git a/lib/glshape.cc b/lib/glshape.cc
index 9257257..e1c1faf 100644
--- a/lib/glshape.cc
+++ b/lib/glshape.cc
@@ -40,10 +40,18 @@ void mogltk::glshape::hline(int x1, int x2, int y, ColorP c1, ColorP c2) {
box(x1, y, x2, y, c1, c2, c1, c2);
}
+void mogltk::glshape::hline(int x1, int x2, int y, ColorP c) {
+ box(x1, y, x2, y, c, c, c, c);
+}
+
void mogltk::glshape::vline(int x, int y1, int y2, ColorP c1, ColorP c2) {
box(x, y1, x, y2, c1, c1, c2, c2);
}
+void mogltk::glshape::vline(int x, int y1, int y2, ColorP c) {
+ box(x, y1, x, y2, c, c, c, c);
+}
+
void mogltk::glshape::pixel(int x, int y, ColorP c) {
box(x, y, x, y, c);
}
@@ -59,8 +67,8 @@ void mogltk::glshape::obox(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2,
hline(x1, x2, y1, c1, c2);
hline(x1, x2, y2, c3, c4);
- vline(x1, y1, y2, c1, c3);
- vline(x2, y1, y2, c2, c4);
+ vline(x1, y1 + 1, y2 - 1, c1, c3);
+ vline(x2, y1 + 1, y2 - 1, c2, c4);
LEAVE;
}
diff --git a/lib/shape.cc b/lib/shape.cc
index 45280f5..5120a3c 100644
--- a/lib/shape.cc
+++ b/lib/shape.cc
@@ -473,8 +473,8 @@ void mogltk::shape::obox(int x1, int y1, int x2, int y2, ColorP c) {
hline(x1, x2, y1, c);
hline(x1, x2, y2, c);
- vline(x1, y1, y2, c);
- vline(x2, y1, y2, c);
+ vline(x1, y1 + 1, y2 - 1, c);
+ vline(x2, y1 + 1, y2 - 1, c);
LEAVE;
}
@@ -597,3 +597,27 @@ void mogltk::shape::Leave(bool locked) {
if (locked)
SDL_UnlockSurface(mogltk::engine::base_o->getsurface());
}
+
+void mogltk::shape::tbox(texture *, int x1, int y1, int x2, int y2, int tx, int ty, double f, ColorP c) {
+}
+
+void mogltk::shape::tbox(texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP c) {
+}
+
+void mogltk::shape::tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx, int ty, double f) {
+}
+
+void mogltk::shape::tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx1, int ty1, int tx2, int ty2) {
+}
+
+void mogltk::shape::vline(int x, int y1, int y2, ColorP c1, ColorP c2) {
+}
+
+void mogltk::shape::hline(int x1, int x2, int y, ColorP c1, ColorP c2) {
+}
+
+void mogltk::shape::box(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4) {
+}
+
+void mogltk::shape::obox(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4) {
+}
diff --git a/src/test.cc b/src/test.cc
index 729c972..ede84c3 100644
--- a/src/test.cc
+++ b/src/test.cc
@@ -20,16 +20,18 @@ virtual int startup() throw (GeneralException) {
new Archive("datas.paq");
- mogltk::glbase * gl = new mogltk::glbase();
- mogltk::glshape * sh = new mogltk::glshape();
- mogltk::glfont * font = new mogltk::glfont(&Input("font-2.bin"));
-
-// mogltk::base * gl = new mogltk::base();
-// mogltk::shape * sh = new mogltk::shape();
-// mogltk::font * font = new mogltk::font(&Input("font-2.bin"));
-
+#if 1
+ mogltk::base * gl = new mogltk::glbase();
+ mogltk::shape * sh = new mogltk::glshape();
+ mogltk::font * font = new mogltk::glfont(&Input("font-2.bin"));
+ mogltk::Sprite * s = new mogltk::glSprite(&Input("cursor.rgba"), 25, 25);
+#else
+ mogltk::base * gl = new mogltk::base();
+ mogltk::shape * sh = new mogltk::shape();
+ mogltk::font * font = new mogltk::font(&Input("font-2.bin"));
mogltk::Sprite * s = new mogltk::Sprite(&Input("cursor.rgba"), 25, 25);
-
+#endif
+
mogltk::engine::setcursorvisible(true);
mogltk::engine::setappactive(true);
@@ -46,12 +48,12 @@ virtual int startup() throw (GeneralException) {
sy1 = 240 + 240 * sin(0.692 * t + 8.21);
sy2 = 240 + 240 * sin(1.029 * t + 2.42);
-// gl->Enter2DMode();
+ gl->Enter2DMode();
-// sh->tbox(mytex, 50, 50, 561, 561, BLACK, RED, LIME, BLUE);
-// sh->box(400, 100, 450, 150, BLACK, RED, LIME, BLUE);
+ sh->tbox(mytex, 50, 50, 561, 561, BLACK, RED, LIME, BLUE);
+ sh->box(400, 100, 450, 150, BLACK, RED, LIME, BLUE);
-// sh->box(5, 5, 150, 80, CORNFLOWERBLUE, DEEPSKYBLUE, MIDNIGHTBLUE, NAVY);
+ sh->box(5, 5, 150, 80, CORNFLOWERBLUE, DEEPSKYBLUE, MIDNIGHTBLUE, NAVY);
font->setshadow(1);
font->putcursor(10, 30);
font->setcolor(WHITE);
@@ -73,7 +75,9 @@ virtual int startup() throw (GeneralException) {
// sh->arc(320, 240, 50, 0, 0);
sh->box(MIN(sx1, sx2), MIN(sy1, sy2), MAX(sx1, sx2), MAX(sy1, sy2), AlphaBlue);
+ mogltk::ColorP::Min.A = 200;
sh->obox(MIN(sx1, sx2), MIN(sy1, sy2), MAX(sx1, sx2), MAX(sy1, sy2), AlphaBlue);
+ mogltk::ColorP::Min.A = 0;
font->putcursor(550, 400);
font->printf("FPS: %.2f\n", mogltk::engine::FPS());
@@ -83,7 +87,7 @@ virtual int startup() throw (GeneralException) {
s->draw(mogltk::engine::mouseX() - 8, mogltk::engine::mouseY() - 6);
-// gl->Leave2DMode();
+ gl->Leave2DMode();
gl->Flip();