Added a 'loading' screen, so that the game does not seem unresponsive when loading a big track

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4810 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-02-23 01:00:21 +00:00
parent 6577d770fb
commit f0b59c19b7
4 changed files with 39 additions and 0 deletions

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -291,6 +291,38 @@ void render(float elapsed_time)
#endif
} // render
// -----------------------------------------------------------------------------
void renderLoading()
{
g_skin->drawBgImage();
ITexture* loading = irr_driver->getTexture( file_manager->getGUIDir() + "/loading.png" );
const int texture_w = loading->getSize().Width;
const int texture_h = loading->getSize().Height;
core::dimension2d<u32> frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize();
const int screen_w = frame_size.Width;
const int screen_h = frame_size.Height;
const core::rect< s32 > dest_area = core::rect< s32 >(screen_w/2 - texture_w/2,
screen_h/2 - texture_h/2,
screen_w/2 + texture_w/2,
screen_h/2 + texture_h/2);
const core::rect< s32 > source_area = core::rect< s32 >(0, 0, texture_w, texture_h);
GUIEngine::getDriver()->draw2DImage( loading, dest_area, source_area,
0 /* no clipping */, 0, true /* alpha */);
g_title_font->draw(_("Loading"),
core::rect< s32 >( 0, screen_h/2 + texture_h/2, screen_w, screen_h ),
SColor(255,255,255,255),
true/* center h */, false /* center v */ );
} // renderLoading
// -----------------------------------------------------------------------------
Widget* getWidget(const char* name)
{

View File

@ -299,6 +299,7 @@ namespace GUIEngine
void reshowCurrentScreen();
void render(float dt);
void renderLoading();
void transmitEvent(Widget* widget, std::string& name, const int playerID);

View File

@ -207,6 +207,12 @@ void RaceManager::startNew()
*/
void RaceManager::startNextRace()
{
IrrlichtDevice* device = irr_driver->getDevice();
GUIEngine::renderLoading();
device->getVideoDriver()->endScene();
device->getVideoDriver()->beginScene(true, true, video::SColor(255,100,101,140));
m_num_finished_karts = 0;
m_num_finished_players = 0;