Moved some duplicate colors into the Colors class.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-08-20 20:14:24 -05:00
parent 91f07855a7
commit 7b5b96752c
4 changed files with 14 additions and 27 deletions

View File

@ -20,6 +20,7 @@ package itdelatrisu.opsu;
import itdelatrisu.opsu.GameData.Grade; import itdelatrisu.opsu.GameData.Grade;
import itdelatrisu.opsu.states.SongMenu; import itdelatrisu.opsu.states.SongMenu;
import itdelatrisu.opsu.ui.Colors;
import itdelatrisu.opsu.ui.UI; import itdelatrisu.opsu.ui.UI;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -84,11 +85,6 @@ public class ScoreData implements Comparable<ScoreData> {
/** Drawing values. */ /** Drawing values. */
private static float baseX, baseY, buttonWidth, buttonHeight, buttonOffset; private static float baseX, baseY, buttonWidth, buttonHeight, buttonOffset;
/** Button background colors. */
private static final Color
BG_NORMAL = new Color(0, 0, 0, 0.25f),
BG_FOCUS = new Color(0, 0, 0, 0.75f);
/** /**
* Initializes the base coordinates for drawing. * Initializes the base coordinates for drawing.
* @param containerWidth the container width * @param containerWidth the container width
@ -238,7 +234,7 @@ public class ScoreData implements Comparable<ScoreData> {
float marginY = Utils.FONT_DEFAULT.getLineHeight() * 0.01f; float marginY = Utils.FONT_DEFAULT.getLineHeight() * 0.01f;
// rectangle outline // rectangle outline
g.setColor((focus) ? BG_FOCUS : BG_NORMAL); g.setColor((focus) ? Colors.BLACK_BG_FOCUS : Colors.BLACK_BG_NORMAL);
g.fillRect(baseX, y, buttonWidth, buttonHeight); g.fillRect(baseX, y, buttonWidth, buttonHeight);
// rank // rank

View File

@ -69,12 +69,6 @@ public class DownloadNode {
/** Container width. */ /** Container width. */
private static int containerWidth; private static int containerWidth;
/** Button background colors. */
public static final Color
BG_NORMAL = new Color(0, 0, 0, 0.25f),
BG_HOVER = new Color(0, 0, 0, 0.5f),
BG_FOCUS = new Color(0, 0, 0, 0.75f);
/** /**
* Initializes the base coordinates for drawing. * Initializes the base coordinates for drawing.
* @param width the container width * @param width the container width
@ -207,7 +201,7 @@ public class DownloadNode {
*/ */
public static void drawResultScrollbar(Graphics g, int index, int total) { public static void drawResultScrollbar(Graphics g, int index, int total) {
UI.drawScrollbar(g, index, total, maxResultsShown, buttonBaseX, buttonBaseY, UI.drawScrollbar(g, index, total, maxResultsShown, buttonBaseX, buttonBaseY,
buttonWidth * 1.01f, buttonHeight, buttonOffset, BG_NORMAL, Color.white, true); buttonWidth * 1.01f, buttonHeight, buttonOffset, Colors.BLACK_BG_NORMAL, Color.white, true);
} }
/** /**
@ -218,7 +212,7 @@ public class DownloadNode {
*/ */
public static void drawDownloadScrollbar(Graphics g, int index, int total) { public static void drawDownloadScrollbar(Graphics g, int index, int total) {
UI.drawScrollbar(g, index, total, maxDownloadsShown, infoBaseX, infoBaseY, UI.drawScrollbar(g, index, total, maxDownloadsShown, infoBaseX, infoBaseY,
infoWidth, infoHeight, infoHeight, BG_NORMAL, Color.white, true); infoWidth, infoHeight, infoHeight, Colors.BLACK_BG_NORMAL, Color.white, true);
} }
/** /**
@ -325,7 +319,7 @@ public class DownloadNode {
Download dl = DownloadList.get().getDownload(beatmapSetID); Download dl = DownloadList.get().getDownload(beatmapSetID);
// rectangle outline // rectangle outline
g.setColor((focus) ? BG_FOCUS : (hover) ? BG_HOVER : BG_NORMAL); g.setColor((focus) ? Colors.BLACK_BG_FOCUS : (hover) ? Colors.BLACK_BG_HOVER : Colors.BLACK_BG_NORMAL);
g.fillRect(buttonBaseX, y, buttonWidth, buttonHeight); g.fillRect(buttonBaseX, y, buttonWidth, buttonHeight);
// map is already loaded // map is already loaded
@ -386,7 +380,7 @@ public class DownloadNode {
float marginY = infoHeight * 0.04f; float marginY = infoHeight * 0.04f;
// rectangle outline // rectangle outline
g.setColor((id % 2 == 0) ? BG_HOVER : BG_NORMAL); g.setColor((id % 2 == 0) ? Colors.BLACK_BG_HOVER : Colors.BLACK_BG_NORMAL);
g.fillRect(infoBaseX, y, infoWidth, infoHeight); g.fillRect(infoBaseX, y, infoWidth, infoHeight);
// text // text

View File

@ -117,11 +117,6 @@ public class MainMenu extends BasicGameState {
/** Music position bar coordinates and dimensions. */ /** Music position bar coordinates and dimensions. */
private float musicBarX, musicBarY, musicBarWidth, musicBarHeight; private float musicBarX, musicBarY, musicBarWidth, musicBarHeight;
/** Music position bar background colors. */
private static final Color
BG_NORMAL = new Color(0, 0, 0, 0.25f),
BG_HOVER = new Color(0, 0, 0, 0.5f);
// game-related variables // game-related variables
private GameContainer container; private GameContainer container;
private StateBasedGame game; private StateBasedGame game;
@ -274,7 +269,7 @@ public class MainMenu extends BasicGameState {
// draw music position bar // draw music position bar
int mouseX = input.getMouseX(), mouseY = input.getMouseY(); int mouseX = input.getMouseX(), mouseY = input.getMouseY();
g.setColor((musicPositionBarContains(mouseX, mouseY)) ? BG_HOVER : BG_NORMAL); g.setColor((musicPositionBarContains(mouseX, mouseY)) ? Colors.BLACK_BG_HOVER : Colors.BLACK_BG_NORMAL);
g.fillRoundRect(musicBarX, musicBarY, musicBarWidth, musicBarHeight, 4); g.fillRoundRect(musicBarX, musicBarY, musicBarWidth, musicBarHeight, 4);
g.setColor(Color.white); g.setColor(Color.white);
if (!MusicController.isTrackLoading() && beatmap != null) { if (!MusicController.isTrackLoading() && beatmap != null) {

View File

@ -24,7 +24,6 @@ import org.newdawn.slick.Color;
* Colors used for drawing. * Colors used for drawing.
*/ */
public class Colors { public class Colors {
/** Game colors. */
public static final Color public static final Color
BLACK_ALPHA = new Color(0, 0, 0, 0.5f), BLACK_ALPHA = new Color(0, 0, 0, 0.5f),
WHITE_ALPHA = new Color(255, 255, 255, 0.5f), WHITE_ALPHA = new Color(255, 255, 255, 0.5f),
@ -36,13 +35,16 @@ public class Colors {
WHITE_FADE = new Color(255, 255, 255, 1f), WHITE_FADE = new Color(255, 255, 255, 1f),
RED_HOVER = new Color(255, 112, 112), RED_HOVER = new Color(255, 112, 112),
GREEN = new Color(137, 201, 79), GREEN = new Color(137, 201, 79),
LIGHT_ORANGE = new Color(255,192,128), LIGHT_ORANGE = new Color(255, 192, 128),
LIGHT_GREEN = new Color(128,255,128), LIGHT_GREEN = new Color(128, 255, 128),
LIGHT_BLUE = new Color(128,128,255), LIGHT_BLUE = new Color(128, 128, 255),
GREEN_SEARCH = new Color(173, 255, 47), GREEN_SEARCH = new Color(173, 255, 47),
DARK_GRAY = new Color(0.3f, 0.3f, 0.3f, 1f), DARK_GRAY = new Color(0.3f, 0.3f, 0.3f, 1f),
RED_HIGHLIGHT = new Color(246, 154, 161), RED_HIGHLIGHT = new Color(246, 154, 161),
BLUE_HIGHLIGHT = new Color(173, 216, 230); BLUE_HIGHLIGHT = new Color(173, 216, 230),
BLACK_BG_NORMAL = new Color(0, 0, 0, 0.25f),
BLACK_BG_HOVER = new Color(0, 0, 0, 0.5f),
BLACK_BG_FOCUS = new Color(0, 0, 0, 0.75f);
// This class should not be instantiated. // This class should not be instantiated.
private Colors() {} private Colors() {}