1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Display background & moving progress bar on shutdown screen (#14597)

Co-authored-by: Gregor Parzefall <gregor.parzefall@posteo.de>
This commit is contained in:
chmodsayshello 2024-05-21 15:37:35 +02:00 committed by GitHub
parent 36d236c5e0
commit ab783b9bb2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 21 deletions

View file

@ -308,7 +308,7 @@ bool RenderingEngine::setWindowIcon()
*/
void RenderingEngine::draw_load_screen(const std::wstring &text,
gui::IGUIEnvironment *guienv, ITextureSource *tsrc, float dtime,
int percent, bool sky)
int percent, float *indef_pos)
{
v2u32 screensize = getWindowSize();
@ -322,18 +322,22 @@ void RenderingEngine::draw_load_screen(const std::wstring &text,
auto *driver = get_video_driver();
if (sky) {
driver->beginScene(true, true, RenderingEngine::MENU_SKY_COLOR);
if (g_settings->getBool("menu_clouds")) {
g_menuclouds->step(dtime * 3);
g_menucloudsmgr->drawAll();
}
} else {
driver->beginScene(true, true, video::SColor(255, 0, 0, 0));
driver->setFog(RenderingEngine::MENU_SKY_COLOR);
driver->beginScene(true, true, RenderingEngine::MENU_SKY_COLOR);
if (g_settings->getBool("menu_clouds")) {
g_menuclouds->step(dtime * 3);
g_menucloudsmgr->drawAll();
}
int percent_min = 0;
int percent_max = percent;
if (indef_pos) {
*indef_pos = fmodf(*indef_pos + (dtime * 50.0f), 140.0f);
percent_max = std::min((int) *indef_pos, 100);
percent_min = std::max((int) *indef_pos - 40, 0);
}
// draw progress bar
if ((percent >= 0) && (percent <= 100)) {
if ((percent_min >= 0) && (percent_max <= 100)) {
video::ITexture *progress_img = tsrc->getTexture("progress_bar.png");
video::ITexture *progress_img_bg =
tsrc->getTexture("progress_bar_bg.png");
@ -364,11 +368,11 @@ void RenderingEngine::draw_load_screen(const std::wstring &text,
0, 0, true);
draw2DImageFilterScaled(get_video_driver(), progress_img,
core::rect<s32>(img_pos.X, img_pos.Y,
img_pos.X + (percent * imgW) / 100,
core::rect<s32>(img_pos.X + (percent_min * imgW) / 100, img_pos.Y,
img_pos.X + (percent_max * imgW) / 100,
img_pos.Y + imgH),
core::rect<s32>(0, 0,
(percent * img_size.Width) / 100,
core::rect<s32>(percent_min * img_size.Width / 100, 0,
percent_max * img_size.Width / 100,
img_size.Height),
0, 0, true);
}