Moved all Utils.COLOR_* into new class opsu.ui.Colors.*.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
49
src/itdelatrisu/opsu/ui/Colors.java
Normal file
49
src/itdelatrisu/opsu/ui/Colors.java
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* opsu! - an open-source osu! client
|
||||
* Copyright (C) 2014, 2015 Jeffrey Han
|
||||
*
|
||||
* opsu! is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu! is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package itdelatrisu.opsu.ui;
|
||||
|
||||
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),
|
||||
BLUE_DIVIDER = new Color(49, 94, 237),
|
||||
BLUE_BACKGROUND = new Color(74, 130, 255),
|
||||
BLUE_BUTTON = new Color(40, 129, 237),
|
||||
ORANGE_BUTTON = new Color(200, 90, 3),
|
||||
YELLOW_ALPHA = new Color(255, 255, 0, 0.4f),
|
||||
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),
|
||||
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);
|
||||
|
||||
// This class should not be instantiated.
|
||||
private Colors() {}
|
||||
}
|
||||
@@ -185,7 +185,7 @@ public class UI {
|
||||
filter = Color.white;
|
||||
textColor = Color.black;
|
||||
} else {
|
||||
filter = (isHover) ? Utils.COLOR_RED_HOVER : Color.red;
|
||||
filter = (isHover) ? Colors.RED_HOVER : Color.red;
|
||||
textColor = Color.white;
|
||||
}
|
||||
tabImage.drawCentered(x, y, filter);
|
||||
@@ -404,21 +404,21 @@ public class UI {
|
||||
|
||||
// draw tooltip text inside a filled rectangle
|
||||
float alpha = tooltipAlpha.getValue();
|
||||
float oldAlpha = Utils.COLOR_BLACK_ALPHA.a;
|
||||
Utils.COLOR_BLACK_ALPHA.a = alpha;
|
||||
g.setColor(Utils.COLOR_BLACK_ALPHA);
|
||||
Utils.COLOR_BLACK_ALPHA.a = oldAlpha;
|
||||
float oldAlpha = Colors.BLACK_ALPHA.a;
|
||||
Colors.BLACK_ALPHA.a = alpha;
|
||||
g.setColor(Colors.BLACK_ALPHA);
|
||||
Colors.BLACK_ALPHA.a = oldAlpha;
|
||||
g.fillRect(x, y, textWidth, textHeight);
|
||||
oldAlpha = Utils.COLOR_DARK_GRAY.a;
|
||||
Utils.COLOR_DARK_GRAY.a = alpha;
|
||||
g.setColor(Utils.COLOR_DARK_GRAY);
|
||||
oldAlpha = Colors.DARK_GRAY.a;
|
||||
Colors.DARK_GRAY.a = alpha;
|
||||
g.setColor(Colors.DARK_GRAY);
|
||||
g.setLineWidth(1);
|
||||
g.drawRect(x, y, textWidth, textHeight);
|
||||
Utils.COLOR_DARK_GRAY.a = oldAlpha;
|
||||
oldAlpha = Utils.COLOR_WHITE_ALPHA.a;
|
||||
Utils.COLOR_WHITE_ALPHA.a = alpha;
|
||||
Utils.FONT_SMALL.drawString(x + textMarginX, y, tooltip, Utils.COLOR_WHITE_ALPHA);
|
||||
Utils.COLOR_WHITE_ALPHA.a = oldAlpha;
|
||||
Colors.DARK_GRAY.a = oldAlpha;
|
||||
oldAlpha = Colors.WHITE_ALPHA.a;
|
||||
Colors.WHITE_ALPHA.a = alpha;
|
||||
Utils.FONT_SMALL.drawString(x + textMarginX, y, tooltip, Colors.WHITE_ALPHA);
|
||||
Colors.WHITE_ALPHA.a = oldAlpha;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -474,17 +474,17 @@ public class UI {
|
||||
alpha -= 1 - ((BAR_NOTIFICATION_TIME - barNotifTimer) / (BAR_NOTIFICATION_TIME * 0.1f));
|
||||
int midX = container.getWidth() / 2, midY = container.getHeight() / 2;
|
||||
float barHeight = Utils.FONT_LARGE.getLineHeight() * (1f + 0.6f * Math.min(barNotifTimer * 15f / BAR_NOTIFICATION_TIME, 1f));
|
||||
float oldAlphaB = Utils.COLOR_BLACK_ALPHA.a, oldAlphaW = Utils.COLOR_WHITE_ALPHA.a;
|
||||
Utils.COLOR_BLACK_ALPHA.a *= alpha;
|
||||
Utils.COLOR_WHITE_ALPHA.a = alpha;
|
||||
g.setColor(Utils.COLOR_BLACK_ALPHA);
|
||||
float oldAlphaB = Colors.BLACK_ALPHA.a, oldAlphaW = Colors.WHITE_ALPHA.a;
|
||||
Colors.BLACK_ALPHA.a *= alpha;
|
||||
Colors.WHITE_ALPHA.a = alpha;
|
||||
g.setColor(Colors.BLACK_ALPHA);
|
||||
g.fillRect(0, midY - barHeight / 2f, container.getWidth(), barHeight);
|
||||
Utils.FONT_LARGE.drawString(
|
||||
midX - Utils.FONT_LARGE.getWidth(barNotif) / 2f,
|
||||
midY - Utils.FONT_LARGE.getLineHeight() / 2.2f,
|
||||
barNotif, Utils.COLOR_WHITE_ALPHA);
|
||||
Utils.COLOR_BLACK_ALPHA.a = oldAlphaB;
|
||||
Utils.COLOR_WHITE_ALPHA.a = oldAlphaW;
|
||||
barNotif, Colors.WHITE_ALPHA);
|
||||
Colors.BLACK_ALPHA.a = oldAlphaB;
|
||||
Colors.WHITE_ALPHA.a = oldAlphaW;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user