From ff05e0d8437c50e86229a79b99c8f1ae0ffe773f Mon Sep 17 00:00:00 2001 From: pixel Date: Fri, 14 Mar 2003 02:05:15 +0000 Subject: Creating shapes --- src/test.cc | 61 ++++++++++++------------------------------------------------- 1 file changed, 12 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/test.cc b/src/test.cc index 74b4b9b..55b4a14 100644 --- a/src/test.cc +++ b/src/test.cc @@ -7,21 +7,18 @@ #include "glbase.h" #include "gltexture.h" #include "glfont.h" +#include "glwidgets.h" #include "engine.h" #include "sprite.h" +#include "glshape.h" CODE_BEGINS virtual int startup() throw (GeneralException) { verbosity = M_INFO; mogltk::glbase::setup(); new Archive("datas.paq"); - Input * fonte = new Input("font.bin"); - mogltk::font font(fonte); - delete fonte; - Input * cursor = new Input("cursor.rgba"); - printm(M_INFO, "Sprite file size: %i\n", cursor->GetSize()); - mogltk::Sprite * s = new mogltk::Sprite(cursor, 25, 25); - delete cursor; + mogltk::font font(&Input("font-2.bin")); + mogltk::Sprite * s = new mogltk::Sprite(&Input("cursor.rgba"), 25, 25); mogltk::engine::setcursorvisible(true); mogltk::engine::setappactive(true); @@ -33,46 +30,10 @@ virtual int startup() throw (GeneralException) { while (!mogltk::engine::quitrequested()) { mogltk::glbase::Enter2DMode(); - mytex->Bind(); - glBegin(GL_TRIANGLE_STRIP); - glColor3d(0, 0, 0); - glTexCoord2i(0, 0); - glVertex2f(50, 50); - glColor3d(1, 0, 0); - glTexCoord2i(511, 0); - glVertex2f(561, 50); - glColor3d(0, 1, 0); - glTexCoord2i(0, 511); - glVertex2f(50, 561); - glColor3d(0, 0, 1); - glTexCoord2i(511, 511); - glVertex2f(561, 561); - glEnd(); - - mogltk::texture::Unbind(); - glBegin(GL_TRIANGLE_STRIP); - glColor3d(0, 0, 0); - glVertex2f(400, 100); - glColor3d(1, 0, 0); - glVertex2f(450, 100); - glColor3d(0, 1, 0); - glVertex2f(400, 150); - glColor3d(0, 0, 1); - glVertex2f(450, 150); - glEnd(); - - - glBegin(GL_TRIANGLE_STRIP); - CORNFLOWERBLUE.Bind(); - glVertex2f( 5, 5); - DEEPSKYBLUE.Bind(); - glVertex2f(150, 5); - MIDNIGHTBLUE.Bind(); - glVertex2f( 5, 80); - NAVY.Bind(); - glVertex2f(150, 80); - glEnd(); + mogltk::shape::tbox(mytex, 50, 50, 561, 561, BLACK, RED, LIME, BLUE); + mogltk::shape::box(400, 100, 450, 150, BLACK, RED, LIME, BLUE); + mogltk::shape::box(5, 5, 150, 80, CORNFLOWERBLUE, DEEPSKYBLUE, MIDNIGHTBLUE, NAVY); font.setshadow(1); font.putcursor(10, 30); font.setcolor(WHITE); @@ -82,10 +43,12 @@ virtual int startup() throw (GeneralException) { "I can't believe it!\n" ); - font.putcursor(550, 450); - font.printf("FPS: %.2f", mogltk::engine::FPS()); + font.putcursor(550, 400); + font.printf("FPS: %.2f\n", mogltk::engine::FPS()); + font.printf("mx: %i\n", mogltk::engine::mouseX()); + font.printf("my: %i\n", mogltk::engine::mouseY()); - s->draw(mogltk::engine::mouseX() - 9, mogltk::engine::mouseY() - 7); + s->draw(mogltk::engine::mouseX() - 8, mogltk::engine::mouseY() - 6); mogltk::glbase::Leave2DMode(); mogltk::glbase::Flip(); -- cgit v1.2.3