Eliminated unneeded calls to Graphics.setColor().

The method creates a new Color object each call, so set color in UnicodeFont.drawString() instead.

Also slightly padded the song information text.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-01-16 14:46:45 -05:00
parent 816c9bb659
commit be1ec64f28
5 changed files with 33 additions and 35 deletions

View File

@@ -88,23 +88,23 @@ public class MainMenuExit extends BasicGameState {
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
g.setBackground(Color.black);
g.setColor(Color.white);
// draw text
float c = container.getWidth() * 0.02f;
Utils.FONT_LARGE.drawString(c, c, "Are you sure you want to exit opsu!?");
Utils.FONT_LARGE.drawString(c, c, "Are you sure you want to exit opsu!?", Color.white);
// draw buttons
yesButton.draw(Color.green);
noButton.draw(Color.red);
g.setFont(Utils.FONT_XLARGE);
g.drawString("1. Yes",
Utils.FONT_XLARGE.drawString(
yesButton.getX() - (Utils.FONT_XLARGE.getWidth("1. Yes") / 2f),
yesButton.getY() - (Utils.FONT_XLARGE.getLineHeight() / 2f)
yesButton.getY() - (Utils.FONT_XLARGE.getLineHeight() / 2f),
"1. Yes", Color.white
);
g.drawString("2. No",
Utils.FONT_XLARGE.drawString(
noButton.getX() - (Utils.FONT_XLARGE.getWidth("2. No") / 2f),
noButton.getY() - (Utils.FONT_XLARGE.getLineHeight() / 2f)
noButton.getY() - (Utils.FONT_XLARGE.getLineHeight() / 2f),
"2. No", Color.white
);
Utils.drawFPS();