@@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
24
24
#include " util/timetaker.h"
25
25
#include " fontengine.h"
26
26
#include " guiscalingfilter.h"
27
+ #include " filesys.h"
27
28
28
29
typedef enum {
29
30
LEFT = -1 ,
@@ -590,30 +591,35 @@ void draw_load_screen(const std::wstring &text, IrrlichtDevice* device,
590
591
driver->beginScene (true , true , video::SColor (255 , 0 , 0 , 0 ));
591
592
592
593
// draw progress bar
593
- if ((percent >= 0 ) && (percent <= 100 ))
594
- {
595
- v2s32 barsize (
596
- // 342 is (approximately) 256/0.75 to keep bar on same size as
597
- // before with default settings
598
- 342 * porting::getDisplayDensity () *
599
- g_settings->getFloat (" gui_scaling" ),
600
- g_fontengine->getTextHeight () * 2 );
601
-
602
- core::rect<s32> barrect (center - barsize / 2 , center + barsize / 2 );
603
- driver->draw2DRectangle (video::SColor (255 , 255 , 255 , 255 ),barrect, NULL ); // border
604
- driver->draw2DRectangle (video::SColor (255 , 64 , 64 , 64 ), core::rect<s32> (
605
- barrect.UpperLeftCorner + 1 ,
606
- barrect.LowerRightCorner -1 ), NULL ); // black inside the bar
607
- driver->draw2DRectangle (video::SColor (255 , 128 , 128 , 128 ), core::rect<s32> (
608
- barrect.UpperLeftCorner + 1 ,
609
- core::vector2d<s32>(
610
- barrect.LowerRightCorner .X -
611
- (barsize.X - 1 ) + percent * (barsize.X - 2 ) / 100 ,
612
- barrect.LowerRightCorner .Y - 1 )), NULL ); // the actual progress
594
+ if ((percent >= 0 ) && (percent <= 100 )) {
595
+ std::string gamepath = fs::RemoveRelativePathComponents (
596
+ porting::path_share + DIR_DELIM + " textures" );
597
+ video::ITexture *progress_img = driver->getTexture (
598
+ (gamepath + " /base/pack/progress_bar.png" ).c_str ());
599
+ video::ITexture *progress_img_bg = driver->getTexture (
600
+ (gamepath + " /base/pack/progress_bar_bg.png" ).c_str ());
601
+
602
+ const core::dimension2d<u32> &img_size = progress_img_bg->getSize ();
603
+ u32 imgW = MYMAX (208 , img_size.Width );
604
+ u32 imgH = MYMAX (24 , img_size.Height );
605
+ v2s32 img_pos ((screensize.X - imgW) / 2 , (screensize.Y - imgH) / 2 );
606
+
607
+ draw2DImageFilterScaled (
608
+ driver, progress_img_bg,
609
+ core::rect<s32>(img_pos.X , img_pos.Y , img_pos.X + imgW, img_pos.Y + imgH),
610
+ core::rect<s32>(0 , 0 , img_size.Width , img_size.Height ),
611
+ 0 , 0 , true );
612
+
613
+ draw2DImageFilterScaled (
614
+ driver, progress_img,
615
+ core::rect<s32>(img_pos.X , img_pos.Y ,
616
+ img_pos.X + (percent * imgW) / 100 , img_pos.Y + imgH),
617
+ core::rect<s32>(0 , 0 , ((percent * img_size.Width ) / 100 ), img_size.Height ),
618
+ 0 , 0 , true );
613
619
}
620
+
614
621
guienv->drawAll ();
615
622
driver->endScene ();
616
-
617
623
guitext->remove ();
618
624
619
625
// return guitext;
0 commit comments