From 541c00c93fcd98f766cce661aa83ef4ffe713e57 Mon Sep 17 00:00:00 2001 From: pixel Date: Fri, 28 Mar 2003 12:30:26 +0000 Subject: First part of the backend separation --- src/test.cc | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/test.cc b/src/test.cc index 1057033..645e033 100644 --- a/src/test.cc +++ b/src/test.cc @@ -5,11 +5,11 @@ #include #include #include "glbase.h" -#include "gltexture.h" +#include "texture.h" #include "glfont.h" #include "glwidgets.h" #include "engine.h" -#include "sprite.h" +#include "glsprite.h" #include "glshape.h" CODE_BEGINS @@ -17,9 +17,10 @@ virtual int startup() throw (GeneralException) { int sx1, sx2, sy1, sy2; double t = 0; verbosity = M_INFO; - mogltk::glbase::setup(); + mogltk::glbase * gl = new mogltk::glbase(); + mogltk::glshape * sh = new mogltk::glshape(); new Archive("datas.paq"); - mogltk::font font(&Input("font-2.bin")); + mogltk::glfont * font = new mogltk::glfont(&Input("font-2.bin")); mogltk::Sprite * s = new mogltk::Sprite(&Input("cursor.rgba"), 25, 25); mogltk::engine::setcursorvisible(true); @@ -36,41 +37,41 @@ virtual int startup() throw (GeneralException) { sy1 = 240 + 240 * sin(0.692 * t + 8.21); sy2 = 240 + 240 * sin(1.029 * t + 2.42); - mogltk::glbase::Enter2DMode(); + gl->Enter2DMode(); - mogltk::shape::tbox(mytex, 50, 50, 561, 561, BLACK, RED, LIME, BLUE); - mogltk::shape::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); - mogltk::shape::box(5, 5, 150, 80, CORNFLOWERBLUE, DEEPSKYBLUE, MIDNIGHTBLUE, NAVY); - font.setshadow(1); - font.putcursor(10, 30); - font.setcolor(WHITE); - font.printf( + sh->box(5, 5, 150, 80, CORNFLOWERBLUE, DEEPSKYBLUE, MIDNIGHTBLUE, NAVY); + font->setshadow(1); + font->putcursor(10, 30); + font->setcolor(WHITE); + font->printf( "PixelPawa!\n" "It works!!\n" "I can't believe it!\n" ); - mogltk::shape::box3d(50, 150, 150, 200); - mogltk::shape::obox3d(50, 250, 150, 300); - mogltk::shape::window(50, 350, 150, 400, "Titre plus beau ;)"); - mogltk::shape::box3d(180, 130, 320, 220); - mogltk::shape::button(200, 150, 300, 200, "Bouton"); + sh->box3d(50, 150, 150, 200); + sh->obox3d(50, 250, 150, 300); + sh->window(50, 350, 150, 400, "Titre plus beau ;)"); + sh->box3d(180, 130, 320, 220); + sh->button(200, 150, 300, 200, "Bouton"); - mogltk::shape::box(MIN(sx1, sx2), MIN(sy1, sy2), MAX(sx1, sx2), MAX(sy1, sy2), AlphaBlue); + sh->box(MIN(sx1, sx2), MIN(sy1, sy2), MAX(sx1, sx2), MAX(sy1, sy2), AlphaBlue); - 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()); - font.printf("t: %.2fs\n", (double) SDL_GetTicks() / 1000); + 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()); + font->printf("t: %.2fs\n", (double) SDL_GetTicks() / 1000); s->draw(mogltk::engine::mouseX() - 8, mogltk::engine::mouseY() - 6); - mogltk::glbase::Leave2DMode(); + gl->Leave2DMode(); - mogltk::glbase::Flip(); + gl->Flip(); t = (double) SDL_GetTicks() / 1000; } -- cgit v1.2.3