simplify access to display width and height and halves
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -35,7 +35,6 @@ import yugecin.opsudance.movers.factories.*;
|
||||
import yugecin.opsudance.movers.slidermovers.DefaultSliderMoverController;
|
||||
import yugecin.opsudance.movers.slidermovers.InheritedSliderMoverController;
|
||||
import yugecin.opsudance.movers.slidermovers.SliderMoverController;
|
||||
import yugecin.opsudance.render.GameObjectRenderer;
|
||||
import yugecin.opsudance.spinners.*;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -252,8 +251,8 @@ public class Dancer {
|
||||
}
|
||||
}
|
||||
Pippi.dance(time, c, isCurrentLazySlider);
|
||||
x = Utils.clamp(x, 10, displayContainer.width - 10);
|
||||
y = Utils.clamp(y, 10, displayContainer.height - 10);
|
||||
x = Utils.clamp(x, 10, width - 10);
|
||||
y = Utils.clamp(y, 10, height - 10);
|
||||
}
|
||||
|
||||
private void createNewMover() {
|
||||
|
||||
@@ -44,6 +44,7 @@ import yugecin.opsudance.core.errorhandling.ErrorDumpable;
|
||||
import yugecin.opsudance.core.state.OpsuState;
|
||||
import yugecin.opsudance.events.ResolutionChangedListener;
|
||||
import yugecin.opsudance.events.SkinChangedListener;
|
||||
import yugecin.opsudance.ui.BackButton;
|
||||
import yugecin.opsudance.utils.GLHelper;
|
||||
|
||||
import java.io.StringWriter;
|
||||
@@ -68,9 +69,6 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener {
|
||||
|
||||
private Graphics graphics;
|
||||
|
||||
public int width;
|
||||
public int height;
|
||||
|
||||
public int mouseX;
|
||||
public int mouseY;
|
||||
|
||||
@@ -149,12 +147,13 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener {
|
||||
}
|
||||
}
|
||||
|
||||
backButton = new BackButton();
|
||||
|
||||
// TODO clean this up
|
||||
GameMod.init(width, height);
|
||||
PlaybackSpeed.init(width, height);
|
||||
HitObject.init(width, height);
|
||||
DownloadNode.init(width, height);
|
||||
UI.init(this);
|
||||
}
|
||||
|
||||
public void setUPS(int ups) {
|
||||
@@ -262,7 +261,7 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener {
|
||||
}
|
||||
|
||||
public void setup() throws Exception {
|
||||
width = height = -1;
|
||||
width = height = width2 = height2 = -1;
|
||||
Display.setTitle("opsu!dance");
|
||||
setupResolutionOptionlist(nativeDisplayMode.getWidth(), nativeDisplayMode.getHeight());
|
||||
updateDisplayMode(OPTION_SCREEN_RESOLUTION.getValueString());
|
||||
@@ -372,29 +371,34 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener {
|
||||
}
|
||||
}
|
||||
|
||||
public void setDisplayMode(int width, int height, boolean fullscreen) throws Exception {
|
||||
if (this.width == width && this.height == height) {
|
||||
public void setDisplayMode(int w, int h, boolean fullscreen) throws Exception {
|
||||
if (width == w && height == h) {
|
||||
Display.setFullscreen(fullscreen);
|
||||
return;
|
||||
}
|
||||
|
||||
DisplayMode displayMode = null;
|
||||
if (fullscreen) {
|
||||
displayMode = GLHelper.findFullscreenDisplayMode(nativeDisplayMode.getBitsPerPixel(), nativeDisplayMode.getFrequency(), width, height);
|
||||
final int bpp = this.nativeDisplayMode.getBitsPerPixel();
|
||||
final int freq = this.nativeDisplayMode.getFrequency();
|
||||
displayMode = GLHelper.findFullscreenDisplayMode(bpp, freq, w, h);
|
||||
}
|
||||
|
||||
if (displayMode == null) {
|
||||
displayMode = new DisplayMode(width, height);
|
||||
displayMode = new DisplayMode(w, h);
|
||||
if (fullscreen) {
|
||||
fullscreen = false;
|
||||
String msg = String.format("Fullscreen mode is not supported for %sx%s", width, height);
|
||||
String msg = "Fullscreen mode is not supported for %sx%s";
|
||||
msg = String.format(msg, w, h);
|
||||
Log.warn(msg);
|
||||
bubNotifs.send(BUB_ORANGE, msg);
|
||||
}
|
||||
}
|
||||
|
||||
this.width = displayMode.getWidth();
|
||||
this.height = displayMode.getHeight();
|
||||
width = displayMode.getWidth();
|
||||
height = displayMode.getHeight();
|
||||
width2 = width / 2;
|
||||
height2 = height / 2;
|
||||
|
||||
Display.setDisplayMode(displayMode);
|
||||
Display.setFullscreen(fullscreen);
|
||||
@@ -509,6 +513,7 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener {
|
||||
this.state = state;
|
||||
this.state.enter();
|
||||
input.addListener(this.state);
|
||||
backButton.resetHover();
|
||||
if (this.rendering) {
|
||||
// state might be changed in preRenderUpdate,
|
||||
// in that case the new state will be rendered without having
|
||||
|
||||
@@ -34,6 +34,7 @@ import yugecin.opsudance.options.Configuration;
|
||||
import yugecin.opsudance.options.OptionsService;
|
||||
import yugecin.opsudance.render.GameObjectRenderer;
|
||||
import yugecin.opsudance.skinning.SkinService;
|
||||
import yugecin.opsudance.ui.BackButton;
|
||||
import yugecin.opsudance.utils.ManifestWrapper;
|
||||
|
||||
import java.io.File;
|
||||
@@ -55,6 +56,7 @@ public class InstanceContainer {
|
||||
public static BeatmapParser beatmapParser;
|
||||
public static Updater updater;
|
||||
|
||||
public static BackButton backButton;
|
||||
public static DisplayContainer displayContainer;
|
||||
public static Input input;
|
||||
|
||||
@@ -72,6 +74,8 @@ public class InstanceContainer {
|
||||
public static Game gameState;
|
||||
public static GameRanking gameRankingState;
|
||||
public static GamePauseMenu pauseState;
|
||||
|
||||
public static int width, width2, height, height2;
|
||||
|
||||
public static void kickstart() {
|
||||
updater = new Updater();
|
||||
|
||||
@@ -26,7 +26,7 @@ import yugecin.opsudance.events.ResolutionChangedListener;
|
||||
import java.util.Formatter;
|
||||
import java.util.List;
|
||||
|
||||
import static yugecin.opsudance.core.InstanceContainer.displayContainer;
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
|
||||
public class BarNotificationState implements ResolutionChangedListener {
|
||||
|
||||
@@ -60,10 +60,10 @@ public class BarNotificationState implements ResolutionChangedListener {
|
||||
timeShown += displayContainer.renderDelta;
|
||||
processAnimations();
|
||||
g.setColor(bgcol);
|
||||
g.fillRect(0, displayContainer.height / 2 - barHalfHeight, displayContainer.width, barHalfHeight * 2);
|
||||
g.fillRect(0, height2 - barHalfHeight, width, barHalfHeight * 2);
|
||||
int y = textY;
|
||||
for (String line : lines) {
|
||||
Fonts.LARGE.drawString((displayContainer.width - Fonts.LARGE.getWidth(line)) / 2, y, line, textCol);
|
||||
Fonts.LARGE.drawString((width - Fonts.LARGE.getWidth(line)) / 2, y, line, textCol);
|
||||
y += Fonts.LARGE.getLineHeight();
|
||||
}
|
||||
}
|
||||
@@ -88,9 +88,9 @@ public class BarNotificationState implements ResolutionChangedListener {
|
||||
}
|
||||
|
||||
private void calculatePosition() {
|
||||
this.lines = Fonts.wrap(Fonts.LARGE, message, (int) (displayContainer.width * 0.96f), true);
|
||||
this.lines = Fonts.wrap(Fonts.LARGE, message, (int) (width * 0.96f), true);
|
||||
int textHeight = (int) (Fonts.LARGE.getLineHeight() * (lines.size() + 0.5f));
|
||||
textY = (displayContainer.height - textHeight) / 2 + (int) (Fonts.LARGE.getLineHeight() / 5f);
|
||||
textY = (height - textHeight) / 2 + (int) (Fonts.LARGE.getLineHeight() / 5f);
|
||||
barHalfTargetHeight = textHeight / 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,10 +72,10 @@ public class BubNotifState implements MouseListener, ResolutionChangedListener {
|
||||
|
||||
private void calculatePositions() {
|
||||
// if width is 0, attempting to wrap it will result in infinite loop
|
||||
Notification.width = Math.max(50, (int) (displayContainer.width * 0.1703125f));
|
||||
Notification.baseLine = (int) (displayContainer.height * 0.9645f);
|
||||
Notification.paddingY = (int) (displayContainer.height * 0.0144f);
|
||||
Notification.finalX = displayContainer.width - Notification.width - (int) (displayContainer.width * 0.01);
|
||||
Notification.width = Math.max(50, (int) (width * 0.1703125f));
|
||||
Notification.baseLine = (int) (height * 0.9645f);
|
||||
Notification.paddingY = (int) (height * 0.0144f);
|
||||
Notification.finalX = width - Notification.width - (int) (width * 0.01);
|
||||
Notification.fontPaddingX = (int) (Notification.width * 0.02f);
|
||||
Notification.fontPaddingY = (int) (Fonts.SMALLBOLD.getLineHeight() / 4f);
|
||||
Notification.lineHeight = Fonts.SMALLBOLD.getLineHeight();
|
||||
|
||||
@@ -24,7 +24,7 @@ import yugecin.opsudance.events.ResolutionChangedListener;
|
||||
import yugecin.opsudance.utils.FPSMeter;
|
||||
|
||||
import static yugecin.opsudance.options.Options.*;
|
||||
import static yugecin.opsudance.core.InstanceContainer.displayContainer;
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
|
||||
public class FpsRenderState implements ResolutionChangedListener {
|
||||
|
||||
@@ -90,8 +90,8 @@ public class FpsRenderState implements ResolutionChangedListener {
|
||||
@Override
|
||||
public void onResolutionChanged(int w, int h) {
|
||||
singleHeight = Fonts.SMALL.getLineHeight();
|
||||
x = displayContainer.width - 3;
|
||||
y = displayContainer.height - 3 - singleHeight - 10;
|
||||
x = width - 3;
|
||||
y = height - 3 - singleHeight - 10;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -64,7 +64,7 @@ public class CircleMover extends Mover {
|
||||
double a = ang + SOME_CONSTANT * t;
|
||||
pos[0] = (startX + (endX - startX) * t) - middlexoffset - Math.cos(a) * radius;
|
||||
pos[1] = (startY + (endY - startY) * t) - middleyoffset - Math.sin(a) * radius;
|
||||
if (pos[0] < 0 || displayContainer.width < pos[0] || pos[1] < 0 || displayContainer.height < pos[1]) {
|
||||
if (pos[0] < 0 || width < pos[0] || pos[1] < 0 || height < pos[1]) {
|
||||
pass = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -44,8 +44,8 @@ public class ExgonMover extends Mover {
|
||||
pos[0] = endX;
|
||||
pos[1] = endY;
|
||||
} else {
|
||||
pos[0] = randgen.nextInt(displayContainer.width);
|
||||
pos[1] = randgen.nextInt(displayContainer.height);
|
||||
pos[0] = randgen.nextInt(width);
|
||||
pos[1] = randgen.nextInt(height);
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -102,8 +102,8 @@ public class AutoMoverFactory implements MoverFactory {
|
||||
}
|
||||
|
||||
private boolean checkBounds( double[] pos ) {
|
||||
return 0 < pos[0] && pos[0] < displayContainer.width - displayContainer.width / 8 &&
|
||||
0 < pos[1] && pos[1] < displayContainer.height - displayContainer.height / 8;
|
||||
return 0 < pos[0] && pos[0] < width - width / 8 &&
|
||||
0 < pos[1] && pos[1] < height - height / 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -71,12 +71,12 @@ public class MoveStoryboard extends OverlayOpsuState{
|
||||
public void revalidate() {
|
||||
super.revalidate();
|
||||
|
||||
btnAddLinear = new SimpleButton(displayContainer.width - 205, 50, 200, 25, Fonts.SMALL, "add linear", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
|
||||
btnAddQuadratic = new SimpleButton(displayContainer.width - 205, 80, 200, 25, Fonts.SMALL, "add quadratic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
|
||||
btnAddCubic = new SimpleButton(displayContainer.width - 205, 110, 200, 25, Fonts.SMALL, "add cubic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
|
||||
btnAnimLin = new SimpleButton(displayContainer.width - 250, 50, 40, 25, Fonts.SMALL, "lin", Color.blue, Color.white, Color.white, Color.orange);
|
||||
btnAnimMid = new SimpleButton(displayContainer.width - 250, 80, 40, 25, Fonts.SMALL, "mid", Color.blue, Color.white, Color.white, Color.orange);
|
||||
btnAnimCub = new SimpleButton(displayContainer.width - 250, 110, 40, 25, Fonts.SMALL, "cub", Color.blue, Color.white, Color.white, Color.orange);
|
||||
btnAddLinear = new SimpleButton(width - 205, 50, 200, 25, Fonts.SMALL, "add linear", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
|
||||
btnAddQuadratic = new SimpleButton(width - 205, 80, 200, 25, Fonts.SMALL, "add quadratic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
|
||||
btnAddCubic = new SimpleButton(width - 205, 110, 200, 25, Fonts.SMALL, "add cubic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
|
||||
btnAnimLin = new SimpleButton(width - 250, 50, 40, 25, Fonts.SMALL, "lin", Color.blue, Color.white, Color.white, Color.orange);
|
||||
btnAnimMid = new SimpleButton(width - 250, 80, 40, 25, Fonts.SMALL, "mid", Color.blue, Color.white, Color.white, Color.orange);
|
||||
btnAnimCub = new SimpleButton(width - 250, 110, 40, 25, Fonts.SMALL, "cub", Color.blue, Color.white, Color.white, Color.orange);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,7 +190,7 @@ public class MoveStoryboard extends OverlayOpsuState{
|
||||
return dummyMove;
|
||||
}
|
||||
if (moves[objectIndex] == null) {
|
||||
return moves[objectIndex] = new StoryboardMoveImpl(gameObjects[objectIndex - 1].end, gameObjects[objectIndex].start, displayContainer.width);
|
||||
return moves[objectIndex] = new StoryboardMoveImpl(gameObjects[objectIndex - 1].end, gameObjects[objectIndex].start, width);
|
||||
}
|
||||
return moves[objectIndex];
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -38,10 +38,10 @@ public class ApproachCircleSpinner extends Spinner {
|
||||
ang += 15;
|
||||
}
|
||||
|
||||
double rad = displayContainer.width / 4.0f * (1d - Spinner.PROGRESS);
|
||||
double rad = width / 4.0f * (1d - Spinner.PROGRESS);
|
||||
|
||||
point[0] = displayContainer.width / 2.0f + rad * Math.sin(ang / 180d * Math.PI);
|
||||
point[1] = displayContainer.height / 2.0f - rad * Math.cos(ang / 180d * Math.PI);
|
||||
point[0] = width2 + rad * Math.sin(ang / 180d * Math.PI);
|
||||
point[1] = height2 - rad * Math.cos(ang / 180d * Math.PI);
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -41,30 +41,30 @@ public class BeamSpinner extends Spinner {
|
||||
index = ++index % 4;
|
||||
final int MOD = 60;
|
||||
|
||||
point[0] = displayContainer.width / 2d;
|
||||
point[1] = displayContainer.height / 2d;
|
||||
point[0] = width2;
|
||||
point[1] = height2;
|
||||
|
||||
if( index == 0 ) {
|
||||
add( MOD, 90 );
|
||||
add( MOD, 180 );
|
||||
} else if( index == 1 ) {
|
||||
add( MOD, 90 );
|
||||
add( displayContainer.height / 2 * 0.8d, 0 );
|
||||
} else if( index == 2 ) {
|
||||
add( MOD, -90 );
|
||||
add( displayContainer.height / 2 * 0.8d, 0 );
|
||||
} else if( index == 3 ) {
|
||||
add( MOD, -90 );
|
||||
add( MOD, 180 );
|
||||
if (index == 0) {
|
||||
add(MOD, 90);
|
||||
add(MOD, 180);
|
||||
} else if (index == 1) {
|
||||
add(MOD, 90);
|
||||
add(height2 * 0.8d, 0);
|
||||
} else if (index == 2) {
|
||||
add(MOD, -90);
|
||||
add(height2 * 0.8d, 0);
|
||||
} else if (index == 3) {
|
||||
add(MOD, -90);
|
||||
add(MOD, 180);
|
||||
ang += 0.3;
|
||||
}
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
private void add( double rad, double ang ) {
|
||||
point[0] += rad * Math.cos( (this.ang + ang) / 180d * Math.PI);
|
||||
point[1] -= rad * Math.sin( (this.ang + ang) / 180d * Math.PI);
|
||||
private void add (double rad, double ang ) {
|
||||
point[0] += rad * Math.cos((this.ang + ang) / 180d * Math.PI);
|
||||
point[1] -= rad * Math.sin((this.ang + ang) / 180d * Math.PI);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -36,10 +36,10 @@ public class CircleSpinner extends Spinner {
|
||||
ang += 15;
|
||||
}
|
||||
|
||||
double rad = displayContainer.width / 4.0f;
|
||||
double rad = width / 4.0f;
|
||||
|
||||
point[0] = displayContainer.width / 2.0f + rad * Math.sin(ang / 180d * Math.PI);
|
||||
point[1] = displayContainer.height / 2.0f - rad * Math.cos(ang / 180d * Math.PI);
|
||||
point[0] = width2 + rad * Math.sin(ang / 180d * Math.PI);
|
||||
point[1] = height2 - rad * Math.cos(ang / 180d * Math.PI);
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
package yugecin.opsudance.spinners;
|
||||
|
||||
import static yugecin.opsudance.core.InstanceContainer.displayContainer;
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
|
||||
public class CubeSpinner extends Spinner {
|
||||
|
||||
@@ -90,10 +90,10 @@ public class CubeSpinner extends Spinner {
|
||||
x *= 3.0d / ( z + 3.0d + 5.0d + 0.5 );
|
||||
y *= 3.0d / ( z + 3.0d + 5.0d + 0.5 );
|
||||
|
||||
double scale = displayContainer.width / (3.0f + 0.5f * Math.cos(size / 180f * Math.PI));
|
||||
double scale = width / (3.0f + 0.5f * Math.cos(size / 180f * Math.PI));
|
||||
//double scale = Options.width / (3.0f + -1f * ((float)(Options.s.ElapsedMilliseconds % Options.beatTimeMs)/(float)Options.beatTimeMs));
|
||||
point[0] = (int) ( displayContainer.width / 2.0f + scale * x );
|
||||
point[1] = (int) ( displayContainer.height / 2.0f - scale * y );
|
||||
point[0] = (int) (width2 + scale * x );
|
||||
point[1] = (int) (height2 - scale * y );
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -38,10 +38,10 @@ public class DonutSpinner extends Spinner {
|
||||
ang += 15;
|
||||
}
|
||||
|
||||
double rad = displayContainer.width / 4.0f;
|
||||
double rad = width / 4.0f;
|
||||
|
||||
point[0] = displayContainer.width / 2.0f + rad * Math.sin(ang);
|
||||
point[1] = displayContainer.height / 2.0f - rad * Math.cos(ang);
|
||||
point[0] = width2 + rad * Math.sin(ang);
|
||||
point[1] = height2 - rad * Math.cos(ang);
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -39,12 +39,12 @@ public class FivePointStarApproachSpinner extends Spinner {
|
||||
odd = !odd;
|
||||
}
|
||||
|
||||
double rad = displayContainer.width / 4.0f * (1d - Spinner.PROGRESS);
|
||||
double rad = width / 4.0f * (1d - Spinner.PROGRESS);
|
||||
if (!odd) {
|
||||
rad /= 3d;
|
||||
}
|
||||
point[0] = displayContainer.width / 2d + Math.cos(ang) * rad;
|
||||
point[1] = displayContainer.height / 2d + Math.sin(ang) * rad;
|
||||
point[0] = width2 + Math.cos(ang) * rad;
|
||||
point[1] = height2 + Math.sin(ang) * rad;
|
||||
return point;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -24,11 +24,9 @@ public class FivePointStarSpinner extends Spinner {
|
||||
@Override
|
||||
public void init() {
|
||||
double[][] points = new double[10][];
|
||||
double midx = displayContainer.width / 2d;
|
||||
double midy = displayContainer.height / 2d;
|
||||
double angleIncRads = Math.PI * 36d / 180d;
|
||||
double ang = -Math.PI / 2d;
|
||||
double maxrad = displayContainer.width / 4d;
|
||||
double maxrad = width / 4d;
|
||||
double minrad = maxrad / 3d;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
double rad = maxrad;
|
||||
@@ -36,8 +34,8 @@ public class FivePointStarSpinner extends Spinner {
|
||||
rad = minrad;
|
||||
}
|
||||
points[i] = new double[] {
|
||||
midx + Math.cos(ang) * rad,
|
||||
midy + Math.sin(ang) * rad
|
||||
width2 + Math.cos(ang) * rad,
|
||||
height2 + Math.sin(ang) * rad
|
||||
};
|
||||
ang += angleIncRads;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -17,9 +17,7 @@
|
||||
*/
|
||||
package yugecin.opsudance.spinners;
|
||||
|
||||
import yugecin.opsudance.options.Options;
|
||||
|
||||
import static yugecin.opsudance.core.InstanceContainer.displayContainer;
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
|
||||
public class HalfCircleSpinner extends Spinner {
|
||||
|
||||
@@ -47,8 +45,8 @@ public class HalfCircleSpinner extends Spinner {
|
||||
skipang += 359;
|
||||
}
|
||||
|
||||
point[0] = displayContainer.width / 2.0d + displayContainer.height / 2 * 0.8d * Math.cos(ang/180d*Math.PI);
|
||||
point[1] = displayContainer.height / 2.0d + displayContainer.height / 2 * 0.8d * Math.sin(ang/180d*Math.PI);
|
||||
point[0] = width2 + height2 * 0.8d * Math.cos(ang/180d*Math.PI);
|
||||
point[1] = height2 + height2 * 0.8d * Math.sin(ang/180d*Math.PI);
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -24,9 +24,9 @@ public class IlluminatiSpinner extends Spinner {
|
||||
@Override
|
||||
public void init() {
|
||||
init( new double[][] {
|
||||
new double[] { displayContainer.width / 2d - 120, displayContainer.height / 2d + 80 },
|
||||
new double[] { displayContainer.width / 2d, displayContainer.height / 2d - 160 },
|
||||
new double[] { displayContainer.width / 2d + 120, displayContainer.height / 2d + 80 }
|
||||
new double[] { width2 - 120, height2 + 80 },
|
||||
new double[] { width2, height2 - 160 },
|
||||
new double[] { width2 + 120, height2 + 80 }
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package yugecin.opsudance.spinners;
|
||||
|
||||
import static java.lang.Math.*;
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
|
||||
public class LessThanThreeSpinner extends Spinner {
|
||||
@@ -24,9 +25,7 @@ public class LessThanThreeSpinner extends Spinner {
|
||||
private int angle = 0;
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,15 +36,12 @@ public class LessThanThreeSpinner extends Spinner {
|
||||
}
|
||||
if( angle > 360 ) angle = 0;
|
||||
double theta = angle / 180d * Math.PI;
|
||||
double[] pos = new double[] {
|
||||
displayContainer.width / 2d,
|
||||
displayContainer.height / 2d
|
||||
};
|
||||
double[] pos = { width2, height2 };
|
||||
|
||||
double r = 2 - 2 * Math.sin( theta ) + Math.sin( theta ) * Math.sqrt( Math.abs( Math.cos( theta ) ) ) / ( Math.sin( theta ) + 1.4 );
|
||||
double r = 2 - 2 * sin(theta) + sin(theta) * sqrt(abs(cos(theta))) / (sin(theta) + 1.4);
|
||||
|
||||
pos[0] += Math.cos( theta ) * r * 100;
|
||||
pos[1] -= Math.sin( theta ) * r * 100 + 100;
|
||||
pos[0] += Math.cos(theta) * r * 100;
|
||||
pos[1] -= Math.sin(theta) * r * 100 + 100;
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -29,7 +29,7 @@ public class RektCircleSpinner extends Spinner {
|
||||
@Override
|
||||
public void init() {
|
||||
index = 0;
|
||||
size = displayContainer.height * 0.8d;
|
||||
size = height * 0.8d;
|
||||
point = new double[2];
|
||||
}
|
||||
|
||||
@@ -42,20 +42,20 @@ public class RektCircleSpinner extends Spinner {
|
||||
final int INC = 50;
|
||||
|
||||
if( index == 0 ) {
|
||||
point[0] = displayContainer.width / 2d + size / 2d - pos;
|
||||
point[1] = displayContainer.height / 2d - size / 2d;
|
||||
point[0] = width2 + size / 2d - pos;
|
||||
point[1] = height2 - size / 2d;
|
||||
index++;
|
||||
} else if( index == 1 ) {
|
||||
point[0] = displayContainer.width / 2 - size / 2;
|
||||
point[1] = displayContainer.height / 2 - size / 2 + pos;
|
||||
point[0] = width2 - size / 2;
|
||||
point[1] = height2 - size / 2 + pos;
|
||||
index++;
|
||||
} else if( index == 2 ) {
|
||||
point[0] = displayContainer.width / 2 - size / 2 + pos;
|
||||
point[1] = displayContainer.height / 2 + size / 2;
|
||||
point[0] = width2 - size / 2 + pos;
|
||||
point[1] = height2 + size / 2;
|
||||
index++;
|
||||
} else if( index == 3 ) {
|
||||
point[0] = displayContainer.width / 2 + size / 2;
|
||||
point[1] = displayContainer.height / 2 + size / 2 - pos;
|
||||
point[0] = width2 + size / 2;
|
||||
point[1] = height2 + size / 2 - pos;
|
||||
pos += INC;
|
||||
if( pos > size ) {
|
||||
pos = INC;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -25,11 +25,11 @@ public class RektSpinner extends Spinner {
|
||||
public void init() {
|
||||
init(new double[][] {
|
||||
{ 10, 10 },
|
||||
{ displayContainer.width / 2d, 10 },
|
||||
{ displayContainer.width - 10, 10 },
|
||||
{ displayContainer.width - 10, displayContainer.height - 10 },
|
||||
{ displayContainer.width / 2d, displayContainer.height - 10 },
|
||||
{ 10, displayContainer.height - 10 }
|
||||
{ width2, 10 },
|
||||
{ width - 10, 10 },
|
||||
{ width - 10, height - 10 },
|
||||
{ width2, height - 10 },
|
||||
{ 10, height - 10 }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2017 yugecin
|
||||
* Copyright (C) 2017-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,7 +23,8 @@ import itdelatrisu.opsu.ui.Fonts;
|
||||
import itdelatrisu.opsu.ui.MenuButton;
|
||||
import itdelatrisu.opsu.ui.animations.AnimationEquation;
|
||||
import org.newdawn.slick.*;
|
||||
import yugecin.opsudance.core.DisplayContainer;
|
||||
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
|
||||
public class BackButton {
|
||||
|
||||
@@ -80,7 +81,7 @@ public class BackButton {
|
||||
/** The real button with, determined by the size and animations. */
|
||||
private int realButtonWidth;
|
||||
|
||||
public BackButton(DisplayContainer container) {
|
||||
public BackButton() {
|
||||
if (!GameImage.MENU_BACK.hasGameSkinImage()) {
|
||||
backButton = null;
|
||||
textWidth = Fonts.MEDIUM.getWidth("back");
|
||||
@@ -90,7 +91,7 @@ public class BackButton {
|
||||
paddingY *= 0.736f;
|
||||
paddingX = paddingY / 2f;
|
||||
chevronBaseSize = paddingY * 3f / 2f;
|
||||
buttonYpos = (int) (container.height - paddingY * 4f);
|
||||
buttonYpos = height - (int) (paddingY * 4f);
|
||||
slopeImageSize = (int) (paddingY * 3f);
|
||||
slopeImageSlopeWidth = (int) (slopeImageSize * 0.295f);
|
||||
firstButtonWidth = slopeImageSize;
|
||||
@@ -101,10 +102,10 @@ public class BackButton {
|
||||
|
||||
if (GameImage.MENU_BACK.getImages() != null) {
|
||||
Animation back = GameImage.MENU_BACK.getAnimation(120);
|
||||
backButton = new MenuButton(back, back.getWidth() / 2f, container.height - (back.getHeight() / 2f));
|
||||
backButton = new MenuButton(back, back.getWidth() / 2f, height - (back.getHeight() / 2f));
|
||||
} else {
|
||||
Image back = GameImage.MENU_BACK.getImage();
|
||||
backButton = new MenuButton(back, back.getWidth() / 2f, container.height - (back.getHeight() / 2f));
|
||||
backButton = new MenuButton(back, back.getWidth() / 2f, height - (back.getHeight() / 2f));
|
||||
}
|
||||
backButton.setHoverAnimationDuration(350);
|
||||
backButton.setHoverAnimationEquation(AnimationEquation.IN_OUT_BACK);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2016 yugecin
|
||||
* Copyright (C) 2016-2018 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -35,6 +35,7 @@ import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Random;
|
||||
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
import static yugecin.opsudance.options.Options.*;
|
||||
|
||||
public class OptionsOverlay extends OverlayOpsuState {
|
||||
@@ -110,8 +111,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
private int openDropdownVirtualY;
|
||||
|
||||
private int targetWidth;
|
||||
private int width;
|
||||
private int height;
|
||||
private int currentWidth;
|
||||
|
||||
private int navButtonSize;
|
||||
private int navStartY;
|
||||
@@ -185,18 +185,17 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
super.revalidate();
|
||||
|
||||
boolean isWidescreen = displayContainer.isWidescreen();
|
||||
targetWidth = (int) (displayContainer.width * (isWidescreen ? 0.4f : 0.5f));
|
||||
height = displayContainer.height;
|
||||
targetWidth = (int) (width * (isWidescreen ? 0.4f : 0.5f));
|
||||
|
||||
// calculate positions
|
||||
float navIconWidthRatio = isWidescreen ? 0.046875f : 0.065f;
|
||||
// non-widescreen ratio is not accurate
|
||||
navButtonSize = (int) (displayContainer.width * navIconWidthRatio);
|
||||
navButtonSize = (int) (width * navIconWidthRatio);
|
||||
navIndicatorSize = navButtonSize / 10;
|
||||
navTargetWidth = (int) (targetWidth * 0.45f) - navButtonSize;
|
||||
paddingRight = (int) (displayContainer.width * 0.009375f); // not so accurate
|
||||
paddingLeft = navButtonSize + (int) (displayContainer.width * 0.0180f); // not so accurate
|
||||
paddingTextLeft = paddingLeft + LINEWIDTH + (int) (displayContainer.width * 0.00625f); // not so accurate
|
||||
paddingRight = (int) (width * 0.009375f); // not so accurate
|
||||
paddingLeft = navButtonSize + (int) (width * 0.0180f); // not so accurate
|
||||
paddingTextLeft = paddingLeft + LINEWIDTH + (int) (width * 0.00625f); // not so accurate
|
||||
optionStartX = paddingTextLeft;
|
||||
textOptionsY = Fonts.LARGE.getLineHeight() * 2;
|
||||
textChangeY = textOptionsY + Fonts.LARGE.getLineHeight();
|
||||
@@ -206,8 +205,8 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
sectionLineHeight = (int) (Fonts.LARGE.getLineHeight() * 1.5f);
|
||||
|
||||
if (active) {
|
||||
width = targetWidth;
|
||||
optionWidth = width - optionStartX - paddingRight;
|
||||
currentWidth = targetWidth;
|
||||
optionWidth = currentWidth - optionStartX - paddingRight;
|
||||
}
|
||||
|
||||
optionHeight = (int) (Fonts.MEDIUM.getLineHeight() * 1.3f);
|
||||
@@ -267,11 +266,11 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
|
||||
@Override
|
||||
public void onRender(Graphics g) {
|
||||
g.setClip(navButtonSize, 0, width - navButtonSize, height);
|
||||
g.setClip(navButtonSize, 0, currentWidth - navButtonSize, height);
|
||||
|
||||
// bg
|
||||
g.setColor(COL_BG);
|
||||
g.fillRect(navButtonSize, 0, width, height);
|
||||
g.fillRect(navButtonSize, 0, currentWidth, height);
|
||||
|
||||
// title
|
||||
renderTitle();
|
||||
@@ -291,13 +290,13 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
|
||||
// scrollbar
|
||||
g.setColor(COL_WHITE);
|
||||
g.fillRect(width - 5, scrollHandler.getPosition() / maxScrollOffset * (height - 45), 5, 45);
|
||||
g.fillRect(currentWidth - 5, scrollHandler.getPosition() / maxScrollOffset * (height - 45), 5, 45);
|
||||
g.clearClip();
|
||||
|
||||
renderNavigation(g);
|
||||
|
||||
// UI
|
||||
UI.getBackButton().draw(g);
|
||||
backButton.draw(g);
|
||||
|
||||
// tooltip
|
||||
renderTooltip(g);
|
||||
@@ -373,16 +372,16 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
indicatorPos += AnimationEquation.OUT_BACK.calc((float) indicatorMoveAnimationTime / INDICATORMOVEANIMATIONTIME) * indicatorOffsetToNextPos;
|
||||
}
|
||||
}
|
||||
g.fillRect(navButtonSize, indicatorPos - scrollHandler.getPosition(), width, optionHeight);
|
||||
g.fillRect(navButtonSize, indicatorPos - scrollHandler.getPosition(), currentWidth, optionHeight);
|
||||
}
|
||||
|
||||
private void renderKeyEntry(Graphics g) {
|
||||
g.setColor(COL_BG);
|
||||
g.fillRect(0, 0, displayContainer.width, height);
|
||||
g.fillRect(0, 0, width, height);
|
||||
g.setColor(COL_WHITE);
|
||||
String prompt = (keyEntryLeft) ? "Please press the new left-click key." : "Please press the new right-click key.";
|
||||
int y = (displayContainer.height - Fonts.LARGE.getLineHeight()) / 2;
|
||||
FontUtil.drawCentered(Fonts.LARGE, displayContainer.width, 0, y, prompt, COL_WHITE);
|
||||
int y = height2 - Fonts.LARGE.getLineHeight() / 2;
|
||||
FontUtil.drawCentered(Fonts.LARGE, width, 0, y, prompt, COL_WHITE);
|
||||
}
|
||||
|
||||
private void renderTooltip(Graphics g) {
|
||||
@@ -413,7 +412,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
if (section != activeSection) {
|
||||
COL_CYAN.a *= 0.2f;
|
||||
}
|
||||
FontUtil.drawRightAligned(Fonts.XLARGE, width, -paddingRight,
|
||||
FontUtil.drawRightAligned(Fonts.XLARGE, currentWidth, -paddingRight,
|
||||
(int) (y + Fonts.XLARGE.getLineHeight() * 0.3f), section.name.toUpperCase(),
|
||||
COL_CYAN);
|
||||
COL_CYAN.a = previousAlpha;
|
||||
@@ -569,7 +568,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
}
|
||||
|
||||
private void renderTitle() {
|
||||
int textWidth = width - navButtonSize;
|
||||
int textWidth = currentWidth - navButtonSize;
|
||||
FontUtil.drawCentered(Fonts.LARGE, textWidth, navButtonSize,
|
||||
textOptionsY - scrollHandler.getIntPosition(), "Options", COL_WHITE);
|
||||
FontUtil.drawCentered(Fonts.MEDIUM, textWidth, navButtonSize,
|
||||
@@ -581,7 +580,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
if (scrollHandler.getIntPosition() > posSearchY) {
|
||||
ypos = textSearchYOffset;
|
||||
g.setColor(COL_BG);
|
||||
g.fillRect(navButtonSize, 0, width, textSearchYOffset * 2 + Fonts.LARGE.getLineHeight());
|
||||
g.fillRect(navButtonSize, 0, currentWidth, textSearchYOffset * 2 + Fonts.LARGE.getLineHeight());
|
||||
}
|
||||
Color searchCol = COL_WHITE;
|
||||
float invalidProgress = 0f;
|
||||
@@ -597,7 +596,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
if (lastSearchText.length() > 0) {
|
||||
searchText = lastSearchText;
|
||||
}
|
||||
int textWidth = width - navButtonSize;
|
||||
int textWidth = currentWidth - navButtonSize;
|
||||
if (invalidSearchAnimationProgress > 0) {
|
||||
g.rotate(navButtonSize + textWidth / 2, ypos, invalidProgress * invalidSearchTextRotation);
|
||||
}
|
||||
@@ -684,7 +683,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
prevMouseY = mouseY;
|
||||
updateHoverOption(mouseX, mouseY);
|
||||
updateIndicatorAlpha();
|
||||
UI.getBackButton().hoverUpdate(delta, mouseX, mouseY);
|
||||
backButton.hoverUpdate(delta, mouseX, mouseY);
|
||||
if (isAdjustingSlider) {
|
||||
int sliderValue = ((NumericOption) hoverOption).val;
|
||||
updateSliderOption();
|
||||
@@ -737,11 +736,11 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
private void updateShowHideAnimation(int delta) {
|
||||
if (acceptInput && animationtime >= SHOWANIMATIONTIME) {
|
||||
// animation already finished
|
||||
width = targetWidth;
|
||||
currentWidth = targetWidth;
|
||||
showHideProgress = 1f;
|
||||
return;
|
||||
}
|
||||
optionWidth = width - optionStartX - paddingRight;
|
||||
optionWidth = currentWidth - optionStartX - paddingRight;
|
||||
|
||||
// navigation elemenst fade out with a different animation
|
||||
float navProgress;
|
||||
@@ -763,7 +762,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
navProgress = hideAnimationStartProgress * AnimationEquation.IN_CIRC.calc(showHideProgress);
|
||||
showHideProgress = hideAnimationStartProgress * AnimationEquation.IN_EXPO.calc(showHideProgress);
|
||||
}
|
||||
width = navButtonSize + (int) (showHideProgress * (targetWidth - navButtonSize));
|
||||
currentWidth = navButtonSize + (int) (showHideProgress * (targetWidth - navButtonSize));
|
||||
COL_NAV_FILTERED.a = COL_NAV_INACTIVE.a = COL_NAV_FILTERED_HOVERED.a = COL_NAV_INDICATOR.a =
|
||||
COL_NAV_WHITE.a = COL_NAV_BG.a = navProgress;
|
||||
COL_BG.a = BG_ALPHA * showHideProgress;
|
||||
@@ -782,7 +781,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (x > width) {
|
||||
if (x > currentWidth) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -874,7 +873,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
scrollHandler.scrollToPosition(sectionPosition);
|
||||
}
|
||||
|
||||
if (UI.getBackButton().contains(x, y)){
|
||||
if (backButton.contains(x, y)){
|
||||
hide();
|
||||
if (listener != null) {
|
||||
listener.onLeaveOptionsMenu();
|
||||
@@ -1011,7 +1010,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||
return;
|
||||
}
|
||||
hoverOption = null;
|
||||
if (mouseX > width) {
|
||||
if (mouseX > currentWidth) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import itdelatrisu.opsu.ui.Fonts;
|
||||
import org.newdawn.slick.Color;
|
||||
import org.newdawn.slick.Graphics;
|
||||
import yugecin.opsudance.ObjectColorOverrides;
|
||||
import yugecin.opsudance.core.DisplayContainer;
|
||||
import yugecin.opsudance.core.state.OverlayOpsuState;
|
||||
import yugecin.opsudance.options.OptionTab;
|
||||
import yugecin.opsudance.sbv2.MoveStoryboard;
|
||||
@@ -35,14 +34,12 @@ import java.util.*;
|
||||
|
||||
import static org.lwjgl.input.Keyboard.*;
|
||||
import static yugecin.opsudance.options.Options.*;
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class StoryboardOverlay extends OverlayOpsuState implements OptionsOverlay.Listener {
|
||||
|
||||
private final static List<Option> optionList = new ArrayList<>();
|
||||
|
||||
private final DisplayContainer displayContainer;
|
||||
|
||||
private boolean hide;
|
||||
|
||||
private int speed;
|
||||
@@ -62,8 +59,7 @@ public class StoryboardOverlay extends OverlayOpsuState implements OptionsOverla
|
||||
}
|
||||
}
|
||||
|
||||
public StoryboardOverlay(DisplayContainer displayContainer, MoveStoryboard msb, OptionsOverlay optionsOverlay, Game game) {
|
||||
this.displayContainer = displayContainer;
|
||||
public StoryboardOverlay(MoveStoryboard msb, OptionsOverlay optionsOverlay, Game game) {
|
||||
this.msb = msb;
|
||||
this.optionsOverlay = optionsOverlay;
|
||||
this.game = game;
|
||||
@@ -78,18 +74,18 @@ public class StoryboardOverlay extends OverlayOpsuState implements OptionsOverla
|
||||
return;
|
||||
}
|
||||
int lh = Fonts.SMALL.getLineHeight();
|
||||
Fonts.SMALL.drawString(10, displayContainer.height - 50 + lh, "save position: ctrl+s, load position: ctrl+l", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, displayContainer.height - 50, "speed: C " + (speed / 10f) + " V", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, displayContainer.height - 50 - lh, "Menu: N", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, displayContainer.height - 50 - lh * 2, "HIDE: H", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, displayContainer.height - 50 - lh * 3, "obj: J " + index + " K", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, height - 50 + lh, "save position: ctrl+s, load position: ctrl+l", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, height - 50, "speed: C " + (speed / 10f) + " V", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, height - 50 - lh, "Menu: N", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, height - 50 - lh * 2, "HIDE: H", Color.cyan);
|
||||
Fonts.SMALL.drawString(10, height - 50 - lh * 3, "obj: J " + index + " K", Color.cyan);
|
||||
g.setColor(Color.red);
|
||||
if (index < optionsMap.length && optionsMap[index] != null) {
|
||||
int i = 0;
|
||||
for (Object o : optionsMap[index].entrySet()) {
|
||||
Map.Entry<Option, String> option = (Map.Entry<Option, String>) o;
|
||||
Fonts.SMALL.drawString(10, 50 + i * lh, option.getKey().name, Color.cyan);
|
||||
Fonts.SMALL.drawString(displayContainer.width / 5, 50 + i * lh, option.getKey().getValueString(), Color.cyan);
|
||||
Fonts.SMALL.drawString(width / 5, 50 + i * lh, option.getKey().getValueString(), Color.cyan);
|
||||
g.fillRect(0, 50 + i * lh + lh / 4, 10, 10);
|
||||
i++;
|
||||
}
|
||||
@@ -98,7 +94,7 @@ public class StoryboardOverlay extends OverlayOpsuState implements OptionsOverla
|
||||
int start = gameObjects[0].getTime();
|
||||
int end = gameObjects[gameObjects.length - 1].getEndTime();
|
||||
float curtime = (float) (MusicController.getPosition() - start) / (end - start);
|
||||
g.fillRect(curtime * displayContainer.width, displayContainer.height - 10f, 10f, 10f);
|
||||
g.fillRect(curtime * width, height - 10f, 10f, 10f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user