Better positioning of mod icons and song menu header text.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
83c475cdc1
commit
331f374a5b
|
@ -468,7 +468,9 @@ public class GameScore {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws game elements: scorebar, score, score percentage, combo count, and combo burst.
|
* Draws game elements:
|
||||||
|
* scorebar, score, score percentage, map progress circle,
|
||||||
|
* mod icons, combo count, combo burst, and grade.
|
||||||
* @param g the graphics context
|
* @param g the graphics context
|
||||||
* @param mapLength the length of the beatmap (in ms)
|
* @param mapLength the length of the beatmap (in ms)
|
||||||
* @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
|
||||||
|
@ -480,26 +482,43 @@ public class GameScore {
|
||||||
width - 2, 0, 1.0f, true);
|
width - 2, 0, 1.0f, true);
|
||||||
|
|
||||||
// score percentage
|
// score percentage
|
||||||
|
int symbolHeight = getScoreSymbolImage('0').getHeight();
|
||||||
String scorePercentage = String.format("%02.2f%%", getScorePercent());
|
String scorePercentage = String.format("%02.2f%%", getScorePercent());
|
||||||
drawSymbolString(scorePercentage, width - 2, getScoreSymbolImage('0').getHeight(), 0.75f, true);
|
drawSymbolString(scorePercentage, width - 2, symbolHeight, 0.75f, true);
|
||||||
|
|
||||||
// map progress circle
|
// map progress circle
|
||||||
g.setAntiAlias(true);
|
g.setAntiAlias(true);
|
||||||
g.setLineWidth(2f);
|
g.setLineWidth(2f);
|
||||||
g.setColor(Color.white);
|
g.setColor(Color.white);
|
||||||
int circleX = width - (getScoreSymbolImage('0').getWidth() * scorePercentage.length());
|
int circleX = width - (getScoreSymbolImage('0').getWidth() * scorePercentage.length());
|
||||||
int circleY = getScoreSymbolImage('0').getHeight();
|
float circleDiameter = symbolHeight * 0.75f;
|
||||||
float circleDiameter = getScoreSymbolImage('0').getHeight() * 0.75f;
|
g.drawOval(circleX, symbolHeight, circleDiameter, circleDiameter);
|
||||||
g.drawOval(circleX, circleY, circleDiameter, circleDiameter);
|
|
||||||
|
|
||||||
int firstObjectTime = MusicController.getOsuFile().objects[0].time;
|
int firstObjectTime = MusicController.getOsuFile().objects[0].time;
|
||||||
int trackPosition = MusicController.getPosition();
|
int trackPosition = MusicController.getPosition();
|
||||||
if (trackPosition > firstObjectTime) {
|
if (trackPosition > firstObjectTime) {
|
||||||
g.fillArc(circleX, circleY, circleDiameter, circleDiameter,
|
g.fillArc(circleX, symbolHeight, circleDiameter, circleDiameter,
|
||||||
-90, -90 + (int) (360f * (trackPosition - firstObjectTime) / mapLength)
|
-90, -90 + (int) (360f * (trackPosition - firstObjectTime) / mapLength)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mod icons
|
||||||
|
if ((firstObject && trackPosition < firstObjectTime) || Options.isModActive(Options.MOD_AUTO)) {
|
||||||
|
int modWidth = Options.getModImage(0).getWidth();
|
||||||
|
float modX = (width * 0.98f) - modWidth;
|
||||||
|
for (int i = Options.MOD_MAX - 1, modCount = 0; i >= 0; i--) {
|
||||||
|
if (Options.isModActive(i)) {
|
||||||
|
Image modImage = Options.getModImage(i);
|
||||||
|
modImage.draw(
|
||||||
|
// (width * 0.85f) + ((i - (Options.MOD_MAX / 2)) * modImage.getWidth() / 3f),
|
||||||
|
modX - (modCount * (modWidth / 2f)),
|
||||||
|
symbolHeight + circleDiameter + 10
|
||||||
|
);
|
||||||
|
modCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!breakPeriod) {
|
if (!breakPeriod) {
|
||||||
// scorebar
|
// scorebar
|
||||||
float healthRatio = health / 100f;
|
float healthRatio = health / 100f;
|
||||||
|
@ -511,15 +530,14 @@ public class GameScore {
|
||||||
Image colour = GameImage.SCOREBAR_COLOUR.getImage();
|
Image colour = GameImage.SCOREBAR_COLOUR.getImage();
|
||||||
Image colourCropped = colour.getSubImage(0, 0, (int) (colour.getWidth() * healthRatio), colour.getHeight());
|
Image colourCropped = colour.getSubImage(0, 0, (int) (colour.getWidth() * healthRatio), colour.getHeight());
|
||||||
colourCropped.draw(0, GameImage.SCOREBAR_BG.getImage().getHeight() / 4f);
|
colourCropped.draw(0, GameImage.SCOREBAR_BG.getImage().getHeight() / 4f);
|
||||||
|
Image ki = null;
|
||||||
if (health >= 50f)
|
if (health >= 50f)
|
||||||
GameImage.SCOREBAR_KI.getImage().drawCentered(
|
ki = GameImage.SCOREBAR_KI.getImage();
|
||||||
colourCropped.getWidth(), GameImage.SCOREBAR_KI.getImage().getHeight() / 2f);
|
|
||||||
else if (health >= 25f)
|
else if (health >= 25f)
|
||||||
GameImage.SCOREBAR_KI_DANGER.getImage().drawCentered(
|
ki = GameImage.SCOREBAR_KI_DANGER.getImage();
|
||||||
colourCropped.getWidth(), GameImage.SCOREBAR_KI_DANGER.getImage().getHeight() / 2f);
|
|
||||||
else
|
else
|
||||||
GameImage.SCOREBAR_KI_DANGER2.getImage().drawCentered(
|
ki = GameImage.SCOREBAR_KI_DANGER2.getImage();
|
||||||
colourCropped.getWidth(), GameImage.SCOREBAR_KI_DANGER2.getImage().getHeight() / 2f);
|
ki.drawCentered(colourCropped.getWidth(), ki.getHeight() / 2f);
|
||||||
|
|
||||||
// combo burst
|
// combo burst
|
||||||
if (comboBurstIndex != -1 && comboBurstAlpha > 0f) {
|
if (comboBurstIndex != -1 && comboBurstAlpha > 0f) {
|
||||||
|
@ -530,13 +548,13 @@ public class GameScore {
|
||||||
|
|
||||||
// combo count
|
// combo count
|
||||||
if (combo > 0) // 0 isn't a combo
|
if (combo > 0) // 0 isn't a combo
|
||||||
drawSymbolString(String.format("%dx", combo), 10, height - 10 - getScoreSymbolImage('0').getHeight(), 1.0f, false);
|
drawSymbolString(String.format("%dx", combo), 10, height - 10 - symbolHeight, 1.0f, false);
|
||||||
} else {
|
} else {
|
||||||
// grade
|
// grade
|
||||||
Image grade = gradesSmall[getGrade()];
|
Image grade = gradesSmall[getGrade()];
|
||||||
float gradeScale = circleY * 0.75f / grade.getHeight();
|
float gradeScale = symbolHeight * 0.75f / grade.getHeight();
|
||||||
gradesSmall[getGrade()].getScaledCopy(gradeScale).draw(
|
gradesSmall[getGrade()].getScaledCopy(gradeScale).draw(
|
||||||
circleX - grade.getWidth(), circleY
|
circleX - grade.getWidth(), symbolHeight
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,8 +239,8 @@ public class SoundController {
|
||||||
// PulseAudio does not support Master Gain
|
// PulseAudio does not support Master Gain
|
||||||
if (clip.isControlSupported(FloatControl.Type.MASTER_GAIN)) {
|
if (clip.isControlSupported(FloatControl.Type.MASTER_GAIN)) {
|
||||||
// set volume
|
// set volume
|
||||||
FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
|
FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
|
||||||
float dB = (float) (Math.log(volume) / Math.log(10.0) * 20.0);
|
float dB = (float) (Math.log(volume) / Math.log(10.0) * 20.0);
|
||||||
gainControl.setValue(dB);
|
gainControl.setValue(dB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,20 +297,6 @@ public class Game extends BasicGameState {
|
||||||
trackPosition < osu.objects[0].time - skipOffsetTime)
|
trackPosition < osu.objects[0].time - skipOffsetTime)
|
||||||
skipButton.draw();
|
skipButton.draw();
|
||||||
|
|
||||||
// mod icons
|
|
||||||
if ((objectIndex == 0 && trackPosition < osu.objects[0].time) ||
|
|
||||||
Options.isModActive(Options.MOD_AUTO)) {
|
|
||||||
for (int i = Options.MOD_MAX - 1; i >= 0; i--) {
|
|
||||||
if (Options.isModActive(i)) {
|
|
||||||
Image modImage = Options.getModImage(i);
|
|
||||||
modImage.draw(
|
|
||||||
(width * 0.85f) + ((i - (Options.MOD_MAX / 2)) * modImage.getWidth() / 3f),
|
|
||||||
height / 10f
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isLeadIn())
|
if (isLeadIn())
|
||||||
trackPosition = leadInTime * -1; // render approach circles during song lead-in
|
trackPosition = leadInTime * -1; // render approach circles during song lead-in
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,8 @@ public class SongMenu extends BasicGameState {
|
||||||
Image optionsIcon = new Image("options.png").getScaledCopy(iconScale);
|
Image optionsIcon = new Image("options.png").getScaledCopy(iconScale);
|
||||||
optionsButton = new GUIMenuButton(optionsIcon, search.getX() - (optionsIcon.getWidth() * 1.5f), search.getY());
|
optionsButton = new GUIMenuButton(optionsIcon, search.getX() - (optionsIcon.getWidth() * 1.5f), search.getY());
|
||||||
|
|
||||||
musicNote = new Image("music-note.png");
|
int musicNoteDim = (int) (Utils.FONT_LARGE.getHeight() * 0.75f + Utils.FONT_DEFAULT.getHeight());
|
||||||
|
musicNote = new Image("music-note.png").getScaledCopy(musicNoteDim, musicNoteDim);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -213,17 +214,15 @@ public class SongMenu extends BasicGameState {
|
||||||
|
|
||||||
String[] info = focusNode.getInfo();
|
String[] info = focusNode.getInfo();
|
||||||
g.setColor(Color.white);
|
g.setColor(Color.white);
|
||||||
Utils.FONT_LARGE.drawString(
|
Utils.FONT_LARGE.drawString(musicNoteWidth + 5, -3, info[0]);
|
||||||
musicNoteWidth + 5, -3, info[0]);
|
|
||||||
float y1 = -3 + Utils.FONT_LARGE.getHeight() * 0.75f;
|
|
||||||
Utils.FONT_DEFAULT.drawString(
|
Utils.FONT_DEFAULT.drawString(
|
||||||
musicNoteWidth + 5, y1, info[1]);
|
musicNoteWidth + 5, -3 + Utils.FONT_LARGE.getHeight() * 0.75f, info[1]);
|
||||||
Utils.FONT_BOLD.drawString(
|
int headerY = musicNoteHeight - 3;
|
||||||
5, Math.max(y1 + 4, musicNoteHeight - 3), info[2]);
|
Utils.FONT_BOLD.drawString(5, headerY, info[2]);
|
||||||
Utils.FONT_DEFAULT.drawString(
|
headerY += Utils.FONT_BOLD.getLineHeight() - 6;
|
||||||
5, musicNoteHeight + Utils.FONT_BOLD.getLineHeight() - 9, info[3]);
|
Utils.FONT_DEFAULT.drawString(5, headerY, info[3]);
|
||||||
Utils.FONT_SMALL.drawString(
|
headerY += Utils.FONT_DEFAULT.getLineHeight() - 4;
|
||||||
5, musicNoteHeight + Utils.FONT_BOLD.getLineHeight() + Utils.FONT_DEFAULT.getLineHeight() - 13, info[4]);
|
Utils.FONT_SMALL.drawString(5, headerY, info[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// song buttons
|
// song buttons
|
||||||
|
|
Loading…
Reference in New Issue
Block a user