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.states.SongMenu;
import itdelatrisu.opsu.ui.Colors;
import itdelatrisu.opsu.ui.UI;
import java.sql.ResultSet;
@ -84,11 +85,6 @@ public class ScoreData implements Comparable<ScoreData> {
/** Drawing values. */
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.
* @param containerWidth the container width
@ -238,7 +234,7 @@ public class ScoreData implements Comparable<ScoreData> {
float marginY = Utils.FONT_DEFAULT.getLineHeight() * 0.01f;
// 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);
// rank

View File

@ -69,12 +69,6 @@ public class DownloadNode {
/** Container width. */
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.
* @param width the container width
@ -207,7 +201,7 @@ public class DownloadNode {
*/
public static void drawResultScrollbar(Graphics g, int index, int total) {
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) {
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);
// 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);
// map is already loaded
@ -386,7 +380,7 @@ public class DownloadNode {
float marginY = infoHeight * 0.04f;
// 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);
// text

View File

@ -117,11 +117,6 @@ public class MainMenu extends BasicGameState {
/** Music position bar coordinates and dimensions. */
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
private GameContainer container;
private StateBasedGame game;
@ -274,7 +269,7 @@ public class MainMenu extends BasicGameState {
// draw music position bar
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.setColor(Color.white);
if (!MusicController.isTrackLoading() && beatmap != null) {

View File

@ -24,7 +24,6 @@ import org.newdawn.slick.Color;
* Colors used for drawing.
*/
public class Colors {
/** Game colors. */
public static final Color
BLACK_ALPHA = new Color(0, 0, 0, 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),
RED_HOVER = new Color(255, 112, 112),
GREEN = new Color(137, 201, 79),
LIGHT_ORANGE = new Color(255,192,128),
LIGHT_GREEN = new Color(128,255,128),
LIGHT_BLUE = new Color(128,128,255),
LIGHT_ORANGE = new Color(255, 192, 128),
LIGHT_GREEN = new Color(128, 255, 128),
LIGHT_BLUE = new Color(128, 128, 255),
GREEN_SEARCH = new Color(173, 255, 47),
DARK_GRAY = new Color(0.3f, 0.3f, 0.3f, 1f),
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.
private Colors() {}