LoadingScreen now much cooler 8-)

This commit is contained in:
Jan Philipp Timme 2014-12-09 15:43:24 +01:00
parent 571d990f91
commit f08d5ef6f5
2 changed files with 18 additions and 1 deletions

View File

@ -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);
}
/**

View File

@ -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();
}
}
}