From f08d5ef6f5c950ecd2e1fcb2390f565dff6c54b4 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 9 Dec 2014 15:43:24 +0100 Subject: [PATCH] LoadingScreen now much cooler 8-) --- .../spacescooter/screen/LoadingScreen.java | 13 ++++++++++++- .../teamteamteam/spacescooter/utility/Loader.java | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/de/teamteamteam/spacescooter/screen/LoadingScreen.java b/src/de/teamteamteam/spacescooter/screen/LoadingScreen.java index d1944d4..bbc1858 100644 --- a/src/de/teamteamteam/spacescooter/screen/LoadingScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/LoadingScreen.java @@ -74,7 +74,18 @@ public class LoadingScreen extends Screen { g.fillRect(0, 0, GameConfig.windowWidth, GameConfig.windowHeight); g.setColor(Color.WHITE); g.setFont(new Font("Monospace", 0, 50)); - g.drawString("Progress: " + this.getProgress() + "%", 200, 500); + String text = "Loading ..."; + g.drawString(text, (GameConfig.windowWidth - g.getFontMetrics().stringWidth(text))/2, 150); + text = this.getProgress() + "%"; + g.drawString(text, (GameConfig.windowWidth - g.getFontMetrics().stringWidth(text))/2, GameConfig.windowHeight - 175); + int height = 75; + int width = GameConfig.windowWidth - 100; + int x = (GameConfig.windowWidth - width) / 2; + int y = GameConfig.windowHeight - 150; + int padding = 5; + g.drawRect(x - padding , y - padding, width + 2*padding, height + 2*padding); + g.setColor(Color.YELLOW); + g.fillRect(x, y, (int) (width * (this.getProgress() / 100.0)), height); } /** diff --git a/src/de/teamteamteam/spacescooter/utility/Loader.java b/src/de/teamteamteam/spacescooter/utility/Loader.java index 8d4b93b..81c676b 100644 --- a/src/de/teamteamteam/spacescooter/utility/Loader.java +++ b/src/de/teamteamteam/spacescooter/utility/Loader.java @@ -135,6 +135,12 @@ public class Loader { Loader.addLevelByFilename(e); } loadingScreen.increaseCurrentProcessed(); + //For the retro :D + try { + Thread.sleep(Random.nextInt(15)); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } } }