Moved all Utils.FONT_* into new class opsu.ui.Fonts.*.
- Moved Utils.loadGlyphs() into this class, and rewrote it to take a single generic string (instead of beatmap title/artist strings, specifically). - Also moved font initialization into this class. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -27,6 +27,7 @@ import itdelatrisu.opsu.audio.MusicController;
|
||||
import itdelatrisu.opsu.audio.SoundController;
|
||||
import itdelatrisu.opsu.audio.SoundEffect;
|
||||
import itdelatrisu.opsu.ui.Colors;
|
||||
import itdelatrisu.opsu.ui.Fonts;
|
||||
import itdelatrisu.opsu.ui.MenuButton;
|
||||
import itdelatrisu.opsu.ui.UI;
|
||||
|
||||
@@ -185,8 +186,8 @@ public class OptionsMenu extends BasicGameState {
|
||||
|
||||
// option tabs
|
||||
Image tabImage = GameImage.MENU_TAB.getImage();
|
||||
float tabX = width * 0.032f + Utils.FONT_DEFAULT.getWidth("Change the way opsu! behaves") + (tabImage.getWidth() / 2);
|
||||
float tabY = Utils.FONT_XLARGE.getLineHeight() + Utils.FONT_DEFAULT.getLineHeight() +
|
||||
float tabX = width * 0.032f + Fonts.DEFAULT.getWidth("Change the way opsu! behaves") + (tabImage.getWidth() / 2);
|
||||
float tabY = Fonts.XLARGE.getLineHeight() + Fonts.DEFAULT.getLineHeight() +
|
||||
height * 0.015f - (tabImage.getHeight() / 2f);
|
||||
int tabOffset = Math.min(tabImage.getWidth(), width / OptionTab.SIZE);
|
||||
for (OptionTab tab : OptionTab.values())
|
||||
@@ -210,8 +211,8 @@ public class OptionsMenu extends BasicGameState {
|
||||
|
||||
// title
|
||||
float marginX = width * 0.015f, marginY = height * 0.01f;
|
||||
Utils.FONT_XLARGE.drawString(marginX, marginY, "Options", Color.white);
|
||||
Utils.FONT_DEFAULT.drawString(marginX, marginY + Utils.FONT_XLARGE.getLineHeight() * 0.92f,
|
||||
Fonts.XLARGE.drawString(marginX, marginY, "Options", Color.white);
|
||||
Fonts.DEFAULT.drawString(marginX, marginY + Fonts.XLARGE.getLineHeight() * 0.92f,
|
||||
"Change the way opsu! behaves", Color.white);
|
||||
|
||||
// game options
|
||||
@@ -255,9 +256,9 @@ public class OptionsMenu extends BasicGameState {
|
||||
String prompt = (keyEntryLeft) ?
|
||||
"Please press the new left-click key." :
|
||||
"Please press the new right-click key.";
|
||||
Utils.FONT_LARGE.drawString(
|
||||
(width / 2) - (Utils.FONT_LARGE.getWidth(prompt) / 2),
|
||||
(height / 2) - Utils.FONT_LARGE.getLineHeight(), prompt
|
||||
Fonts.LARGE.drawString(
|
||||
(width / 2) - (Fonts.LARGE.getWidth(prompt) / 2),
|
||||
(height / 2) - Fonts.LARGE.getLineHeight(), prompt
|
||||
);
|
||||
}
|
||||
|
||||
@@ -414,13 +415,13 @@ public class OptionsMenu extends BasicGameState {
|
||||
*/
|
||||
private void drawOption(GameOption option, int pos, boolean focus) {
|
||||
int width = container.getWidth();
|
||||
int textHeight = Utils.FONT_LARGE.getLineHeight();
|
||||
int textHeight = Fonts.LARGE.getLineHeight();
|
||||
float y = textY + (pos * offsetY);
|
||||
Color color = (focus) ? Color.cyan : Color.white;
|
||||
|
||||
Utils.FONT_LARGE.drawString(width / 30, y, option.getName(), color);
|
||||
Utils.FONT_LARGE.drawString(width / 2, y, option.getValueString(), color);
|
||||
Utils.FONT_SMALL.drawString(width / 30, y + textHeight, option.getDescription(), color);
|
||||
Fonts.LARGE.drawString(width / 30, y, option.getName(), color);
|
||||
Fonts.LARGE.drawString(width / 2, y, option.getValueString(), color);
|
||||
Fonts.SMALL.drawString(width / 30, y + textHeight, option.getDescription(), color);
|
||||
g.setColor(Colors.WHITE_ALPHA);
|
||||
g.drawLine(0, y + textHeight, width, y + textHeight);
|
||||
}
|
||||
@@ -434,7 +435,7 @@ public class OptionsMenu extends BasicGameState {
|
||||
if (y < textY || y > textY + (offsetY * maxOptionsScreen))
|
||||
return null;
|
||||
|
||||
int index = (y - textY + Utils.FONT_LARGE.getLineHeight()) / offsetY;
|
||||
int index = (y - textY + Fonts.LARGE.getLineHeight()) / offsetY;
|
||||
if (index >= currentTab.options.length)
|
||||
return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user