diff --git a/build/android/app/src/main/java/com/multicraft/game/MainActivity.kt b/build/android/app/src/main/java/com/multicraft/game/MainActivity.kt
index ac247aedc..c5c0864a9 100644
--- a/build/android/app/src/main/java/com/multicraft/game/MainActivity.kt
+++ b/build/android/app/src/main/java/com/multicraft/game/MainActivity.kt
@@ -119,8 +119,9 @@ class MainActivity : AppCompatActivity() {
binding.tvProgress.text = String.format(getString(progressMessage), progress)
binding.progressBar.progress = progress
// colorize the progress bar
- val progressDrawable =
- (binding.progressBar.progressDrawable as LayerDrawable).getDrawable(1)
+ val progressBarDrawable =
+ (binding.progressBar.progressDrawable as LayerDrawable).getDrawable(0)
+ val progressDrawable = (progressBarDrawable as LayerDrawable).getDrawable(1)
val color = Color.rgb(255 - progress * 2, progress * 2, 25)
progressDrawable.colorFilter =
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(
diff --git a/build/android/app/src/main/res/drawable/custom_progress_bar.xml b/build/android/app/src/main/res/drawable/custom_progress_bar.xml
index bc8e70538..932804b67 100644
--- a/build/android/app/src/main/res/drawable/custom_progress_bar.xml
+++ b/build/android/app/src/main/res/drawable/custom_progress_bar.xml
@@ -1,27 +1,9 @@
- -
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
+
+
diff --git a/build/android/app/src/main/res/drawable/progress.xml b/build/android/app/src/main/res/drawable/progress.xml
new file mode 100644
index 000000000..5791f0ca4
--- /dev/null
+++ b/build/android/app/src/main/res/drawable/progress.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/build/android/app/src/main/res/drawable/progress_bar.png b/build/android/app/src/main/res/drawable/progress_bar.png
new file mode 100644
index 000000000..54b3fb61d
Binary files /dev/null and b/build/android/app/src/main/res/drawable/progress_bar.png differ
diff --git a/build/android/app/src/main/res/drawable/progress_bar_bg.png b/build/android/app/src/main/res/drawable/progress_bar_bg.png
new file mode 100644
index 000000000..46a39a52e
Binary files /dev/null and b/build/android/app/src/main/res/drawable/progress_bar_bg.png differ
diff --git a/build/android/app/src/main/res/drawable/progress_bar_fg.png b/build/android/app/src/main/res/drawable/progress_bar_fg.png
new file mode 100644
index 000000000..0f873f69a
Binary files /dev/null and b/build/android/app/src/main/res/drawable/progress_bar_fg.png differ
diff --git a/build/android/app/src/main/res/layout/activity_main.xml b/build/android/app/src/main/res/layout/activity_main.xml
index 2b88a76a4..aa7ef7651 100644
--- a/build/android/app/src/main/res/layout/activity_main.xml
+++ b/build/android/app/src/main/res/layout/activity_main.xml
@@ -5,14 +5,14 @@
getTexture("progress_bar.png");
video::ITexture *progress_img_bg =
tsrc->getTexture("progress_bar_bg.png");
+ video::ITexture *progress_img_fg =
+ tsrc->getTexture("progress_bar_fg.png");
- if (progress_img && progress_img_bg) {
+ if (progress_img && progress_img_bg && progress_img_fg) {
const core::dimension2d &img_size =
progress_img_bg->getSize();
#if !defined(__ANDROID__) && !defined(__IOS__)
- float scale = RenderingEngine::getDisplayDensity();
- scale = scale >= 1 ? scale : 1;
+ float density = RenderingEngine::getDisplayDensity();
+ float gui_scaling = g_settings->getFloat("gui_scaling");
+ float scale = density * gui_scaling;
u32 imgW = rangelim(img_size.Width, 256, 1024) * scale;
u32 imgH = rangelim(img_size.Height, 32, 128) * scale;
- float imgR = scale;
#else
float imgRatio = (float) img_size.Height / img_size.Width;
u32 imgW = npot2(screensize.X / 2);
if (imgW > (screensize.X * 0.7) && imgW >= 1024)
imgW /= 2;
u32 imgH = imgW * imgRatio;
- float imgR = (float) (imgW) / img_size.Width;
#endif
v2s32 img_pos((screensize.X - imgW) / 2,
(screensize.Y - imgH) / 2);
- draw2DImageFilterScaled(
- driver, progress_img_bg,
- core::rect(img_pos.X, img_pos.Y, img_pos.X + imgW, img_pos.Y + imgH),
- core::rect(0, 0, img_size.Width, img_size.Height),
- 0, 0, true);
+ draw2DImageFilterScaled(driver, progress_img_bg,
+ core::rect(img_pos.X, img_pos.Y,
+ img_pos.X + imgW,
+ img_pos.Y + imgH),
+ core::rect(0, 0, img_size.Width,
+ img_size.Height),
+ 0, 0, true);
- // rects for drawing a color progress bar
- const static core::rect rects[] = {
- core::rect( 4, 24, 5, 40),
- core::rect( 5, 21, 6, 43),
- core::rect( 6, 19, 7, 45),
- core::rect( 7, 17, 8, 47),
- core::rect( 8, 15, 9, 49),
- core::rect( 9, 14, 10, 50),
- core::rect( 10, 13, 11, 51),
- core::rect( 11, 12, 12, 52),
- core::rect( 12, 11, 13, 53),
- core::rect( 13, 10, 14, 54),
- core::rect( 14, 9, 15, 55),
- core::rect( 15, 8, 17, 56),
- core::rect( 17, 7, 19, 57),
- core::rect( 19, 6, 21, 58),
- core::rect( 21, 5, 24, 59),
- core::rect( 24, 4, 488, 60),
- core::rect(488, 5, 491, 59),
- core::rect(491, 6, 493, 58),
- core::rect(493, 7, 495, 57),
- core::rect(495, 8, 497, 56),
- core::rect(497, 9, 498, 55),
- core::rect(498, 10, 499, 54),
- core::rect(499, 11, 500, 53),
- core::rect(500, 12, 501, 52),
- core::rect(501, 13, 502, 51),
- core::rect(502, 14, 503, 50),
- core::rect(503, 15, 504, 49),
- core::rect(504, 17, 505, 47),
- core::rect(505, 19, 506, 45),
- core::rect(506, 21, 507, 43),
- core::rect(507, 24, 508, 40)
- };
+ const video::SColor color(255, 255 - percent * 2, percent * 2, 25);
+ const video::SColor colors[] = {color, color, color, color};
- for (const auto &i : rects) {
- const s32 clipx = (percent * imgW) / 100;
- core::rect r(
- MYMIN(i.UpperLeftCorner.X * imgR, clipx), i.UpperLeftCorner.Y * imgR,
- MYMIN(i.LowerRightCorner.X * imgR, clipx), i.LowerRightCorner.Y * imgR
- );
- if (r.getArea() <= 0)
- break;
- driver->draw2DRectangle(
- video::SColor(255, 255 - percent * 2, percent * 2, 25),
- r + img_pos, nullptr);
- }
+ draw2DImageFilterScaled(driver, progress_img_fg,
+ core::rect(img_pos.X, img_pos.Y,
+ img_pos.X + (percent * imgW) / 100,
+ img_pos.Y + imgH),
+ core::rect(0, 0,
+ (percent * img_size.Width) / 100,
+ img_size.Height),
+ 0, colors, true);
draw2DImageFilterScaled(driver, progress_img,
core::rect(img_pos.X, img_pos.Y,
diff --git a/textures/base/pack/progress_bar_fg.png b/textures/base/pack/progress_bar_fg.png
new file mode 100644
index 000000000..0f873f69a
Binary files /dev/null and b/textures/base/pack/progress_bar_fg.png differ