Loading screen?
-
Guest
Loading screen?
Is there anyone who knows how to make a loading screen like.. currently my game runs ok.. but the loading takes a loonng time
-
[dx/x]=HUNT3R
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida
example code:
Code: Select all
loadingScreen(irr::s32 percent) {
static irr::video::ITexture * loadbar = NULL;
if(!loadbar) loadbar = m_driver->getTexture("data/progressbar.BMP");
m_driver->beginScene(true, false, irr::video::SColor(0,0,0,0));
irr::gui::IGUIFont* font = m_env->getBuildInFont();
font->draw(L"LOADING", irr::core::rect<irr::s32>(50, 100, 50 + 200, 150), irr::video::SColor(255,255,255,255));
irr::core::rect< irr::s32 > clip(50, 50, 50 + (256 * percent/100) , 50 + 32);
if(loadbar) m_driver->draw2DImage(loadbar,
irr::core::position2d< irr::s32 >(50,50),
irr::core::rect< irr::s32 >(0,0,256,32),
&clip,
irr::video::SColor(255, 255, 255, 255),
false
);
m_driver->endScene();
}ie:
initialize() {
loadingscreen(0);
//load some images;
loadingscreen(10);
//load a model
loadingscreen(30);
//load a bsp level
loadingscreen(55);
//load some random other stuff
loadingscreen(70);
//initialize some final stuff
loadingscreen(85);
//pretty much done now
loadingscreen(100);
}
this will send updates to the screen with the loading bar being more and more complete. you can use my loading bar if you want:
http://www.skyesurfer.net/keless/IrrLic ... essbar.bmp
a screen cap is worth 0x100000 DWORDS