From f4b5d6adc47032528d11e007a4a5cc4840676446 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Fri, 19 Apr 2019 20:18:36 +0200 Subject: [PATCH] Trying gui --- src/main.cpp | 43 +++++++------------------------------------ 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3b1787e..0384ba5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,7 @@ using namespace irr; using namespace core; using namespace video; +using namespace gui; SCM register_generator(SCM name, SCM proc) { @@ -36,47 +37,17 @@ int main() if (!device) return 1; - IVideoDriver* driver = device->getVideoDriver(); - - f32 bg_r = 255.0f; - f32 bg_g = 255.0f; - f32 bg_b = 255.0f; - - bool fadeOut = -1; + device->setWindowCaption(L"Dungeon Master"); - u32 then = device->getTimer()->getTime(); + IVideoDriver* driver = device->getVideoDriver(); + IGUIEnvironment* env = device->getGUIEnvironment(); - const f32 fadeRate = 0.1f; + env->addStaticText(L"Dungeon Master", rect(150,20,350,40), true); while (device->run()) { - const u32 now = device->getTimer()->getTime(); - const f32 frameDeltaTime = (f32)(now - then); - then = now; - - if (bg_r <= 0.0f) fadeOut = false; - else if (bg_r >= 255.0f) fadeOut = true; - - if (fadeOut) - { - bg_r -= fadeRate * frameDeltaTime; - bg_g -= fadeRate * frameDeltaTime; - bg_b -= fadeRate * frameDeltaTime; - } - else - { - bg_r += fadeRate * frameDeltaTime; - bg_g += fadeRate * frameDeltaTime; - bg_b += fadeRate * frameDeltaTime; - } - - if (bg_r <= 0.0f) - bg_r = bg_b = bg_g = 0.0f; - else if (bg_r >= 255.0f) - bg_r = bg_b = bg_g = 255.0f; - - driver->beginScene(true, true, SColor(255, (u32)bg_r, - (u32)bg_g, (u32)bg_b)); + driver->beginScene(true, true, SColor(0, 200, 200, 200)); + env->drawAll(); driver->endScene(); } -- 2.39.5