more easier access to common variables
This commit is contained in:
@@ -30,6 +30,7 @@ import yugecin.opsudance.Dancer;
|
||||
import yugecin.opsudance.skinning.SkinService;
|
||||
|
||||
import static yugecin.opsudance.options.Options.*;
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
|
||||
/**
|
||||
* Updates and draws the cursor.
|
||||
@@ -252,8 +253,8 @@ public class Cursor {
|
||||
* If the old style cursor is being used, this will do nothing.
|
||||
* @param delta the delta interval since the last call
|
||||
*/
|
||||
public void updateAngle(int delta) {
|
||||
cursorAngle += delta / 40f;
|
||||
public void updateAngle() {
|
||||
cursorAngle += renderDelta / 40f;
|
||||
cursorAngle %= 360;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,15 +29,14 @@ import org.newdawn.slick.Graphics;
|
||||
import org.newdawn.slick.Image;
|
||||
import org.newdawn.slick.Input;
|
||||
import org.newdawn.slick.UnicodeFont;
|
||||
import yugecin.opsudance.core.DisplayContainer;
|
||||
import yugecin.opsudance.core.components.Component;
|
||||
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
|
||||
public class DropdownMenu<E> extends Component {
|
||||
|
||||
private static final float PADDING_Y = 0.1f, CHEVRON_X = 0.03f;
|
||||
|
||||
private final DisplayContainer displayContainer;
|
||||
|
||||
private E[] items;
|
||||
private String[] itemNames;
|
||||
private int selectedItemIndex;
|
||||
@@ -61,8 +60,7 @@ public class DropdownMenu<E> extends Component {
|
||||
private Image chevronDown;
|
||||
private Image chevronRight;
|
||||
|
||||
public DropdownMenu(DisplayContainer displayContainer, E[] items, int x, int y, int width) {
|
||||
this.displayContainer = displayContainer;
|
||||
public DropdownMenu(E[] items, int x, int y, int width) {
|
||||
init(items, x, y, width);
|
||||
}
|
||||
|
||||
@@ -143,13 +141,13 @@ public class DropdownMenu<E> extends Component {
|
||||
|
||||
@Override
|
||||
public void render(Graphics g) {
|
||||
int delta = displayContainer.renderDelta;
|
||||
int delta = renderDelta;
|
||||
|
||||
// update animation
|
||||
expandProgress.update((expanded) ? delta : -delta * 2);
|
||||
|
||||
// get parameters
|
||||
int idx = getIndexAt(displayContainer.mouseY);
|
||||
int idx = getIndexAt(mouseY);
|
||||
float t = expandProgress.getValue();
|
||||
if (expanded) {
|
||||
t = AnimationEquation.OUT_CUBIC.calc(t);
|
||||
@@ -245,7 +243,7 @@ public class DropdownMenu<E> extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
int idx = getIndexAt(displayContainer.mouseY);
|
||||
int idx = getIndexAt(mouseY);
|
||||
if (idx == -2) {
|
||||
this.expanded = false;
|
||||
return;
|
||||
|
||||
@@ -279,8 +279,8 @@ public class UI {
|
||||
textWidth += Fonts.SMALL.getWidth(tooltip);
|
||||
|
||||
// get drawing coordinates
|
||||
int x = displayContainer.mouseX + offset;
|
||||
int y = displayContainer.mouseY + offset;
|
||||
int x = mouseX + offset;
|
||||
int y = mouseY + offset;
|
||||
if (x + textWidth > width - margin)
|
||||
x = width - margin - textWidth;
|
||||
else if (x < margin)
|
||||
|
||||
Reference in New Issue
Block a user