Improve showing of tips

1. Disable in track loading as for most tracks it too short to be seen

2. Show race tips only when human loses
This commit is contained in:
Benau 2019-12-19 00:33:22 +08:00
parent 22665023f7
commit 13bfb902db
4 changed files with 20 additions and 7 deletions

View File

@ -1360,6 +1360,12 @@ namespace GUIEngine
std::vector<irr::video::ITexture*> g_loading_icons;
core::stringw g_tips_string;
void clearLoadingTips()
{
g_tips_string = L"";
}
// -----------------------------------------------------------------------
void renderLoading(bool clearIcons, bool launching, bool update_tips)
{
#ifndef SERVER_ONLY
@ -1418,11 +1424,15 @@ namespace GUIEngine
true/* center h */, false /* center v */ );
// Draw a tip during loading
core::rect<s32> tipRect(core::position2d<s32>(0, y_from - text_height),
core::dimension2d<s32>(screen_w, text_height));
GL32_draw2DRectangle(Skin::getColor("tips_background::neutral"), tipRect);
Private::g_font->draw(g_tips_string.c_str(), tipRect, Skin::getColor("brighttext::neutral"),
true /* hcenter */, true /* vcenter */);
if (!g_tips_string.empty())
{
core::rect<s32> tipRect(core::position2d<s32>(0, y_from - text_height),
core::dimension2d<s32>(screen_w, text_height));
GL32_draw2DRectangle(Skin::getColor("tips_background::neutral"), tipRect);
Private::g_font->draw(g_tips_string, tipRect,
Skin::getColor("brighttext::neutral"),
true /* hcenter */, true /* vcenter */);
}
const int icon_count = (int)g_loading_icons.size();
const int icon_size = (int)(std::min(screen_w, screen_h) / 12.0f);

View File

@ -231,6 +231,8 @@ namespace GUIEngine
*/
void render(float dt, bool is_loading = false);
void clearLoadingTips();
/** \brief renders a "loading" screen */
void renderLoading(bool clearIcons = true, bool launching = false, bool update_tips = true);

View File

@ -484,7 +484,8 @@ void RaceManager::startNextRace()
// sfx_manager->dump();
IrrlichtDevice* device = irr_driver->getDevice();
GUIEngine::renderLoading();
GUIEngine::clearLoadingTips();
GUIEngine::renderLoading(true/*clearIcons*/, false/*launching*/, false/*update_tips*/);
device->getVideoDriver()->endScene();
device->getVideoDriver()->beginScene(true, true,
video::SColor(255,100,101,140));

View File

@ -145,7 +145,7 @@ void RaceResultGUI::init()
}
#ifndef SERVER_ONLY
if (!NetworkConfig::get()->isNetworking())
if (!human_win && !NetworkConfig::get()->isNetworking())
{
core::stringw tips_string = _("Tip: ");
tips_string += TipsManager::get()->getTip("race");