Merge pull request #48 from fluddokt/omaster
More General scaling: fonts and hit error bar.
This commit is contained in:
commit
466312bc45
|
@ -602,31 +602,36 @@ public class GameData {
|
||||||
hitErrorAlpha = (HIT_ERROR_FADE_TIME - (trackPosition - hitErrorList.getFirst().time)) / (HIT_ERROR_FADE_TIME * 0.1f);
|
hitErrorAlpha = (HIT_ERROR_FADE_TIME - (trackPosition - hitErrorList.getFirst().time)) / (HIT_ERROR_FADE_TIME * 0.1f);
|
||||||
|
|
||||||
// draw bar
|
// draw bar
|
||||||
int hitErrorY = height - margin - 30, hitErrorX = width / 2;
|
float hitErrorY = height/GameImage.getUIscale() - margin - 10, hitErrorX = width/GameImage.getUIscale() / 2;
|
||||||
float oldAlphaBlack = Utils.COLOR_BLACK_ALPHA.a;
|
float oldAlphaBlack = Utils.COLOR_BLACK_ALPHA.a;
|
||||||
Utils.COLOR_BLACK_ALPHA.a = hitErrorAlpha;
|
Utils.COLOR_BLACK_ALPHA.a = hitErrorAlpha;
|
||||||
g.setColor(Utils.COLOR_BLACK_ALPHA);
|
g.setColor(Utils.COLOR_BLACK_ALPHA);
|
||||||
g.fillRect(hitErrorX - 3 - hitResultOffset[HIT_50],
|
g.fillRect((hitErrorX - 3 - hitResultOffset[HIT_50] ) * GameImage.getUIscale(),
|
||||||
hitErrorY - 10, hitResultOffset[HIT_50] * 2, 20);
|
(hitErrorY - 10 ) * GameImage.getUIscale(),
|
||||||
|
(hitResultOffset[HIT_50] * 2 ) * GameImage.getUIscale(), 20 * GameImage.getUIscale());
|
||||||
Utils.COLOR_BLACK_ALPHA.a = oldAlphaBlack;
|
Utils.COLOR_BLACK_ALPHA.a = oldAlphaBlack;
|
||||||
Utils.COLOR_LIGHT_ORANGE.a = hitErrorAlpha;
|
Utils.COLOR_LIGHT_ORANGE.a = hitErrorAlpha;
|
||||||
g.setColor(Utils.COLOR_LIGHT_ORANGE);
|
g.setColor(Utils.COLOR_LIGHT_ORANGE);
|
||||||
g.fillRect(hitErrorX - 3 - hitResultOffset[HIT_50],
|
g.fillRect((hitErrorX - 3 - hitResultOffset[HIT_50]) * GameImage.getUIscale(),
|
||||||
hitErrorY - 3, hitResultOffset[HIT_50] * 2, 6);
|
(hitErrorY - 3) * GameImage.getUIscale(),
|
||||||
|
(hitResultOffset[HIT_50] * 2) * GameImage.getUIscale(), 6 * GameImage.getUIscale());
|
||||||
Utils.COLOR_LIGHT_ORANGE.a = 1f;
|
Utils.COLOR_LIGHT_ORANGE.a = 1f;
|
||||||
Utils.COLOR_LIGHT_GREEN.a = hitErrorAlpha;
|
Utils.COLOR_LIGHT_GREEN.a = hitErrorAlpha;
|
||||||
g.setColor(Utils.COLOR_LIGHT_GREEN);
|
g.setColor(Utils.COLOR_LIGHT_GREEN);
|
||||||
g.fillRect(hitErrorX - 3 - hitResultOffset[HIT_100],
|
g.fillRect((hitErrorX - 3 - hitResultOffset[HIT_100]) * GameImage.getUIscale(),
|
||||||
hitErrorY - 3, hitResultOffset[HIT_100] * 2, 6);
|
(hitErrorY - 3) * GameImage.getUIscale(),
|
||||||
|
(hitResultOffset[HIT_100] * 2) * GameImage.getUIscale(), 6 * GameImage.getUIscale());
|
||||||
Utils.COLOR_LIGHT_GREEN.a = 1f;
|
Utils.COLOR_LIGHT_GREEN.a = 1f;
|
||||||
Utils.COLOR_LIGHT_BLUE.a = hitErrorAlpha;
|
Utils.COLOR_LIGHT_BLUE.a = hitErrorAlpha;
|
||||||
g.setColor(Utils.COLOR_LIGHT_BLUE);
|
g.setColor(Utils.COLOR_LIGHT_BLUE);
|
||||||
g.fillRect(hitErrorX - 3 - hitResultOffset[HIT_300],
|
g.fillRect((hitErrorX - 3 - hitResultOffset[HIT_300]) * GameImage.getUIscale(),
|
||||||
hitErrorY - 3, hitResultOffset[HIT_300] * 2, 6);
|
(hitErrorY - 3) * GameImage.getUIscale(),
|
||||||
|
(hitResultOffset[HIT_300] * 2) * GameImage.getUIscale(), 6 * GameImage.getUIscale());
|
||||||
Utils.COLOR_LIGHT_BLUE.a = 1f;
|
Utils.COLOR_LIGHT_BLUE.a = 1f;
|
||||||
white.a = hitErrorAlpha;
|
white.a = hitErrorAlpha;
|
||||||
g.setColor(white);
|
g.setColor(white);
|
||||||
g.fillRect(hitErrorX - 1.5f, hitErrorY - 10, 3, 20);
|
g.fillRect((hitErrorX - 1.5f) * GameImage.getUIscale(), (hitErrorY - 10) * GameImage.getUIscale(),
|
||||||
|
3 * GameImage.getUIscale(), 20 * GameImage.getUIscale());
|
||||||
|
|
||||||
// draw ticks
|
// draw ticks
|
||||||
for (HitErrorInfo info : hitErrorList) {
|
for (HitErrorInfo info : hitErrorList) {
|
||||||
|
@ -634,7 +639,9 @@ public class GameData {
|
||||||
float alpha = 1 - ((float) (trackPosition - time) / HIT_ERROR_FADE_TIME);
|
float alpha = 1 - ((float) (trackPosition - time) / HIT_ERROR_FADE_TIME);
|
||||||
white.a = alpha * hitErrorAlpha;
|
white.a = alpha * hitErrorAlpha;
|
||||||
g.setColor(white);
|
g.setColor(white);
|
||||||
g.fillRect(hitErrorX + info.timeDiff - 1, hitErrorY - 10, 2, 20);
|
g.fillRect((hitErrorX + info.timeDiff - 1) * GameImage.getUIscale(),
|
||||||
|
(hitErrorY - 10) * GameImage.getUIscale(),
|
||||||
|
2 * GameImage.getUIscale(), 20 * GameImage.getUIscale());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,16 +115,11 @@ public enum GameImage {
|
||||||
SLIDER_TICK ("sliderscorepoint", "png"),
|
SLIDER_TICK ("sliderscorepoint", "png"),
|
||||||
|
|
||||||
// Spinner
|
// Spinner
|
||||||
SPINNER_CIRCLE ("spinner-circle", "png") {
|
SPINNER_CIRCLE ("spinner-circle", "png"),
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return img.getScaledCopy(h * 9 / 10, h * 9 / 10);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
SPINNER_APPROACHCIRCLE ("spinner-approachcircle", "png") {
|
SPINNER_APPROACHCIRCLE ("spinner-approachcircle", "png") {
|
||||||
@Override
|
@Override
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
protected Image process_sub(Image img, int w, int h) {
|
||||||
return img.getScaledCopy(h * 9 / 10, h * 9 / 10);
|
return img.getScaledCopy(1.8f);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SPINNER_METRE ("spinner-metre", "png") {
|
SPINNER_METRE ("spinner-metre", "png") {
|
||||||
|
@ -139,7 +134,7 @@ public enum GameImage {
|
||||||
SPINNER_RPM ("spinner-rpm", "png") {
|
SPINNER_RPM ("spinner-rpm", "png") {
|
||||||
@Override
|
@Override
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
protected Image process_sub(Image img, int w, int h) {
|
||||||
return img.getScaledCopy((SCORE_0.getImage().getHeight() * 1.05f) / img.getHeight());
|
return img.getScaledCopy(0.8f);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -209,128 +204,28 @@ public enum GameImage {
|
||||||
LIGHTING1 ("lighting1", "png"),
|
LIGHTING1 ("lighting1", "png"),
|
||||||
|
|
||||||
// Game Mods
|
// Game Mods
|
||||||
MOD_EASY ("selection-mod-easy", "png", false, false) {
|
MOD_EASY ("selection-mod-easy", "png", false, false),
|
||||||
@Override
|
MOD_NO_FAIL ("selection-mod-nofail", "png", false, false),
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
MOD_HARD_ROCK ("selection-mod-hardrock", "png", false, false),
|
||||||
return img.getScaledCopy((h / 12f) / img.getHeight());
|
MOD_SUDDEN_DEATH ("selection-mod-suddendeath", "png", false, false),
|
||||||
}
|
MOD_SPUN_OUT ("selection-mod-spunout", "png", false, false),
|
||||||
},
|
MOD_AUTO ("selection-mod-autoplay", "png", false, false),
|
||||||
MOD_NO_FAIL ("selection-mod-nofail", "png", false, false) {
|
MOD_HALF_TIME ("selection-mod-halftime", "png", false, false),
|
||||||
@Override
|
MOD_DOUBLE_TIME ("selection-mod-doubletime", "png", false, false),
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
MOD_HIDDEN ("selection-mod-hidden", "png", false, false),
|
||||||
return MOD_EASY.process_sub(img, w, h);
|
MOD_FLASHLIGHT ("selection-mod-flashlight", "png", false, false),
|
||||||
}
|
MOD_RELAX ("selection-mod-relax", "png", false, false),
|
||||||
},
|
MOD_AUTOPILOT ("selection-mod-relax2", "png", false, false),
|
||||||
MOD_HARD_ROCK ("selection-mod-hardrock", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MOD_EASY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
MOD_SUDDEN_DEATH ("selection-mod-suddendeath", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MOD_EASY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
MOD_SPUN_OUT ("selection-mod-spunout", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MOD_EASY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
MOD_AUTO ("selection-mod-autoplay", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MOD_EASY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
MOD_HALF_TIME ("selection-mod-halftime", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MOD_EASY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
MOD_DOUBLE_TIME ("selection-mod-doubletime", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MOD_EASY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
MOD_HIDDEN ("selection-mod-hidden", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MOD_EASY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
MOD_FLASHLIGHT ("selection-mod-flashlight", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MOD_EASY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
MOD_RELAX ("selection-mod-relax", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MOD_EASY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
MOD_AUTOPILOT ("selection-mod-relax2", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MOD_EASY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// Selection Buttons
|
// Selection Buttons
|
||||||
SELECTION_MODS ("selection-mods", "png", false, false) {
|
SELECTION_MODS ("selection-mods", "png", false, false),
|
||||||
@Override
|
SELECTION_MODS_OVERLAY ("selection-mods-over", "png", false, false),
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
SELECTION_RANDOM ("selection-random", "png", false, false),
|
||||||
return img.getScaledCopy((h * 0.115f) / img.getHeight());
|
SELECTION_RANDOM_OVERLAY ("selection-random-over", "png", false, false),
|
||||||
}
|
SELECTION_OPTIONS ("selection-options", "png", false, false),
|
||||||
},
|
SELECTION_OPTIONS_OVERLAY ("selection-options-over", "png", false, false),
|
||||||
SELECTION_MODS_OVERLAY ("selection-mods-over", "png", false, false) {
|
SELECTION_OTHER_OPTIONS ("selection-selectoptions", "png", false, false),
|
||||||
@Override
|
SELECTION_OTHER_OPTIONS_OVERLAY ("selection-selectoptions-over", "png", false, false),
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return SELECTION_MODS.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
SELECTION_RANDOM ("selection-random", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return SELECTION_MODS.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
SELECTION_RANDOM_OVERLAY ("selection-random-over", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return SELECTION_MODS.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
SELECTION_OPTIONS ("selection-options", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return SELECTION_MODS.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
SELECTION_OPTIONS_OVERLAY ("selection-options-over", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return SELECTION_MODS.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
SELECTION_OTHER_OPTIONS ("selection-selectoptions", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return SELECTION_MODS.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
SELECTION_OTHER_OPTIONS_OVERLAY ("selection-selectoptions-over", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return SELECTION_MODS.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// Non-Game Components
|
// Non-Game Components
|
||||||
VOLUME ("volume-bg", "png", false, false) {
|
VOLUME ("volume-bg", "png", false, false) {
|
||||||
|
@ -371,19 +266,19 @@ public enum GameImage {
|
||||||
MENU_LOGO ("logo", "png", false, true) {
|
MENU_LOGO ("logo", "png", false, true) {
|
||||||
@Override
|
@Override
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
protected Image process_sub(Image img, int w, int h) {
|
||||||
return img.getScaledCopy((h / 1.2f) / img.getHeight());
|
return img.getScaledCopy(0.8f);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MENU_PlAY ("menu-play", "png", false, false) {
|
MENU_PlAY ("menu-play", "png", false, false) {
|
||||||
@Override
|
@Override
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
protected Image process_sub(Image img, int w, int h) {
|
||||||
return img.getScaledCopy(MENU_LOGO.getImage().getWidth() * 0.83f / img.getWidth());
|
return img.getScaledCopy(0.8f);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MENU_EXIT ("menu-exit", "png", false, false) {
|
MENU_EXIT ("menu-exit", "png", false, false) {
|
||||||
@Override
|
@Override
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
protected Image process_sub(Image img, int w, int h) {
|
||||||
return img.getScaledCopy(MENU_LOGO.getImage().getWidth() * 0.66f / img.getWidth());
|
return img.getScaledCopy(0.8f);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MENU_BUTTON_MID ("button-middle", "png", false, false),
|
MENU_BUTTON_MID ("button-middle", "png", false, false),
|
||||||
|
@ -391,30 +286,10 @@ public enum GameImage {
|
||||||
MENU_BUTTON_RIGHT ("button-right", "png", false, false),
|
MENU_BUTTON_RIGHT ("button-right", "png", false, false),
|
||||||
|
|
||||||
// Music Player Buttons
|
// Music Player Buttons
|
||||||
MUSIC_PLAY ("music-play", "png", false, false) {
|
MUSIC_PLAY ("music-play", "png", false, false),
|
||||||
@Override
|
MUSIC_PAUSE ("music-pause", "png", false, false),
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
MUSIC_NEXT ("music-next", "png", false, false),
|
||||||
return img.getScaledCopy((h / 18f) / img.getHeight());
|
MUSIC_PREVIOUS ("music-previous", "png", false, false),
|
||||||
}
|
|
||||||
},
|
|
||||||
MUSIC_PAUSE ("music-pause", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MUSIC_PLAY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
MUSIC_NEXT ("music-next", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MUSIC_PLAY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
MUSIC_PREVIOUS ("music-previous", "png", false, false) {
|
|
||||||
@Override
|
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
|
||||||
return MUSIC_PLAY.process_sub(img, w, h);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
DOWNLOADS ("downloads", "png", false, false) {
|
DOWNLOADS ("downloads", "png", false, false) {
|
||||||
@Override
|
@Override
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
protected Image process_sub(Image img, int w, int h) {
|
||||||
|
|
|
@ -140,16 +140,10 @@ public class Utils {
|
||||||
container.setAlwaysRender(true);
|
container.setAlwaysRender(true);
|
||||||
container.setUpdateOnlyWhenVisible(false);
|
container.setUpdateOnlyWhenVisible(false);
|
||||||
|
|
||||||
|
GameImage.init(width, height);
|
||||||
|
|
||||||
// create fonts
|
// create fonts
|
||||||
float fontBase;
|
float fontBase = 12f * GameImage.getUIscale();
|
||||||
if (height <= 600)
|
|
||||||
fontBase = 10f;
|
|
||||||
else if (height < 800)
|
|
||||||
fontBase = 11f;
|
|
||||||
else if (height <= 900)
|
|
||||||
fontBase = 13f;
|
|
||||||
else
|
|
||||||
fontBase = 15f;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Font javaFont = Font.createFont(Font.TRUETYPE_FONT, ResourceLoader.getResourceAsStream(Options.FONT_NAME));
|
Font javaFont = Font.createFont(Font.TRUETYPE_FONT, ResourceLoader.getResourceAsStream(Options.FONT_NAME));
|
||||||
|
@ -172,7 +166,6 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize game images
|
// initialize game images
|
||||||
GameImage.init(width, height);
|
|
||||||
for (GameImage img : GameImage.values()) {
|
for (GameImage img : GameImage.values()) {
|
||||||
if (img.isPreload())
|
if (img.isPreload())
|
||||||
img.setDefaultImage();
|
img.setDefaultImage();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user