From 5b14b34d6e11611fb395e3cffaf888bcca0f3661 Mon Sep 17 00:00:00 2001 From: pixel Date: Sun, 5 Oct 2003 19:14:35 +0000 Subject: Changes of the month --- src/test.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/test.cc') diff --git a/src/test.cc b/src/test.cc index 9003cab..ec00bfe 100644 --- a/src/test.cc +++ b/src/test.cc @@ -28,10 +28,10 @@ virtual int startup() throw (GeneralException) { new Archive("datas.paq"); #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); + mogltk::glbase * gl = new mogltk::glbase(); + mogltk::glshape * sh = new mogltk::glshape(); + mogltk::glfont * font = new mogltk::glfont(&Input("font-2.bin")); + mogltk::glSprite * s = new mogltk::glSprite(&Input("cursor.rgba"), 25, 25); #else mogltk::base * gl = new mogltk::base(); mogltk::shape * sh = new mogltk::shape(); @@ -90,8 +90,20 @@ virtual int startup() throw (GeneralException) { 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); + double sx, sy, l, a; + sx = mogltk::engine::mouseX() - 320; + sy = mogltk::engine::mouseY() - 240; + l = sqrt(sx * sx + sy * sy); + sx /= l; + sy /= l; + a = acos(sx); + if (sy < 0) + a = -a; + + font->printf("a: %.2f\n", a); sh->line(320, 240, mogltk::engine::mouseX(), mogltk::engine::mouseY()); + s->drawrotate(320, 240, a); + s->draw(mogltk::engine::mouseX() - 8, mogltk::engine::mouseY() - 6); gl->Leave2DMode(); -- cgit v1.2.3