Minor UI tweaks (options menu background, clip overflows, etc.).

Background from: http://www.urwallpapers.com/streaks-of-light/

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-05-16 17:46:23 -04:00
parent f828349304
commit 436aa2bed9
6 changed files with 25 additions and 12 deletions

BIN
res/options-background.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

View File

@ -333,6 +333,14 @@ public enum GameImage {
return REPOSITORY.process_sub(img, w, h); return REPOSITORY.process_sub(img, w, h);
} }
}, },
OPTIONS_BG ("options-background", "png|jpg", false, true) {
@Override
protected Image process_sub(Image img, int w, int h) {
img.setAlpha(0.5f);
return img.getScaledCopy(w, h);
}
},
// TODO: ensure this image hasn't been modified (checksum?) // TODO: ensure this image hasn't been modified (checksum?)
ALPHA_MAP ("alpha", "png", false, false); ALPHA_MAP ("alpha", "png", false, false);

View File

@ -345,13 +345,15 @@ public class DownloadNode {
textX += img.getWidth() + buttonWidth * 0.001f; textX += img.getWidth() + buttonWidth * 0.001f;
// text // text
// TODO: if the title/artist line is too long, shorten it (e.g. add "...") // TODO: if the title/artist line is too long, shorten it (e.g. add "...") instead of just clipping
if (Options.useUnicodeMetadata()) // load glyphs if (Options.useUnicodeMetadata()) // load glyphs
Utils.loadGlyphs(Utils.FONT_BOLD, getTitle(), getArtist()); Utils.loadGlyphs(Utils.FONT_BOLD, getTitle(), getArtist());
g.setClip((int) textX, (int) (y + marginY), (int) (edgeX - textX - Utils.FONT_DEFAULT.getWidth(creator)), Utils.FONT_BOLD.getLineHeight());
Utils.FONT_BOLD.drawString( Utils.FONT_BOLD.drawString(
textX, y + marginY, textX, y + marginY,
String.format("%s - %s%s", getArtist(), getTitle(), String.format("%s - %s%s", getArtist(), getTitle(),
(dl != null) ? String.format(" [%s]", dl.getStatus().getName()) : ""), Color.white); (dl != null) ? String.format(" [%s]", dl.getStatus().getName()) : ""), Color.white);
g.clearClip();
Utils.FONT_DEFAULT.drawString( Utils.FONT_DEFAULT.drawString(
textX, y + marginY + Utils.FONT_BOLD.getLineHeight(), textX, y + marginY + Utils.FONT_BOLD.getLineHeight(),
String.format("Last updated: %s", date), Color.white); String.format("Last updated: %s", date), Color.white);

View File

@ -173,7 +173,7 @@ public class DownloadsMenu extends BasicGameState {
int width = container.getWidth(); int width = container.getWidth();
int height = container.getHeight(); int height = container.getHeight();
float baseX = width * 0.024f; float baseX = width * 0.024f;
float searchY = (height * 0.05f) + Utils.FONT_LARGE.getLineHeight(); float searchY = (height * 0.04f) + Utils.FONT_LARGE.getLineHeight();
float searchWidth = width * 0.3f; float searchWidth = width * 0.3f;
// search // search
@ -255,7 +255,7 @@ public class DownloadsMenu extends BasicGameState {
GameImage.SEARCH_BG.getImage().draw(); GameImage.SEARCH_BG.getImage().draw();
// title // title
Utils.FONT_LARGE.drawString(width * 0.024f, height * 0.04f, "Download Beatmaps!", Color.white); Utils.FONT_LARGE.drawString(width * 0.024f, height * 0.03f, "Download Beatmaps!", Color.white);
// search // search
g.setColor(Color.white); g.setColor(Color.white);

View File

@ -180,9 +180,9 @@ public class OptionsMenu extends BasicGameState {
// option tabs // option tabs
Image tabImage = GameImage.MENU_TAB.getImage(); Image tabImage = GameImage.MENU_TAB.getImage();
float tabX = (width / 50) + (tabImage.getWidth() / 2f); float tabX = width * 0.032f + Utils.FONT_DEFAULT.getWidth("Change the way opsu! behaves") + (tabImage.getWidth() / 2);
float tabY = Utils.FONT_LARGE.getLineHeight() + Utils.FONT_DEFAULT.getLineHeight() + float tabY = Utils.FONT_XLARGE.getLineHeight() + Utils.FONT_DEFAULT.getLineHeight() +
height * 0.03f + (tabImage.getHeight() / 2f); height * 0.015f - (tabImage.getHeight() / 2f);
int tabOffset = Math.min(tabImage.getWidth(), width / OptionTab.SIZE); int tabOffset = Math.min(tabImage.getWidth(), width / OptionTab.SIZE);
for (OptionTab tab : OptionTab.values()) for (OptionTab tab : OptionTab.values())
tab.button = new MenuButton(tabImage, tabX + (tab.ordinal() * tabOffset), tabY); tab.button = new MenuButton(tabImage, tabX + (tab.ordinal() * tabOffset), tabY);
@ -201,12 +201,16 @@ public class OptionsMenu extends BasicGameState {
int width = container.getWidth(); int width = container.getWidth();
int height = container.getHeight(); int height = container.getHeight();
int mouseX = input.getMouseX(), mouseY = input.getMouseY(); int mouseX = input.getMouseX(), mouseY = input.getMouseY();
float lineY = OptionTab.DISPLAY.button.getY() + (GameImage.MENU_TAB.getImage().getHeight() / 2f);
// title // title
float marginX = width * 0.02f, marginY = height * 0.015f; float marginX = width * 0.015f, marginY = height * 0.01f;
Utils.FONT_LARGE.drawString(marginX, marginY, "Game Options", Color.white); Utils.FONT_XLARGE.drawString(marginX, marginY, "Options", Color.white);
Utils.FONT_DEFAULT.drawString(marginX, marginY + Utils.FONT_LARGE.getLineHeight() * 0.92f, Utils.FONT_DEFAULT.drawString(marginX, marginY + Utils.FONT_XLARGE.getLineHeight() * 0.92f,
"Click or drag an option to change it.", Color.white); "Change the way opsu! behaves", Color.white);
// background
GameImage.OPTIONS_BG.getImage().draw(0, lineY);
// game options // game options
g.setLineWidth(1f); g.setLineWidth(1f);
@ -235,7 +239,6 @@ public class OptionsMenu extends BasicGameState {
currentTab.getName(), true, false); currentTab.getName(), true, false);
g.setColor(Color.white); g.setColor(Color.white);
g.setLineWidth(2f); g.setLineWidth(2f);
float lineY = OptionTab.DISPLAY.button.getY() + (GameImage.MENU_TAB.getImage().getHeight() / 2f);
g.drawLine(0, lineY, width, lineY); g.drawLine(0, lineY, width, lineY);
g.resetLineWidth(); g.resetLineWidth();

View File

@ -346,7 +346,7 @@ public class SongMenu extends BasicGameState {
marginX += 5; marginX += 5;
float headerTextY = marginY * 0.2f; float headerTextY = marginY * 0.2f;
Utils.FONT_LARGE.drawString(marginX + iconWidth * 1.05f, headerTextY, songInfo[0], Color.white); Utils.FONT_LARGE.drawString(marginX + iconWidth * 1.05f, headerTextY, songInfo[0], Color.white);
headerTextY += Utils.FONT_LARGE.getLineHeight() - 4; headerTextY += Utils.FONT_LARGE.getLineHeight() - 6;
Utils.FONT_DEFAULT.drawString(marginX + iconWidth * 1.05f, headerTextY, songInfo[1], Color.white); Utils.FONT_DEFAULT.drawString(marginX + iconWidth * 1.05f, headerTextY, songInfo[1], Color.white);
headerTextY += Utils.FONT_DEFAULT.getLineHeight() - 2; headerTextY += Utils.FONT_DEFAULT.getLineHeight() - 2;
float speedModifier = GameMod.getSpeedMultiplier(); float speedModifier = GameMod.getSpeedMultiplier();