more more easier access
This commit is contained in:
parent
0fc2008f2a
commit
65017364bd
|
@ -858,7 +858,7 @@ public class GameData {
|
|||
if (comboMax == fullObjectCount) {
|
||||
GameImage.RANKING_PERFECT.getImage().draw(
|
||||
width * 0.08f,
|
||||
(height * 0.99f) - GameImage.RANKING_PERFECT.getImage().getHeight()
|
||||
(height * 0.99f) - GameImage.RANKING_PERFECT.getHeight()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,13 @@ public enum GameImage {
|
|||
STAR ("star", "png", false, false) {
|
||||
@Override
|
||||
protected Image process_sub(Image img, int w, int h) {
|
||||
return img.getScaledCopy((MENU_BUTTON_BG.getImage().getHeight() * 0.16f) / img.getHeight());
|
||||
return img.getScaledCopy((MENU_BUTTON_BG.getHeight() * 0.16f) / img.getHeight());
|
||||
}
|
||||
},
|
||||
STAR2 ("star2", "png", false, false) {
|
||||
@Override
|
||||
protected Image process_sub(Image img, int w, int h) {
|
||||
return img.getScaledCopy((MENU_BUTTON_BG.getImage().getHeight() * 0.33f) / img.getHeight());
|
||||
return img.getScaledCopy((MENU_BUTTON_BG.getHeight() * 0.33f) / img.getHeight());
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -662,6 +662,14 @@ public enum GameImage {
|
|||
return (skinImage != null) ? skinImage : defaultImage;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return getImage().getHeight();
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return getImage().getWidth();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the image associated with this resource, with a scale applied.
|
||||
* The beatmap skin image takes priority over the default image.
|
||||
|
@ -670,6 +678,14 @@ public enum GameImage {
|
|||
return this.getImage().getScaledCopy(scale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the image associated with this resource, with a scale applied.
|
||||
* The beatmap skin image takes priority over the default image.
|
||||
*/
|
||||
public Image getScaledImage(int width, int height) {
|
||||
return this.getImage().getScaledCopy(width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Animation based on the image array.
|
||||
* If no image array exists, returns the single image as an animation.
|
||||
|
|
|
@ -100,7 +100,7 @@ public enum GameMod {
|
|||
*/
|
||||
public void init(int width, int height) {
|
||||
float multY = Fonts.LARGE.getLineHeight() * 2 + height * 0.06f;
|
||||
float offsetY = GameImage.MOD_EASY.getImage().getHeight() * 1.5f;
|
||||
float offsetY = GameImage.MOD_EASY.getHeight() * 1.5f;
|
||||
this.x = width / 30f;
|
||||
this.y = multY + Fonts.LARGE.getLineHeight() * 3f + offsetY * index;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ public enum GameMod {
|
|||
|
||||
// create buttons
|
||||
float baseX = Category.EASY.getX() + Fonts.LARGE.getWidth(Category.EASY.getName()) * 1.25f;
|
||||
float offsetX = GameImage.MOD_EASY.getImage().getWidth() * 2.1f;
|
||||
float offsetX = GameImage.MOD_EASY.getWidth() * 2.1f;
|
||||
for (GameMod mod : GameMod.values()) {
|
||||
Image img = mod.image.getImage();
|
||||
mod.button = new MenuButton(img,
|
||||
|
|
|
@ -101,7 +101,7 @@ public class ScoreData implements Comparable<ScoreData> {
|
|||
baseX = containerWidth * 0.01f;
|
||||
baseY = topY;
|
||||
buttonWidth = containerWidth * 0.4f;
|
||||
float gradeHeight = GameImage.MENU_BUTTON_BG.getImage().getHeight() * 0.45f;
|
||||
float gradeHeight = GameImage.MENU_BUTTON_BG.getHeight() * 0.45f;
|
||||
buttonHeight = Math.max(gradeHeight, Fonts.DEFAULT.getLineHeight() * 3.03f);
|
||||
buttonOffset = buttonHeight + gradeHeight / 10f;
|
||||
buttonAreaHeight = (SongMenu.MAX_SCORE_BUTTONS - 1) * buttonOffset + buttonHeight;
|
||||
|
|
|
@ -131,7 +131,7 @@ public class DownloadNode {
|
|||
* @param index the index (to offset the button from the topmost button)
|
||||
*/
|
||||
public static boolean resultIconContains(float cx, float cy, int index) {
|
||||
int iconWidth = GameImage.MUSIC_PLAY.getImage().getWidth();
|
||||
int iconWidth = GameImage.MUSIC_PLAY.getWidth();
|
||||
float x = buttonBaseX + buttonWidth * 0.001f;
|
||||
float y = buttonBaseY + (index * buttonOffset) + buttonHeight / 2f;
|
||||
return ((cx > x && cx < x + iconWidth) &&
|
||||
|
@ -186,7 +186,7 @@ public class DownloadNode {
|
|||
* @param index the index (to offset the button from the topmost button)
|
||||
*/
|
||||
public static boolean downloadIconContains(float cx, float cy, int index) {
|
||||
int iconWidth = GameImage.DELETE.getImage().getWidth();
|
||||
int iconWidth = GameImage.DELETE.getWidth();
|
||||
float edgeX = infoBaseX + infoWidth * 0.985f;
|
||||
float y = infoBaseY + (index * infoHeight);
|
||||
float marginY = infoHeight * 0.04f;
|
||||
|
|
|
@ -66,6 +66,7 @@ import yugecin.opsudance.ui.OptionsOverlay;
|
|||
import yugecin.opsudance.ui.StoryboardOverlay;
|
||||
import yugecin.opsudance.utils.GLHelper;
|
||||
|
||||
import static itdelatrisu.opsu.GameImage.*;
|
||||
import static itdelatrisu.opsu.ui.Colors.*;
|
||||
import static org.lwjgl.input.Keyboard.*;
|
||||
import static yugecin.opsudance.options.Options.*;
|
||||
|
@ -551,8 +552,8 @@ public class Game extends ComplexOpsuState {
|
|||
// show retries
|
||||
if (retries >= 2 && timeDiff >= -1000) {
|
||||
int retryHeight = Math.max(
|
||||
GameImage.SCOREBAR_BG.getImage().getHeight(),
|
||||
GameImage.SCOREBAR_KI.getImage().getHeight()
|
||||
GameImage.SCOREBAR_BG.getHeight(),
|
||||
GameImage.SCOREBAR_KI.getHeight()
|
||||
);
|
||||
float oldAlpha = Colors.WHITE_FADE.a;
|
||||
if (timeDiff < -500)
|
||||
|
@ -588,7 +589,7 @@ public class Game extends ComplexOpsuState {
|
|||
}
|
||||
}
|
||||
if (timeDiff < 1500 * speedModifier) {
|
||||
GameImage.COUNTDOWN_2.getImage().draw(width - GameImage.COUNTDOWN_2.getImage().getWidth(), 0);
|
||||
COUNTDOWN_2.getImage().draw(width - COUNTDOWN_2.getWidth(), 0);
|
||||
if (!countdown2Sound) {
|
||||
SoundController.playSound(SoundEffect.COUNT2);
|
||||
countdown2Sound = true;
|
||||
|
@ -692,8 +693,8 @@ public class Game extends ComplexOpsuState {
|
|||
g.fillRect(0, 0, width, height);
|
||||
|
||||
// draw glowing hit select circle and pulse effect
|
||||
int circleDiameter = GameImage.HITCIRCLE.getImage().getWidth();
|
||||
Image cursorCircle = GameImage.HITCIRCLE_SELECT.getImage().getScaledCopy(circleDiameter, circleDiameter);
|
||||
int circleDiameter = HITCIRCLE.getWidth();
|
||||
Image cursorCircle = HITCIRCLE_SELECT.getScaledImage(circleDiameter, circleDiameter);
|
||||
cursorCircle.setAlpha(1.0f);
|
||||
cursorCircle.drawCentered(pausedMousePosition.x, pausedMousePosition.y);
|
||||
Image cursorCirclePulse = cursorCircle.getScaledCopy(1f + pausePulse);
|
||||
|
@ -1312,7 +1313,7 @@ public class Game extends ComplexOpsuState {
|
|||
// returning from pause screen
|
||||
if (pauseTime > -1) {
|
||||
double distance = Math.hypot(pausedMousePosition.x - x, pausedMousePosition.y - y);
|
||||
int circleRadius = GameImage.HITCIRCLE.getImage().getWidth() / 2;
|
||||
int circleRadius = GameImage.HITCIRCLE.getWidth() / 2;
|
||||
if (distance < circleRadius) {
|
||||
// unpause the game
|
||||
pauseTime = -1;
|
||||
|
@ -1776,7 +1777,7 @@ public class Game extends ComplexOpsuState {
|
|||
float xDiff = endPoint.x - startPoint.x;
|
||||
float yDiff = endPoint.y - startPoint.y;
|
||||
float dist = (float) Math.hypot(xDiff, yDiff);
|
||||
int numPoints = (int) ((dist - GameImage.HITCIRCLE.getImage().getWidth()) / followPointInterval);
|
||||
int numPoints = (int) ((dist - GameImage.HITCIRCLE.getWidth()) / followPointInterval);
|
||||
if (numPoints > 0) {
|
||||
// set the image angle
|
||||
Image followPoint = GameImage.FOLLOWPOINT.getImage();
|
||||
|
|
|
@ -180,7 +180,7 @@ public class MainMenu extends BaseOpsuState {
|
|||
|
||||
// initialize music buttons
|
||||
final int musicSize = (int) (this.textLineHeight * 0.8f);
|
||||
final float musicScale = (float) musicSize / MUSIC_STOP.getImage().getWidth();
|
||||
final float musicScale = (float) musicSize / MUSIC_STOP.getWidth();
|
||||
final int musicSpacing = (int) (musicSize * 0.8f) + musicSize; // (center to center)
|
||||
int x = width - this.textMarginX - musicSize / 2;
|
||||
int y = this.textLineHeight * 2 + this.textLineHeight / 2;
|
||||
|
@ -247,19 +247,19 @@ public class MainMenu extends BaseOpsuState {
|
|||
|
||||
// logo & buttons
|
||||
this.logo = new ImagePosition(MENU_LOGO.getImage());
|
||||
logoPositionOffsetX = 0.35f * MENU_LOGO.getImage().getHeight();
|
||||
logoPositionOffsetX = 0.35f * MENU_LOGO.getHeight();
|
||||
logoPosition = new AnimatedValue(1, 0, 1, AnimationEquation.OUT_QUAD);
|
||||
logoButtonAlpha = new AnimatedValue(200, 0f, 1f, AnimationEquation.LINEAR);
|
||||
this.buttonsX = width2 - MENU_OPTIONS.getImage().getWidth() / 2;
|
||||
this.buttonsX = width2 - MENU_OPTIONS.getWidth() / 2;
|
||||
this.buttonPositions[0] = new ImagePosition(MENU_PLAY.getImage());
|
||||
this.buttonPositions[1] = new ImagePosition(MENU_OPTIONS.getImage());
|
||||
this.buttonPositions[2] = new ImagePosition(MENU_EXIT.getImage());
|
||||
final int basey = height2 - MENU_OPTIONS.getImage().getHeight() / 2;
|
||||
final float yoffset = MENU_LOGO.getImage().getHeight() * 0.196378f;
|
||||
final int basey = height2 - MENU_OPTIONS.getHeight() / 2;
|
||||
final float yoffset = MENU_LOGO.getHeight() * 0.196378f;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
this.buttonPositions[i].width = MENU_OPTIONS.getImage().getWidth();
|
||||
this.buttonPositions[i].width = MENU_OPTIONS.getWidth();
|
||||
this.buttonPositions[i].y = (int) (basey + (i - 1f) * yoffset);
|
||||
this.buttonPositions[i].height = MENU_OPTIONS.getImage().getHeight();
|
||||
this.buttonPositions[i].height = MENU_OPTIONS.getHeight();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,8 +331,8 @@ public class MainMenu extends BaseOpsuState {
|
|||
// draw buttons
|
||||
final float buttonProgress = this.buttonAnimation.getValue();
|
||||
if (this.logoState != LogoState.DEFAULT && buttonProgress > 0f) {
|
||||
final int btnwidth = MENU_OPTIONS.getImage().getWidth();
|
||||
final float btnhalfheight = MENU_OPTIONS.getImage().getHeight() / 2f;
|
||||
final int btnwidth = MENU_OPTIONS.getWidth();
|
||||
final float btnhalfheight = MENU_OPTIONS.getHeight() / 2f;
|
||||
final int basey = height2;
|
||||
final int x = (int) (this.buttonsX + btnwidth * 0.375f * buttonProgress);
|
||||
final Color col = new Color(logoColor);
|
||||
|
@ -341,8 +341,8 @@ public class MainMenu extends BaseOpsuState {
|
|||
MENU_OPTIONS.getImage(),
|
||||
MENU_EXIT.getImage()
|
||||
};
|
||||
final float circleradius = MENU_LOGO.getImage().getHeight() * 0.44498f;
|
||||
final float yoffset = MENU_LOGO.getImage().getHeight() * 0.196378f;
|
||||
final float circleradius = MENU_LOGO.getHeight() * 0.44498f;
|
||||
final float yoffset = MENU_LOGO.getHeight() * 0.196378f;
|
||||
final float cr = circleradius * totalLogoScale;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
final float hoverprogress = this.buttonAnimations[i].getValue();
|
||||
|
@ -421,16 +421,21 @@ public class MainMenu extends BaseOpsuState {
|
|||
if (repoButton != null) {
|
||||
String text;
|
||||
int fheight, fwidth;
|
||||
float x, y;
|
||||
repoButton.draw();
|
||||
text = "opsu!";
|
||||
fheight = Fonts.SMALL.getLineHeight();
|
||||
fwidth = Fonts.SMALL.getWidth(text);
|
||||
Fonts.SMALL.drawString(repoButton.getX() - fwidth / 2, repoButton.getY() - repoButton.getImage().getHeight() / 2 - fheight, text, Color.white);
|
||||
x = repoButton.getX() - fwidth / 2;
|
||||
y = repoButton.getY() - repoButton.getImage().getHeight() / 2 - fheight;
|
||||
Fonts.SMALL.drawString(x, y, text, Color.white);
|
||||
danceRepoButton.draw();
|
||||
text = "opsu!dance";
|
||||
fheight = Fonts.SMALL.getLineHeight();
|
||||
fwidth = Fonts.SMALL.getWidth(text);
|
||||
Fonts.SMALL.drawString(danceRepoButton.getX() - fwidth / 2, repoButton.getY() - repoButton.getImage().getHeight() / 2 - fheight, text, Color.white);
|
||||
x = danceRepoButton.getX() - fwidth / 2;
|
||||
y = danceRepoButton.getY() - repoButton.getImage().getHeight() / 2 - fheight;
|
||||
Fonts.SMALL.drawString(x, y, text, Color.white);
|
||||
}
|
||||
|
||||
// draw update button
|
||||
|
@ -516,8 +521,8 @@ public class MainMenu extends BaseOpsuState {
|
|||
}
|
||||
|
||||
// buttons
|
||||
this.logo.width = MENU_LOGO.getImage().getWidth();
|
||||
this.logo.height = MENU_LOGO.getImage().getHeight();
|
||||
this.logo.width = MENU_LOGO.getWidth();
|
||||
this.logo.height = MENU_LOGO.getHeight();
|
||||
this.logo.x = width2 - this.logo.width / 2;
|
||||
this.logo.y = height2 - this.logo.height / 2;
|
||||
if (this.logoState != LogoState.DEFAULT) {
|
||||
|
|
|
@ -325,10 +325,10 @@ public class SongMenu extends ComplexOpsuState {
|
|||
components.clear();
|
||||
|
||||
// header/footer coordinates
|
||||
headerY = height * 0.0075f + GameImage.MENU_MUSICNOTE.getImage().getHeight() +
|
||||
headerY = height * 0.0075f + GameImage.MENU_MUSICNOTE.getHeight() +
|
||||
Fonts.BOLD.getLineHeight() + Fonts.DEFAULT.getLineHeight() +
|
||||
Fonts.SMALL.getLineHeight();
|
||||
footerY = height - GameImage.SELECTION_MODS.getImage().getHeight();
|
||||
footerY = height - GameImage.SELECTION_MODS.getHeight();
|
||||
|
||||
// footer logo coordinates
|
||||
float footerHeight = height - footerY;
|
||||
|
@ -342,7 +342,7 @@ public class SongMenu extends ComplexOpsuState {
|
|||
// initialize sorts
|
||||
int sortWidth = (int) (width * 0.12f);
|
||||
int posX = (int) (width * 0.87f);
|
||||
int posY = (int) (headerY - GameImage.MENU_TAB.getImage().getHeight() * 2.25f);
|
||||
int posY = (int) (headerY - GameImage.MENU_TAB.getHeight() * 2.25f);
|
||||
sortMenu = new DropdownMenu<BeatmapSortOrder>(BeatmapSortOrder.values(), posX, posY, sortWidth) {
|
||||
@Override
|
||||
public void itemSelected(int index, BeatmapSortOrder item) {
|
||||
|
@ -430,7 +430,7 @@ public class SongMenu extends ComplexOpsuState {
|
|||
selectOptionsButton.setHoverFade(0f);
|
||||
|
||||
// loader
|
||||
int loaderDim = GameImage.MENU_MUSICNOTE.getImage().getWidth();
|
||||
int loaderDim = GameImage.MENU_MUSICNOTE.getWidth();
|
||||
SpriteSheet spr = new SpriteSheet(GameImage.MENU_LOADER.getImage(), loaderDim, loaderDim);
|
||||
loader = new Animation(spr, 50);
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ public class UI {
|
|||
return;
|
||||
|
||||
int margin = width / 100, textMarginX = 2;
|
||||
int offset = GameImage.CURSOR_MIDDLE.getImage().getWidth() / 2;
|
||||
int offset = GameImage.CURSOR_MIDDLE.getWidth() / 2;
|
||||
int lineHeight = Fonts.SMALL.getLineHeight();
|
||||
int textWidth = textMarginX * 2, textHeight = lineHeight;
|
||||
if (tooltipNewlines) {
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.newdawn.slick.Color;
|
|||
import org.newdawn.slick.Image;
|
||||
import yugecin.opsudance.skinning.SkinService;
|
||||
|
||||
import static itdelatrisu.opsu.GameImage.*;
|
||||
import static yugecin.opsudance.options.Options.*;
|
||||
|
||||
public class GameObjectRenderer {
|
||||
|
@ -88,7 +89,8 @@ public class GameObjectRenderer {
|
|||
|
||||
public void renderComboNumberOnly(float x, float y, int number, float alpha) {
|
||||
if (number > 0) {
|
||||
gameData.drawSymbolNumber(number, x, y, GameImage.HITCIRCLE.getImage().getWidth() * 0.40f / gameData.getDefaultSymbolImage(0).getHeight(), alpha);
|
||||
float scale = HITCIRCLE.getWidth() * 0.40f / gameData.getDefaultSymbolImage(0).getHeight();
|
||||
gameData.drawSymbolNumber(number, x, y, scale, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user