mainmenu: fix logo and buttons misplacement after resolution change

This commit is contained in:
yugecin 2018-07-08 11:07:27 +02:00
parent 04646f7d2a
commit f85b4ec526
No known key found for this signature in database
GPG Key ID: 2C5AC035A7068E44
2 changed files with 6 additions and 4 deletions

View File

@ -160,6 +160,8 @@ public class MainMenu extends BaseOpsuState {
this.nowPlayingPosition = new AnimatedValue(1000, 0, 0, OUT_QUART); this.nowPlayingPosition = new AnimatedValue(1000, 0, 0, OUT_QUART);
this.logoClickScale = new AnimatedValue(300, .9f, 1f, OUT_QUAD); this.logoClickScale = new AnimatedValue(300, .9f, 1f, OUT_QUAD);
this.logoHover = new AnimatedValue(350, 1f, 1.096f, IN_OUT_EXPO); this.logoHover = new AnimatedValue(350, 1f, 1.096f, IN_OUT_EXPO);
this.logoPosition = new AnimatedValue(1, 0, 1, AnimationEquation.OUT_QUAD);
this.logoButtonAlpha = new AnimatedValue(200, 0f, 1f, AnimationEquation.LINEAR);
this.buttonAnimation = new AnimatedValue(1, 0f, 1f, OUT_QUAD); this.buttonAnimation = new AnimatedValue(1, 0f, 1f, OUT_QUAD);
this.buttonAnimations = new AnimatedValue[3]; this.buttonAnimations = new AnimatedValue[3];
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
@ -248,9 +250,8 @@ public class MainMenu extends BaseOpsuState {
// logo & buttons // logo & buttons
this.logo = new ImagePosition(MENU_LOGO.getImage()); this.logo = new ImagePosition(MENU_LOGO.getImage());
logoPositionOffsetX = 0.35f * MENU_LOGO.getHeight(); this.logoPositionOffsetX = 0.35f * MENU_LOGO.getHeight();
logoPosition = new AnimatedValue(1, 0, 1, AnimationEquation.OUT_QUAD); this.logoPosition.setValues(0, logoPositionOffsetX);
logoButtonAlpha = new AnimatedValue(200, 0f, 1f, AnimationEquation.LINEAR);
this.buttonsX = width2 - MENU_OPTIONS.getWidth() / 2; this.buttonsX = width2 - MENU_OPTIONS.getWidth() / 2;
this.buttonPositions[0] = new ImagePosition(MENU_PLAY.getImage()); this.buttonPositions[0] = new ImagePosition(MENU_PLAY.getImage());
this.buttonPositions[1] = new ImagePosition(MENU_OPTIONS.getImage()); this.buttonPositions[1] = new ImagePosition(MENU_OPTIONS.getImage());
@ -394,6 +395,7 @@ public class MainMenu extends BaseOpsuState {
if (this.nowPlayingPosition.getMax() != totalWidth) { if (this.nowPlayingPosition.getMax() != totalWidth) {
final float current = this.nowPlayingPosition.getValue(); final float current = this.nowPlayingPosition.getValue();
this.nowPlayingPosition.setValues(current, totalWidth); this.nowPlayingPosition.setValues(current, totalWidth);
this.nowPlayingPosition.setTime(0);
} }
final float npimgx = width - this.nowPlayingPosition.getValue(); final float npimgx = width - this.nowPlayingPosition.getValue();
final float npx = npimgx + npwidth; final float npx = npimgx + npwidth;

View File

@ -82,7 +82,7 @@ public class AnimatedValue {
this.base = min; this.base = min;
this.value = min; this.value = min;
this.diff = max - min; this.diff = max - min;
this.setTime(0); this.updateValue();
} }
/** /**