Init GUI as early as possible and show a loading screen during the first seconds when STK is loading

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5965 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2010-09-11 18:17:17 +00:00
parent 437bf86ac8
commit 5c0fba91f0
2 changed files with 13 additions and 6 deletions

View File

@@ -790,6 +790,8 @@ namespace GUIEngine
void init(IrrlichtDevice* device_a, IVideoDriver* driver_a,
AbstractStateManager* state_manager )
{
printf("================ GUI ================\n");
g_env = device_a->getGUIEnvironment();
g_device = device_a;
g_driver = driver_a;
@@ -879,6 +881,10 @@ namespace GUIEngine
// set event receiver
g_device->setEventReceiver(EventHandler::get());
g_device->getVideoDriver()->beginScene(true, true, video::SColor(255,100,101,140));
renderLoading();
g_device->getVideoDriver()->endScene();
} // init
// ------------------------------------------------------------------------

View File

@@ -526,6 +526,12 @@ void initUserConfig(char *argv[])
void initRest()
{
irr_driver = new IrrDriver();
// Init GUI
IrrlichtDevice* device = irr_driver->getDevice();
video::IVideoDriver* driver = device->getVideoDriver();
GUIEngine::init(device, driver, StateManager::get());
music_manager = new MusicManager();
sfx_manager = new SFXManager();
// The order here can be important, e.g. KartPropertiesManager needs
@@ -629,7 +635,7 @@ int main(int argc, char *argv[] )
logerrfile.c_str());
}
}
input_manager = new InputManager ();
// Get into menu mode initially.
@@ -658,11 +664,6 @@ int main(int argc, char *argv[] )
attachment_manager -> loadModels ();
// Init GUI prepare main menu
IrrlichtDevice* device = irr_driver->getDevice();
video::IVideoDriver* driver = device->getVideoDriver();
GUIEngine::init(device, driver, StateManager::get());
//handleCmdLine() needs InitTuxkart() so it can't be called first
if(!handleCmdLine(argc, argv)) exit(0);