{
scm_init_guile();
scm_primitive_load(scm_from_locale_string("plugins/default/main.scm"));
+
+ IrrlichtDevice* device =
+ createDevice(EDT_OPENGL,
+ dimension2d<u32>(640, 480), 16,
+ false, false, false, 0);
+ 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;
+
+ u32 then = device->getTimer()->getTime();
+
+ const f32 fadeRate = 0.1f;
+
+ 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->endScene();
+ }
+
+ device->drop();
+
return 0;
}