Follow-ups to #21.
- Reverted "Extends ScoresData bg to clock", as this was intended behavior. - Fixed overlapping text in the options menu, and made it look more similar to the other menus. - Fixed issues with the text and icon in the song menu header in certain resolutions. - Fixed minor issue with ranking screen header text positioning. - Decreased skip button hover scale. - Some code style changes. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
f2ac160dfa
commit
1a4120a736
|
@ -456,8 +456,9 @@ public class GameData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws a string of scoreSymbols.
|
* Draws a string of scoreSymbols of fixed width.
|
||||||
* @param str the string to draw
|
* @param str the string to draw
|
||||||
* @param x the starting x coordinate
|
* @param x the starting x coordinate
|
||||||
* @param y the y coordinate
|
* @param y the y coordinate
|
||||||
|
@ -474,14 +475,14 @@ public class GameData {
|
||||||
if (scale != 1.0f)
|
if (scale != 1.0f)
|
||||||
digit = digit.getScaledCopy(scale);
|
digit = digit.getScaledCopy(scale);
|
||||||
cx -= fixedsize;
|
cx -= fixedsize;
|
||||||
digit.draw(cx + (fixedsize-digit.getWidth())/2, y);
|
digit.draw(cx + (fixedsize - digit.getWidth()) / 2, y);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < c.length; i++) {
|
for (int i = 0; i < c.length; i++) {
|
||||||
Image digit = getScoreSymbolImage(c[i]);
|
Image digit = getScoreSymbolImage(c[i]);
|
||||||
if (scale != 1.0f)
|
if (scale != 1.0f)
|
||||||
digit = digit.getScaledCopy(scale);
|
digit = digit.getScaledCopy(scale);
|
||||||
digit.draw(cx + (fixedsize-digit.getWidth())/2, y);
|
digit.draw(cx + (fixedsize - digit.getWidth()) / 2, y);
|
||||||
cx += fixedsize;
|
cx += fixedsize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -495,12 +496,13 @@ public class GameData {
|
||||||
* @param breakPeriod if true, will not draw scorebar and combo elements, and will draw grade
|
* @param breakPeriod if true, will not draw scorebar and combo elements, and will draw grade
|
||||||
* @param firstObject true if the first hit object's start time has not yet passed
|
* @param firstObject true if the first hit object's start time has not yet passed
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void drawGameElements(Graphics g, boolean breakPeriod, boolean firstObject) {
|
public void drawGameElements(Graphics g, boolean breakPeriod, boolean firstObject) {
|
||||||
int marginX = (int) (width * 0.008f);
|
int marginX = (int) (width * 0.008f);
|
||||||
|
|
||||||
// score
|
// score
|
||||||
drawFixedSizeSymbolString((scoreDisplay < 100000000) ? String.format("%08d", scoreDisplay) : Long.toString(scoreDisplay),
|
drawFixedSizeSymbolString((scoreDisplay < 100000000) ? String.format("%08d", scoreDisplay) : Long.toString(scoreDisplay),
|
||||||
width - marginX, 0, 1.0f, getScoreSymbolImage('0').getWidth()-2, true);
|
width - marginX, 0, 1.0f, getScoreSymbolImage('0').getWidth() - 2, true);
|
||||||
|
|
||||||
// score percentage
|
// score percentage
|
||||||
int symbolHeight = getScoreSymbolImage('0').getHeight();
|
int symbolHeight = getScoreSymbolImage('0').getHeight();
|
||||||
|
@ -564,14 +566,13 @@ public class GameData {
|
||||||
}
|
}
|
||||||
Image scorebar = GameImage.SCOREBAR_BG.getImage();
|
Image scorebar = GameImage.SCOREBAR_BG.getImage();
|
||||||
Image colour;
|
Image colour;
|
||||||
if (scorebarColour != null){
|
if (scorebarColour != null) {
|
||||||
scorebarColour.updateNoDraw(); //TODO deprecated method
|
scorebarColour.updateNoDraw(); // TODO deprecated method
|
||||||
colour = scorebarColour.getCurrentFrame();
|
colour = scorebarColour.getCurrentFrame();
|
||||||
} else {
|
} else
|
||||||
colour = GameImage.SCOREBAR_COLOUR.getImage();
|
colour = GameImage.SCOREBAR_COLOUR.getImage();
|
||||||
}
|
float colourX = 4 * GameImage.getUIscale(), colourY = 15 * GameImage.getUIscale();
|
||||||
float colourX = 4 * GameImage.uiscale, colourY = 15 * GameImage.uiscale;
|
Image colourCropped = colour.getSubImage(0, 0, (int) (645 * GameImage.getUIscale() * healthRatio), colour.getHeight());
|
||||||
Image colourCropped = colour.getSubImage(0, 0, (int) (645 * GameImage.uiscale * healthRatio), colour.getHeight());
|
|
||||||
|
|
||||||
scorebar.setAlpha(1f);
|
scorebar.setAlpha(1f);
|
||||||
scorebar.draw(0, 0);
|
scorebar.draw(0, 0);
|
||||||
|
@ -655,28 +656,20 @@ public class GameData {
|
||||||
* @param osu the OsuFile
|
* @param osu the OsuFile
|
||||||
*/
|
*/
|
||||||
public void drawRankingElements(Graphics g, OsuFile osu) {
|
public void drawRankingElements(Graphics g, OsuFile osu) {
|
||||||
|
// TODO Version 2 skins
|
||||||
float marginX = width * 0.01f, marginY = height * 0.025f;
|
|
||||||
// header & "Ranking" text
|
|
||||||
Image rankingTitle = GameImage.RANKING_TITLE.getImage();
|
|
||||||
// ranking panel
|
|
||||||
Image rankingPanel = GameImage.RANKING_PANEL.getImage();
|
|
||||||
|
|
||||||
|
|
||||||
//TODO Version 2 skins
|
|
||||||
float rankingHeight = 75;
|
float rankingHeight = 75;
|
||||||
|
|
||||||
rankingPanel.draw(0, (int) (rankingHeight * GameImage.uiscale));
|
|
||||||
|
|
||||||
float scoreTextScale = 1.0f;
|
float scoreTextScale = 1.0f;
|
||||||
float symbolTextScale = 1.15f;
|
float symbolTextScale = 1.15f;
|
||||||
float rankResultScale = 0.5f;
|
float rankResultScale = 0.5f;
|
||||||
|
|
||||||
|
// ranking panel
|
||||||
|
GameImage.RANKING_PANEL.getImage().draw(0, (int) (rankingHeight * GameImage.getUIscale()));
|
||||||
|
|
||||||
// score
|
// score
|
||||||
drawFixedSizeSymbolString(
|
drawFixedSizeSymbolString(
|
||||||
(score < 100000000) ? String.format("%08d", score) : Long.toString(score),
|
(score < 100000000) ? String.format("%08d", score) : Long.toString(score),
|
||||||
(int) (210 * GameImage.uiscale),
|
(int) (210 * GameImage.getUIscale()),
|
||||||
(int) ((rankingHeight + 50) * GameImage.uiscale),
|
(int) ((rankingHeight + 50) * GameImage.getUIscale()),
|
||||||
scoreTextScale,
|
scoreTextScale,
|
||||||
getScoreSymbolImage('0').getWidth() * scoreTextScale - 2, false);
|
getScoreSymbolImage('0').getWidth() * scoreTextScale - 2, false);
|
||||||
|
|
||||||
|
@ -684,7 +677,7 @@ public class GameData {
|
||||||
float resultInitialX = 130;
|
float resultInitialX = 130;
|
||||||
float resultInitialY = rankingHeight + 140;
|
float resultInitialY = rankingHeight + 140;
|
||||||
float resultHitInitialX = 65;
|
float resultHitInitialX = 65;
|
||||||
float resultHitInitialY = rankingHeight + 182 ;
|
float resultHitInitialY = rankingHeight + 182;
|
||||||
float resultOffsetX = 320;
|
float resultOffsetX = 320;
|
||||||
float resultOffsetY = 96;
|
float resultOffsetY = 96;
|
||||||
|
|
||||||
|
@ -697,42 +690,37 @@ public class GameData {
|
||||||
|
|
||||||
for (int i = 0; i < rankDrawOrder.length; i += 2) {
|
for (int i = 0; i < rankDrawOrder.length; i += 2) {
|
||||||
hitResults[rankDrawOrder[i]].getScaledCopy(rankResultScale).drawCentered(
|
hitResults[rankDrawOrder[i]].getScaledCopy(rankResultScale).drawCentered(
|
||||||
(resultHitInitialX * GameImage.uiscale),
|
(resultHitInitialX * GameImage.getUIscale()),
|
||||||
((resultHitInitialY + (resultOffsetY * (i / 2))) * GameImage.uiscale)
|
((resultHitInitialY + (resultOffsetY * (i / 2))) * GameImage.getUIscale()));
|
||||||
);
|
|
||||||
hitResults[rankDrawOrder[i+1]].getScaledCopy(rankResultScale).drawCentered(
|
hitResults[rankDrawOrder[i+1]].getScaledCopy(rankResultScale).drawCentered(
|
||||||
((resultHitInitialX + resultOffsetX) * GameImage.uiscale),
|
((resultHitInitialX + resultOffsetX) * GameImage.getUIscale()),
|
||||||
((resultHitInitialY + (resultOffsetY * (i / 2))) * GameImage.uiscale)
|
((resultHitInitialY + (resultOffsetY * (i / 2))) * GameImage.getUIscale()));
|
||||||
);
|
|
||||||
drawSymbolString(String.format("%dx", rankResultOrder[i]),
|
drawSymbolString(String.format("%dx", rankResultOrder[i]),
|
||||||
(int) (resultInitialX * GameImage.uiscale),
|
(int) (resultInitialX * GameImage.getUIscale()),
|
||||||
(int) ((resultInitialY + (resultOffsetY * (i / 2))) * GameImage.uiscale),
|
(int) ((resultInitialY + (resultOffsetY * (i / 2))) * GameImage.getUIscale()),
|
||||||
symbolTextScale, false);
|
symbolTextScale, false);
|
||||||
drawSymbolString(String.format("%dx", rankResultOrder[i+1]),
|
drawSymbolString(String.format("%dx", rankResultOrder[i+1]),
|
||||||
(int) ((resultInitialX + resultOffsetX) * GameImage.uiscale),
|
(int) ((resultInitialX + resultOffsetX) * GameImage.getUIscale()),
|
||||||
(int) ((resultInitialY + (resultOffsetY * (i / 2))) * GameImage.uiscale),
|
(int) ((resultInitialY + (resultOffsetY * (i / 2))) * GameImage.getUIscale()),
|
||||||
symbolTextScale, false);
|
symbolTextScale, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// combo and accuracy
|
// combo and accuracy
|
||||||
Image rankingMaxCombo = GameImage.RANKING_MAXCOMBO.getImage();
|
|
||||||
Image rankingAccuracy = GameImage.RANKING_ACCURACY.getImage();
|
|
||||||
float accuracyX = 295;
|
float accuracyX = 295;
|
||||||
float textY = rankingHeight + 425;
|
float textY = rankingHeight + 425;
|
||||||
float numbersY = textY + 30;
|
float numbersY = textY + 30;
|
||||||
drawSymbolString(String.format("%dx", comboMax),
|
drawSymbolString(String.format("%dx", comboMax),
|
||||||
(int) (25 * GameImage.uiscale),
|
(int) (25 * GameImage.getUIscale()),
|
||||||
(int) (numbersY * GameImage.uiscale), symbolTextScale, false);
|
(int) (numbersY * GameImage.getUIscale()), symbolTextScale, false);
|
||||||
drawSymbolString(String.format("%02.2f%%", getScorePercent()),
|
drawSymbolString(String.format("%02.2f%%", getScorePercent()),
|
||||||
(int) ((accuracyX + 20) * GameImage.uiscale),
|
(int) ((accuracyX + 20) * GameImage.getUIscale()),
|
||||||
(int) (numbersY * GameImage.uiscale), symbolTextScale, false);
|
(int) (numbersY * GameImage.getUIscale()), symbolTextScale, false);
|
||||||
rankingMaxCombo.draw(
|
GameImage.RANKING_MAXCOMBO.getImage().draw(
|
||||||
(int) (10 * GameImage.uiscale),
|
(int) (10 * GameImage.getUIscale()),
|
||||||
(int) (textY * GameImage.uiscale));
|
(int) (textY * GameImage.getUIscale()));
|
||||||
rankingAccuracy.draw(
|
GameImage.RANKING_ACCURACY.getImage().draw(
|
||||||
(int) (accuracyX * GameImage.uiscale),
|
(int) (accuracyX * GameImage.getUIscale()),
|
||||||
(int) (textY * GameImage.uiscale));
|
(int) (textY * GameImage.getUIscale()));
|
||||||
|
|
||||||
|
|
||||||
// full combo
|
// full combo
|
||||||
if (comboMax == fullObjectCount) {
|
if (comboMax == fullObjectCount) {
|
||||||
|
@ -741,24 +729,26 @@ public class GameData {
|
||||||
(height * 0.99f) - GameImage.RANKING_PERFECT.getImage().getHeight()
|
(height * 0.99f) - GameImage.RANKING_PERFECT.getImage().getHeight()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// grade
|
// grade
|
||||||
Grade grade = getGrade();
|
Grade grade = getGrade();
|
||||||
if (grade != Grade.NULL)
|
if (grade != Grade.NULL)
|
||||||
grade.getLargeImage().draw(width-grade.getLargeImage().getWidth(), rankingHeight);
|
grade.getLargeImage().draw(width - grade.getLargeImage().getWidth(), rankingHeight);
|
||||||
|
|
||||||
//Header
|
// header
|
||||||
|
Image rankingTitle = GameImage.RANKING_TITLE.getImage();
|
||||||
g.setColor(Utils.COLOR_BLACK_ALPHA);
|
g.setColor(Utils.COLOR_BLACK_ALPHA);
|
||||||
g.fillRect(0, 0, width, 100 * GameImage.uiscale);
|
g.fillRect(0, 0, width, 100 * GameImage.getUIscale());
|
||||||
rankingTitle.draw((width * 0.97f) - rankingTitle.getWidth(), 0);
|
rankingTitle.draw((width * 0.97f) - rankingTitle.getWidth(), 0);
|
||||||
Utils.FONT_LARGE.drawString(marginX, marginY,
|
float c = width * 0.01f;
|
||||||
|
Utils.FONT_LARGE.drawString(c, c,
|
||||||
String.format("%s - %s [%s]", osu.getArtist(), osu.getTitle(), osu.version), Color.white);
|
String.format("%s - %s [%s]", osu.getArtist(), osu.getTitle(), osu.version), Color.white);
|
||||||
Utils.FONT_MEDIUM.drawString(marginX, marginY + Utils.FONT_LARGE.getLineHeight() - 6,
|
Utils.FONT_MEDIUM.drawString(c, c + Utils.FONT_LARGE.getLineHeight() - 6,
|
||||||
String.format("Beatmap by %s", osu.creator), Color.white);
|
String.format("Beatmap by %s", osu.creator), Color.white);
|
||||||
Utils.FONT_MEDIUM.drawString(
|
Utils.FONT_MEDIUM.drawString(
|
||||||
marginX, marginY + Utils.FONT_LARGE.getLineHeight() + Utils.FONT_MEDIUM.getLineHeight() - 10,
|
c, c + Utils.FONT_LARGE.getLineHeight() + Utils.FONT_MEDIUM.getLineHeight() - 10,
|
||||||
String.format("Played on %s.", scoreData.getTimeString()), Color.white);
|
String.format("Played on %s.", scoreData.getTimeString()), Color.white);
|
||||||
|
|
||||||
|
|
||||||
// mod icons
|
// mod icons
|
||||||
int modWidth = GameMod.AUTO.getImage().getWidth();
|
int modWidth = GameMod.AUTO.getImage().getWidth();
|
||||||
float modX = (width * 0.98f) - modWidth;
|
float modX = (width * 0.98f) - modWidth;
|
||||||
|
|
|
@ -41,7 +41,7 @@ public enum GameImage {
|
||||||
SECTION_PASS ("section-pass", "png"),
|
SECTION_PASS ("section-pass", "png"),
|
||||||
SECTION_FAIL ("section-fail", "png"),
|
SECTION_FAIL ("section-fail", "png"),
|
||||||
WARNINGARROW ("play-warningarrow", "png"),
|
WARNINGARROW ("play-warningarrow", "png"),
|
||||||
SKIP ("play-skip", "play-skip-%d","png"),
|
SKIP ("play-skip", "play-skip-%d", "png"),
|
||||||
COUNTDOWN_READY ("ready", "png") {
|
COUNTDOWN_READY ("ready", "png") {
|
||||||
@Override
|
@Override
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
protected Image process_sub(Image img, int w, int h) {
|
||||||
|
@ -51,19 +51,19 @@ public enum GameImage {
|
||||||
COUNTDOWN_3 ("count3", "png") {
|
COUNTDOWN_3 ("count3", "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 / 3f) / img.getHeight());
|
return COUNTDOWN_READY.process_sub(img, w, h);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
COUNTDOWN_2 ("count2", "png") {
|
COUNTDOWN_2 ("count2", "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 / 3f) / img.getHeight());
|
return COUNTDOWN_READY.process_sub(img, w, h);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
COUNTDOWN_1 ("count1", "png") {
|
COUNTDOWN_1 ("count1", "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 / 3f) / img.getHeight());
|
return COUNTDOWN_READY.process_sub(img, w, h);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
COUNTDOWN_GO ("go", "png") {
|
COUNTDOWN_GO ("go", "png") {
|
||||||
|
@ -135,7 +135,7 @@ public enum GameImage {
|
||||||
SPINNER_CLEAR ("spinner-clear", "png"),
|
SPINNER_CLEAR ("spinner-clear", "png"),
|
||||||
SPINNER_OSU ("spinner-osu", "png"),
|
SPINNER_OSU ("spinner-osu", "png"),
|
||||||
|
|
||||||
// Score Data
|
// Game Data
|
||||||
COMBO_BURST ("comboburst", "comboburst-%d", "png"),
|
COMBO_BURST ("comboburst", "comboburst-%d", "png"),
|
||||||
SCOREBAR_BG ("scorebar-bg", "png"),
|
SCOREBAR_BG ("scorebar-bg", "png"),
|
||||||
SCOREBAR_COLOUR ("scorebar-colour", "scorebar-colour-%d", "png"),
|
SCOREBAR_COLOUR ("scorebar-colour", "scorebar-colour-%d", "png"),
|
||||||
|
@ -331,7 +331,7 @@ public enum GameImage {
|
||||||
return img.getScaledCopy((h * 0.3f) / img.getHeight());
|
return img.getScaledCopy((h * 0.3f) / img.getHeight());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MENU_BACK ("menu-back", "menu-back-%d","png"),
|
MENU_BACK ("menu-back", "menu-back-%d", "png"),
|
||||||
MENU_BUTTON_BG ("menu-button-background", "png", false, false),
|
MENU_BUTTON_BG ("menu-button-background", "png", false, false),
|
||||||
MENU_TAB ("selection-tab", "png", false, false) {
|
MENU_TAB ("selection-tab", "png", false, false) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -342,14 +342,14 @@ public enum GameImage {
|
||||||
MENU_MUSICNOTE ("music-note", "png", false, false) {
|
MENU_MUSICNOTE ("music-note", "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) {
|
||||||
int r = (int) (Utils.FONT_LARGE.getLineHeight() * 0.75f + Utils.FONT_DEFAULT.getLineHeight());
|
int r = (int) ((Utils.FONT_LARGE.getLineHeight() + Utils.FONT_DEFAULT.getLineHeight() - 8) / getUIscale());
|
||||||
return img.getScaledCopy(r, r);
|
return img.getScaledCopy(r, r);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MENU_LOADER ("loader", "png", false, false) {
|
MENU_LOADER ("loader", "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) {
|
||||||
int r = (int) (Utils.FONT_LARGE.getLineHeight() * 0.75f + Utils.FONT_DEFAULT.getLineHeight());
|
int r = (int) ((Utils.FONT_LARGE.getLineHeight() + Utils.FONT_DEFAULT.getLineHeight() - 8) / getUIscale());
|
||||||
return img.getScaledCopy(r / 48f);
|
return img.getScaledCopy(r / 48f);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -480,8 +480,11 @@ public enum GameImage {
|
||||||
/** Container dimensions. */
|
/** Container dimensions. */
|
||||||
private static int containerWidth, containerHeight;
|
private static int containerWidth, containerHeight;
|
||||||
|
|
||||||
/** value ui should be scaled by */
|
/** Value to scale UI components by. */
|
||||||
public static float uiscale;
|
private static float uiscale;
|
||||||
|
|
||||||
|
/** The unscaled container height that uiscale is based on. */
|
||||||
|
private static final int UNSCALED_HEIGHT = 768;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the GameImage class with container dimensions.
|
* Initializes the GameImage class with container dimensions.
|
||||||
|
@ -491,9 +494,14 @@ public enum GameImage {
|
||||||
public static void init(int width, int height) {
|
public static void init(int width, int height) {
|
||||||
containerWidth = width;
|
containerWidth = width;
|
||||||
containerHeight = height;
|
containerHeight = height;
|
||||||
uiscale = containerHeight / 768f;
|
uiscale = (float) containerHeight / UNSCALED_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the UI scale.
|
||||||
|
*/
|
||||||
|
public static float getUIscale() { return uiscale; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears all image references.
|
* Clears all image references.
|
||||||
* This does NOT destroy images, so be careful of memory leaks!
|
* This does NOT destroy images, so be careful of memory leaks!
|
||||||
|
@ -592,12 +600,13 @@ public enum GameImage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an Animation based on the image array.
|
* Returns an Animation based on the image array.
|
||||||
* If no image array exist, returns the single image as an animation.
|
* If no image array exists, returns the single image as an animation.
|
||||||
|
* @param duration the duration to show each frame in the animation
|
||||||
*/
|
*/
|
||||||
public Animation getAnimation(int duration){
|
public Animation getAnimation(int duration){
|
||||||
Image[] images = getImages();
|
Image[] images = getImages();
|
||||||
if (images == null)
|
if (images == null)
|
||||||
images = new Image[]{ getImage() };
|
images = new Image[] { getImage() };
|
||||||
return new Animation(images, duration);
|
return new Animation(images, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,14 +822,14 @@ public enum GameImage {
|
||||||
* Performs individual post-loading actions on the image.
|
* Performs individual post-loading actions on the image.
|
||||||
*/
|
*/
|
||||||
private void process() {
|
private void process() {
|
||||||
int fakeWid = 768*containerWidth/containerHeight;
|
int unscaledWidth = UNSCALED_HEIGHT * containerWidth / containerHeight;
|
||||||
if (skinImages != null) {
|
if (skinImages != null) {
|
||||||
for (int i = 0; i < skinImages.length; i++)
|
for (int i = 0; i < skinImages.length; i++)
|
||||||
setImage(process_sub(getImages()[i], fakeWid, 768).getScaledCopy(uiscale), i);
|
setImage(process_sub(getImages()[i], unscaledWidth, UNSCALED_HEIGHT).getScaledCopy(getUIscale()), i);
|
||||||
} else if (defaultImages != null && skinImage == null) {
|
} else if (defaultImages != null && skinImage == null) {
|
||||||
for (int i = 0; i < defaultImages.length; i++)
|
for (int i = 0; i < defaultImages.length; i++)
|
||||||
setImage(process_sub(getImages()[i], fakeWid, 768).getScaledCopy(uiscale), i);
|
setImage(process_sub(getImages()[i], unscaledWidth, UNSCALED_HEIGHT).getScaledCopy(getUIscale()), i);
|
||||||
} else
|
} else
|
||||||
setImage(process_sub(getImage(), fakeWid, 768).getScaledCopy(uiscale));
|
setImage(process_sub(getImage(), unscaledWidth, UNSCALED_HEIGHT).getScaledCopy(getUIscale()));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -365,24 +365,24 @@ public class MenuButton {
|
||||||
* and expansion direction.
|
* and expansion direction.
|
||||||
*/
|
*/
|
||||||
private void setHoverRadius() {
|
private void setHoverRadius() {
|
||||||
int xOffset = 0, yOffset = 0;
|
if (img == null)
|
||||||
if(img != null){
|
return;
|
||||||
if (dir != Expand.CENTER) {
|
|
||||||
// offset by difference between normal/scaled image dimensions
|
|
||||||
xOffset = (int) ((scale - 1f) * img.getWidth());
|
|
||||||
yOffset = (int) ((scale - 1f) * img.getHeight());
|
|
||||||
if (dir == Expand.UP || dir == Expand.DOWN)
|
|
||||||
xOffset = 0; // no horizontal offset
|
|
||||||
if (dir == Expand.RIGHT || dir == Expand.LEFT)
|
|
||||||
yOffset = 0; // no vertical offset
|
|
||||||
if (dir == Expand.RIGHT || dir == Expand.DOWN_RIGHT || dir == Expand.UP_RIGHT)
|
|
||||||
xOffset *= -1; // flip x for right
|
|
||||||
if (dir == Expand.DOWN || dir == Expand.DOWN_LEFT || dir == Expand.DOWN_RIGHT)
|
|
||||||
yOffset *= -1; // flip y for down
|
|
||||||
}
|
|
||||||
this.xRadius = ((img.getWidth() * scale) + xOffset) / 2f;
|
|
||||||
this.yRadius = ((img.getHeight() * scale) + yOffset) / 2f;
|
|
||||||
|
|
||||||
|
int xOffset = 0, yOffset = 0;
|
||||||
|
if (dir != Expand.CENTER) {
|
||||||
|
// offset by difference between normal/scaled image dimensions
|
||||||
|
xOffset = (int) ((scale - 1f) * img.getWidth());
|
||||||
|
yOffset = (int) ((scale - 1f) * img.getHeight());
|
||||||
|
if (dir == Expand.UP || dir == Expand.DOWN)
|
||||||
|
xOffset = 0; // no horizontal offset
|
||||||
|
if (dir == Expand.RIGHT || dir == Expand.LEFT)
|
||||||
|
yOffset = 0; // no vertical offset
|
||||||
|
if (dir == Expand.RIGHT || dir == Expand.DOWN_RIGHT || dir == Expand.UP_RIGHT)
|
||||||
|
xOffset *= -1; // flip x for right
|
||||||
|
if (dir == Expand.DOWN || dir == Expand.DOWN_LEFT || dir == Expand.DOWN_RIGHT)
|
||||||
|
yOffset *= -1; // flip y for down
|
||||||
}
|
}
|
||||||
|
this.xRadius = ((img.getWidth() * scale) + xOffset) / 2f;
|
||||||
|
this.yRadius = ((img.getHeight() * scale) + yOffset) / 2f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,13 +61,13 @@ public class OsuGroupNode {
|
||||||
*/
|
*/
|
||||||
public void draw(float x, float y, float headerY, float footerY, Grade grade, boolean focus) {
|
public void draw(float x, float y, float headerY, float footerY, Grade grade, boolean focus) {
|
||||||
boolean expanded = (osuFileIndex > -1);
|
boolean expanded = (osuFileIndex > -1);
|
||||||
float xOffset = 0f;
|
|
||||||
OsuFile osu;
|
OsuFile osu;
|
||||||
Image bg = GameImage.MENU_BUTTON_BG.getImage();
|
Image bg = GameImage.MENU_BUTTON_BG.getImage();
|
||||||
bg.setAlpha(0.9f);
|
bg.setAlpha(0.9f);
|
||||||
Color bgColor;
|
Color bgColor;
|
||||||
Color textColor = Color.lightGray;
|
Color textColor = Color.lightGray;
|
||||||
|
|
||||||
|
// get drawing parameters
|
||||||
if (expanded) { // expanded
|
if (expanded) { // expanded
|
||||||
x -= bg.getWidth() / 10f;
|
x -= bg.getWidth() / 10f;
|
||||||
if (focus) {
|
if (focus) {
|
||||||
|
@ -80,6 +80,7 @@ public class OsuGroupNode {
|
||||||
bgColor = Utils.COLOR_ORANGE_BUTTON;
|
bgColor = Utils.COLOR_ORANGE_BUTTON;
|
||||||
osu = osuFiles.get(0);
|
osu = osuFiles.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// crop image if necessary
|
// crop image if necessary
|
||||||
if (y < headerY) {
|
if (y < headerY) {
|
||||||
int cropHeight = (int) (headerY - y);
|
int cropHeight = (int) (headerY - y);
|
||||||
|
|
|
@ -298,10 +298,7 @@ public class OsuHitObject {
|
||||||
public boolean isNewCombo() { return (type & TYPE_NEWCOMBO) > 0; }
|
public boolean isNewCombo() { return (type & TYPE_NEWCOMBO) > 0; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of extra skips on the combo colours
|
* Returns the number of extra skips on the combo colors.
|
||||||
*/
|
*/
|
||||||
public int getComboSkip() {
|
public int getComboSkip() { return (type >> TYPE_NEWCOMBO); }
|
||||||
return (type >> 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,14 +564,13 @@ public class OsuParser {
|
||||||
// set combo info
|
// set combo info
|
||||||
// - new combo: get next combo index, reset combo number
|
// - new combo: get next combo index, reset combo number
|
||||||
// - else: maintain combo index, increase combo number
|
// - else: maintain combo index, increase combo number
|
||||||
if (((hitObject.isNewCombo()|| first) && !hitObject.isSpinner()) ) {
|
if (((hitObject.isNewCombo() || first) && !hitObject.isSpinner())) {
|
||||||
int skip = 1 + hitObject.getComboSkip();
|
int skip = 1 + hitObject.getComboSkip();
|
||||||
|
for (int i = 0; i < skip; i++) {
|
||||||
for(int i=0; i < skip; i++){
|
|
||||||
comboIndex = (comboIndex + 1) % osu.combo.length;
|
comboIndex = (comboIndex + 1) % osu.combo.length;
|
||||||
comboNumber = 1;
|
comboNumber = 1;
|
||||||
}
|
}
|
||||||
first=false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
hitObject.setComboIndex(comboIndex);
|
hitObject.setComboIndex(comboIndex);
|
||||||
|
|
|
@ -287,8 +287,6 @@ public class ScoreData implements Comparable<ScoreData> {
|
||||||
// time since
|
// time since
|
||||||
if (getTimeSince() != null) {
|
if (getTimeSince() != null) {
|
||||||
Image clock = GameImage.HISTORY.getImage();
|
Image clock = GameImage.HISTORY.getImage();
|
||||||
g.setColor((focus) ? BG_FOCUS : BG_NORMAL);
|
|
||||||
g.fillRect(baseX + buttonWidth, y, Utils.FONT_DEFAULT.getWidth(" "),buttonHeight);
|
|
||||||
clock.drawCentered(baseX + buttonWidth * 1.02f + clock.getWidth() / 2f, midY);
|
clock.drawCentered(baseX + buttonWidth * 1.02f + clock.getWidth() / 2f, midY);
|
||||||
Utils.FONT_DEFAULT.drawString(
|
Utils.FONT_DEFAULT.drawString(
|
||||||
baseX + buttonWidth * 1.03f + clock.getWidth(),
|
baseX + buttonWidth * 1.03f + clock.getWidth(),
|
||||||
|
|
|
@ -222,21 +222,14 @@ public class Utils {
|
||||||
DownloadNode.init(width, height);
|
DownloadNode.init(width, height);
|
||||||
|
|
||||||
// back button
|
// back button
|
||||||
//TODO: this is annoying perhaps we can just pass in GameImage to MenuButton?
|
if (GameImage.MENU_BACK.getImages() != null) {
|
||||||
if (GameImage.MENU_BACK.getImages() != null){
|
|
||||||
Animation back = GameImage.MENU_BACK.getAnimation(200);
|
Animation back = GameImage.MENU_BACK.getAnimation(200);
|
||||||
backButton = new MenuButton(back,
|
backButton = new MenuButton(back, back.getWidth() / 2f, height - (back.getHeight() / 2f));
|
||||||
back.getWidth() / 2f,
|
} else {
|
||||||
height - (back.getHeight() / 2f));
|
|
||||||
}else{
|
|
||||||
Image back = GameImage.MENU_BACK.getImage();
|
Image back = GameImage.MENU_BACK.getImage();
|
||||||
backButton = new MenuButton(GameImage.MENU_BACK.getImage(),
|
backButton = new MenuButton(back, back.getWidth() / 2f, height - (back.getHeight() / 2f));
|
||||||
back.getWidth() / 2f,
|
|
||||||
height - (back.getHeight() / 2f));
|
|
||||||
}
|
}
|
||||||
backButton.setHoverExpand(MenuButton.Expand.UP_RIGHT);
|
backButton.setHoverExpand(MenuButton.Expand.UP_RIGHT);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -809,19 +809,14 @@ public class Game extends BasicGameState {
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip button
|
// skip button
|
||||||
//TODO: this is annoying perhaps we can just pass in GameImage to MenuButton?
|
if (GameImage.SKIP.getImages() != null) {
|
||||||
if (GameImage.SKIP.getImages() != null){
|
Animation skip = GameImage.SKIP.getAnimation(200);
|
||||||
Animation back = GameImage.SKIP.getAnimation(200);
|
skipButton = new MenuButton(skip, width - skip.getWidth() / 2f, height - (skip.getHeight() / 2f));
|
||||||
skipButton = new MenuButton(back,
|
} else {
|
||||||
width - back.getWidth() / 2f,
|
Image skip = GameImage.SKIP.getImage();
|
||||||
height - (back.getHeight() / 2f));
|
skipButton = new MenuButton(skip, width - skip.getWidth() / 2f, height - (skip.getHeight() / 2f));
|
||||||
}else{
|
|
||||||
Image back = GameImage.SKIP.getImage();
|
|
||||||
skipButton = new MenuButton(GameImage.SKIP.getImage(),
|
|
||||||
width - back.getWidth() / 2f,
|
|
||||||
height - (back.getHeight() / 2f));
|
|
||||||
}
|
}
|
||||||
skipButton.setHoverExpand(MenuButton.Expand.UP_LEFT);
|
skipButton.setHoverExpand(1.1f, MenuButton.Expand.UP_LEFT);
|
||||||
|
|
||||||
// load other images...
|
// load other images...
|
||||||
((GamePauseMenu) game.getState(Opsu.STATE_GAMEPAUSEMENU)).loadImages();
|
((GamePauseMenu) game.getState(Opsu.STATE_GAMEPAUSEMENU)).loadImages();
|
||||||
|
|
|
@ -95,10 +95,8 @@ public class GameRanking extends BasicGameState {
|
||||||
OsuFile osu = MusicController.getOsuFile();
|
OsuFile osu = MusicController.getOsuFile();
|
||||||
|
|
||||||
// background
|
// background
|
||||||
if (!osu.drawBG(width, height, 0.7f, true)) {
|
if (!osu.drawBG(width, height, 0.7f, true))
|
||||||
GameImage.MENU_BG.getImage().draw(0,0);
|
GameImage.MENU_BG.getImage().draw(0,0);
|
||||||
//g.setBackground(Utils.COLOR_BLACK_ALPHA);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ranking screen elements
|
// ranking screen elements
|
||||||
data.drawRankingElements(g, osu);
|
data.drawRankingElements(g, osu);
|
||||||
|
|
|
@ -172,17 +172,17 @@ public class OptionsMenu extends BasicGameState {
|
||||||
|
|
||||||
// option tabs
|
// option tabs
|
||||||
Image tabImage = GameImage.MENU_TAB.getImage();
|
Image tabImage = GameImage.MENU_TAB.getImage();
|
||||||
int subtextWidth = Utils.FONT_DEFAULT.getWidth("Click or drag an option to change it.");
|
|
||||||
float tabX = (width / 50) + (tabImage.getWidth() / 2f);
|
float tabX = (width / 50) + (tabImage.getWidth() / 2f);
|
||||||
float tabY = 15 + Utils.FONT_XLARGE.getLineHeight() + (tabImage.getHeight() / 2f);
|
float tabY = Utils.FONT_LARGE.getLineHeight() + Utils.FONT_DEFAULT.getLineHeight() +
|
||||||
int tabOffset = Math.min(tabImage.getWidth(),
|
height * 0.03f + (tabImage.getHeight() / 2f);
|
||||||
(width/2) / OptionTab.SIZE);
|
int tabOffset = Math.min(tabImage.getWidth(), (width / 2) / 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);
|
||||||
|
|
||||||
// game option coordinate modifiers
|
// game option coordinate modifiers
|
||||||
textY = (int) (tabY + tabImage.getHeight());
|
textY = (int) (tabY + tabImage.getHeight());
|
||||||
offsetY = (height - textY - GameImage.MENU_BACK.getAnimation(1).getHeight()) / maxOptionsScreen;
|
int backHeight = GameImage.MENU_BACK.getAnimation(1).getHeight();
|
||||||
|
offsetY = (height - textY - (backHeight * 4 / 5)) / maxOptionsScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -195,15 +195,10 @@ public class OptionsMenu extends BasicGameState {
|
||||||
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
|
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
|
||||||
|
|
||||||
// title
|
// title
|
||||||
Utils.FONT_XLARGE.drawString(
|
float c = container.getWidth() * 0.02f;
|
||||||
(width - Utils.FONT_XLARGE.getWidth("GAME OPTIONS")) / 2, 10,
|
Utils.FONT_LARGE.drawString(c, c, "Game Options", Color.white);
|
||||||
"GAME OPTIONS", Color.white
|
Utils.FONT_DEFAULT.drawString(c, c + Utils.FONT_LARGE.getLineHeight() * 0.9f,
|
||||||
);
|
"Click or drag an option to change it.", Color.white);
|
||||||
Utils.FONT_DEFAULT.drawString(
|
|
||||||
(width - Utils.FONT_DEFAULT.getWidth("Click or drag an option to change it.")) / 2,
|
|
||||||
10 + Utils.FONT_XLARGE.getLineHeight(),
|
|
||||||
"Click or drag an option to change it.", Color.white
|
|
||||||
);
|
|
||||||
|
|
||||||
// game options
|
// game options
|
||||||
g.setLineWidth(1f);
|
g.setLineWidth(1f);
|
||||||
|
|
|
@ -310,16 +310,17 @@ public class SongMenu extends BasicGameState {
|
||||||
else
|
else
|
||||||
musicNote.draw(marginX, marginY);
|
musicNote.draw(marginX, marginY);
|
||||||
int iconWidth = musicNote.getWidth();
|
int iconWidth = musicNote.getWidth();
|
||||||
int iconHeight = musicNote.getHeight();
|
|
||||||
|
|
||||||
if (songInfo == null)
|
if (songInfo == null)
|
||||||
songInfo = focusNode.getInfo();
|
songInfo = focusNode.getInfo();
|
||||||
marginX += 5;
|
marginX += 5;
|
||||||
Utils.FONT_LARGE.drawString(marginX + iconWidth * 1.05f, marginY, songInfo[0], Color.white);
|
float headerTextY = marginY;
|
||||||
Utils.FONT_DEFAULT.drawString(marginX + iconWidth * 1.05f, marginY + Utils.FONT_LARGE.getLineHeight() * 0.75f, songInfo[1], Color.white);
|
Utils.FONT_LARGE.drawString(marginX + iconWidth * 1.05f, headerTextY, songInfo[0], Color.white);
|
||||||
float headerTextY = marginY + iconHeight;
|
headerTextY += Utils.FONT_LARGE.getLineHeight() - 8;
|
||||||
|
Utils.FONT_DEFAULT.drawString(marginX + iconWidth * 1.05f, headerTextY, songInfo[1], Color.white);
|
||||||
|
headerTextY += Utils.FONT_DEFAULT.getLineHeight() - 2;
|
||||||
Utils.FONT_BOLD.drawString(marginX, headerTextY, songInfo[2], Color.white);
|
Utils.FONT_BOLD.drawString(marginX, headerTextY, songInfo[2], Color.white);
|
||||||
headerTextY += Utils.FONT_BOLD.getLineHeight() - 6;
|
headerTextY += Utils.FONT_BOLD.getLineHeight() - 4;
|
||||||
Utils.FONT_DEFAULT.drawString(marginX, headerTextY, songInfo[3], Color.white);
|
Utils.FONT_DEFAULT.drawString(marginX, headerTextY, songInfo[3], Color.white);
|
||||||
headerTextY += Utils.FONT_DEFAULT.getLineHeight() - 4;
|
headerTextY += Utils.FONT_DEFAULT.getLineHeight() - 4;
|
||||||
Utils.FONT_SMALL.drawString(marginX, headerTextY, songInfo[4], Color.white);
|
Utils.FONT_SMALL.drawString(marginX, headerTextY, songInfo[4], Color.white);
|
||||||
|
|
|
@ -45,6 +45,7 @@ import org.newdawn.slick.util.Log;
|
||||||
*
|
*
|
||||||
* @author kevin
|
* @author kevin
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class Image implements Renderable {
|
public class Image implements Renderable {
|
||||||
/** The top left corner identifier */
|
/** The top left corner identifier */
|
||||||
public static final int TOP_LEFT = 0;
|
public static final int TOP_LEFT = 0;
|
||||||
|
@ -570,6 +571,7 @@ public class Image implements Renderable {
|
||||||
* @param x The x location to draw the image at
|
* @param x The x location to draw the image at
|
||||||
* @param y The y location to draw the image at
|
* @param y The y location to draw the image at
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void draw(float x, float y) {
|
public void draw(float x, float y) {
|
||||||
init();
|
init();
|
||||||
draw(x,y,width,height);
|
draw(x,y,width,height);
|
||||||
|
@ -1316,9 +1318,7 @@ public class Image implements Renderable {
|
||||||
GL.glBegin(SGL.GL_QUADS);
|
GL.glBegin(SGL.GL_QUADS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see java.lang.Object#toString()
|
|
||||||
*/
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user