Absolutely frivolous, but very cute, change : show icons of what is being loaded during the loading screen (sorry, couldn't help but waste time on this =)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6054 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
979beb5a23
commit
37901f7f39
@ -335,28 +335,44 @@ void IrrDriver::doApplyResSettings()
|
|||||||
m_video_driver = NULL;
|
m_video_driver = NULL;
|
||||||
m_gui_env = NULL;
|
m_gui_env = NULL;
|
||||||
m_scene_manager = NULL;
|
m_scene_manager = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
// ---- Reinit
|
||||||
|
// FIXME: this load sequence is (mostly) duplicated from main.cpp!! That's just error prone
|
||||||
|
// (we're sure to update main.cpp at some point and forget this one...)
|
||||||
|
|
||||||
initDevice();
|
initDevice();
|
||||||
|
|
||||||
material_manager->reInit();
|
|
||||||
|
|
||||||
file_manager->pushTextureSearchPath(file_manager->getModelFile(""));
|
|
||||||
const std::string materials_file = file_manager->getModelFile("materials.xml");
|
|
||||||
if(materials_file!="")
|
|
||||||
material_manager->pushTempMaterial(materials_file);
|
|
||||||
{
|
|
||||||
powerup_manager -> loadAllPowerups ();
|
|
||||||
item_manager -> loadDefaultItems();
|
|
||||||
}
|
|
||||||
if(materials_file!="")
|
|
||||||
material_manager->popTempMaterial();
|
|
||||||
file_manager->popTextureSearchPath();
|
|
||||||
|
|
||||||
kart_properties_manager -> loadAllKarts();
|
|
||||||
projectile_manager -> loadData();
|
|
||||||
attachment_manager -> loadModels();
|
|
||||||
|
|
||||||
// Re-init GUI engine
|
// Re-init GUI engine
|
||||||
GUIEngine::init(m_device, m_video_driver, StateManager::get());
|
GUIEngine::init(m_device, m_video_driver, StateManager::get());
|
||||||
|
|
||||||
|
material_manager->reInit();
|
||||||
|
GUIEngine::addLoadingIcon( irr_driver->getTexture(file_manager->getGUIDir() + "/options_video.png") );
|
||||||
|
|
||||||
|
file_manager->pushTextureSearchPath(file_manager->getModelFile(""));
|
||||||
|
const std::string materials_file = file_manager->getModelFile("materials.xml");
|
||||||
|
if (materials_file != "")
|
||||||
|
{
|
||||||
|
material_manager->pushTempMaterial(materials_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
powerup_manager -> loadAllPowerups ();
|
||||||
|
item_manager -> loadDefaultItems();
|
||||||
|
projectile_manager -> loadData();
|
||||||
|
GUIEngine::addLoadingIcon( irr_driver->getTexture(file_manager->getGUIDir() + "/gift.png") );
|
||||||
|
|
||||||
|
if (materials_file != "")
|
||||||
|
{
|
||||||
|
material_manager->popTempMaterial();
|
||||||
|
}
|
||||||
|
|
||||||
|
file_manager->popTextureSearchPath();
|
||||||
|
|
||||||
|
kart_properties_manager -> loadAllKarts();
|
||||||
|
|
||||||
|
attachment_manager -> loadModels();
|
||||||
|
GUIEngine::addLoadingIcon( irr_driver->getTexture(file_manager->getGUIDir() + "/banana.png") );
|
||||||
|
|
||||||
GUIEngine::reshowCurrentScreen();
|
GUIEngine::reshowCurrentScreen();
|
||||||
|
|
||||||
} // changeResolution
|
} // changeResolution
|
||||||
|
@ -1021,8 +1021,13 @@ namespace GUIEngine
|
|||||||
} // render
|
} // render
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void renderLoading()
|
|
||||||
|
std::vector<irr::video::ITexture*> g_loading_icons;
|
||||||
|
|
||||||
|
void renderLoading(bool clearIcons)
|
||||||
{
|
{
|
||||||
|
if (clearIcons) g_loading_icons.clear();
|
||||||
|
|
||||||
g_skin->drawBgImage();
|
g_skin->drawBgImage();
|
||||||
ITexture* loading =
|
ITexture* loading =
|
||||||
irr_driver->getTexture(file_manager->getGUIDir()+"/loading.png");
|
irr_driver->getTexture(file_manager->getGUIDir()+"/loading.png");
|
||||||
@ -1055,9 +1060,49 @@ namespace GUIEngine
|
|||||||
SColor(255,255,255,255),
|
SColor(255,255,255,255),
|
||||||
true/* center h */, false /* center v */ );
|
true/* center h */, false /* center v */ );
|
||||||
|
|
||||||
|
const int icon_count = g_loading_icons.size();
|
||||||
|
const int icon_size = (int)(screen_w / 16.0f);
|
||||||
|
const int ICON_MARGIN = 6;
|
||||||
|
int x = ICON_MARGIN;
|
||||||
|
int y = screen_h - icon_size - ICON_MARGIN;
|
||||||
|
for (int n=0; n<icon_count; n++)
|
||||||
|
{
|
||||||
|
g_driver->draw2DImage(g_loading_icons[n],
|
||||||
|
core::rect<s32>(x, y, x+icon_size, y+icon_size),
|
||||||
|
core::rect<s32>(core::position2d<s32>(0, 0), g_loading_icons[n]->getSize()),
|
||||||
|
NULL, NULL, true
|
||||||
|
);
|
||||||
|
|
||||||
|
x += ICON_MARGIN + icon_size;
|
||||||
|
if (x + icon_size + ICON_MARGIN/2 > screen_w)
|
||||||
|
{
|
||||||
|
y = y - ICON_MARGIN - icon_size;
|
||||||
|
x = ICON_MARGIN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // renderLoading
|
} // renderLoading
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void addLoadingIcon(irr::video::ITexture* icon)
|
||||||
|
{
|
||||||
|
if (icon != NULL)
|
||||||
|
{
|
||||||
|
g_loading_icons.push_back(icon);
|
||||||
|
|
||||||
|
g_device->getVideoDriver()->beginScene(true, true, video::SColor(255,100,101,140));
|
||||||
|
renderLoading(false);
|
||||||
|
g_device->getVideoDriver()->endScene();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "WARNING: GUIEngine::addLoadingIcon given NULL icon\n";
|
||||||
|
}
|
||||||
|
} // addLoadingIcon
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
Widget* getWidget(const char* name)
|
Widget* getWidget(const char* name)
|
||||||
{
|
{
|
||||||
// if a modal dialog is shown, search within it too
|
// if a modal dialog is shown, search within it too
|
||||||
|
@ -203,7 +203,10 @@ namespace GUIEngine
|
|||||||
void render(float dt);
|
void render(float dt);
|
||||||
|
|
||||||
/** \brief renders a "loading" screen */
|
/** \brief renders a "loading" screen */
|
||||||
void renderLoading();
|
void renderLoading(bool clearIcons = true);
|
||||||
|
|
||||||
|
/** \brief to spice up a bit the loading icon : add icons to the loading screen */
|
||||||
|
void addLoadingIcon(irr::video::ITexture* icon);
|
||||||
|
|
||||||
//void transmitEvent(Widget* widget, std::string& name, const int playerID);
|
//void transmitEvent(Widget* widget, std::string& name, const int playerID);
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include "challenges/unlock_manager.hpp"
|
#include "challenges/unlock_manager.hpp"
|
||||||
#include "config/stk_config.hpp"
|
#include "config/stk_config.hpp"
|
||||||
#include "config/user_config.hpp"
|
#include "config/user_config.hpp"
|
||||||
|
#include "graphics/irr_driver.hpp"
|
||||||
|
#include "guiengine/engine.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "karts/kart_properties.hpp"
|
#include "karts/kart_properties.hpp"
|
||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
@ -119,7 +121,16 @@ void KartPropertiesManager::loadAllKarts()
|
|||||||
for(std::set<std::string>::const_iterator subdir=result.begin();
|
for(std::set<std::string>::const_iterator subdir=result.begin();
|
||||||
subdir!=result.end(); subdir++)
|
subdir!=result.end(); subdir++)
|
||||||
{
|
{
|
||||||
loadKart(*dir+"/"+*subdir);
|
const bool loaded = loadKart(*dir+"/"+*subdir);
|
||||||
|
|
||||||
|
if (loaded)
|
||||||
|
{
|
||||||
|
GUIEngine::addLoadingIcon(irr_driver->getTexture(
|
||||||
|
*dir + "/"+*subdir + "/" +
|
||||||
|
m_karts_properties[m_karts_properties.size()-1]->getIconFile()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
} // for all files in the currently handled directory
|
} // for all files in the currently handled directory
|
||||||
} // for i
|
} // for i
|
||||||
} // loadAllKarts
|
} // loadAllKarts
|
||||||
|
@ -654,8 +654,10 @@ int main(int argc, char *argv[] )
|
|||||||
|
|
||||||
main_loop = new MainLoop();
|
main_loop = new MainLoop();
|
||||||
material_manager -> loadMaterial ();
|
material_manager -> loadMaterial ();
|
||||||
|
GUIEngine::addLoadingIcon( irr_driver->getTexture(file_manager->getGUIDir() + "/options_video.png") );
|
||||||
kart_properties_manager -> loadAllKarts ();
|
kart_properties_manager -> loadAllKarts ();
|
||||||
unlock_manager = new UnlockManager();
|
unlock_manager = new UnlockManager();
|
||||||
|
GUIEngine::addLoadingIcon( irr_driver->getTexture(file_manager->getTextureFile("gui_lock.png")) );
|
||||||
projectile_manager -> loadData ();
|
projectile_manager -> loadData ();
|
||||||
|
|
||||||
// Both item_manager and powerup_manager load models and therefore
|
// Both item_manager and powerup_manager load models and therefore
|
||||||
@ -671,10 +673,15 @@ int main(int argc, char *argv[] )
|
|||||||
}
|
}
|
||||||
if(materials_file!="")
|
if(materials_file!="")
|
||||||
material_manager->popTempMaterial();
|
material_manager->popTempMaterial();
|
||||||
|
|
||||||
|
GUIEngine::addLoadingIcon( irr_driver->getTexture(file_manager->getGUIDir() + "/gift.png") );
|
||||||
|
|
||||||
file_manager->popTextureSearchPath();
|
file_manager->popTextureSearchPath();
|
||||||
|
|
||||||
attachment_manager -> loadModels ();
|
attachment_manager -> loadModels ();
|
||||||
|
|
||||||
|
GUIEngine::addLoadingIcon( irr_driver->getTexture(file_manager->getGUIDir() + "/banana.png") );
|
||||||
|
|
||||||
//handleCmdLine() needs InitTuxkart() so it can't be called first
|
//handleCmdLine() needs InitTuxkart() so it can't be called first
|
||||||
if(!handleCmdLine(argc, argv)) exit(0);
|
if(!handleCmdLine(argc, argv)) exit(0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user