move logo to the beat
This commit is contained in:
parent
93a4af30d2
commit
86710f53b5
|
@ -271,7 +271,7 @@ public enum GameImage {
|
||||||
return img.getScaledCopy(w, h);
|
return img.getScaledCopy(w, h);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MENU_LOGO ("logo", "png", false, true) {
|
MENU_LOGO ("logo2", "png", false, true) {
|
||||||
@Override
|
@Override
|
||||||
protected Image process_sub(Image img, int w, int h) {
|
protected Image process_sub(Image img, int w, int h) {
|
||||||
return img.getScaledCopy(0.8f);
|
return img.getScaledCopy(0.8f);
|
||||||
|
|
|
@ -29,6 +29,7 @@ import itdelatrisu.opsu.audio.SoundEffect;
|
||||||
import itdelatrisu.opsu.beatmap.Beatmap;
|
import itdelatrisu.opsu.beatmap.Beatmap;
|
||||||
import itdelatrisu.opsu.beatmap.BeatmapSetList;
|
import itdelatrisu.opsu.beatmap.BeatmapSetList;
|
||||||
import itdelatrisu.opsu.beatmap.BeatmapSetNode;
|
import itdelatrisu.opsu.beatmap.BeatmapSetNode;
|
||||||
|
import itdelatrisu.opsu.beatmap.TimingPoint;
|
||||||
import itdelatrisu.opsu.downloads.Updater;
|
import itdelatrisu.opsu.downloads.Updater;
|
||||||
import itdelatrisu.opsu.states.ButtonMenu.MenuState;
|
import itdelatrisu.opsu.states.ButtonMenu.MenuState;
|
||||||
import itdelatrisu.opsu.ui.Colors;
|
import itdelatrisu.opsu.ui.Colors;
|
||||||
|
@ -269,7 +270,36 @@ public class MainMenu extends BasicGameState {
|
||||||
playButton.draw();
|
playButton.draw();
|
||||||
exitButton.draw();
|
exitButton.draw();
|
||||||
}
|
}
|
||||||
logo.draw();
|
|
||||||
|
float scale = 1f;
|
||||||
|
|
||||||
|
if (MusicController.isPlaying() && MusicController.getBeatmap() != null) {
|
||||||
|
Beatmap map = MusicController.getBeatmap();
|
||||||
|
TimingPoint p = null;
|
||||||
|
if (map.timingPoints != null) {
|
||||||
|
int time = 0;
|
||||||
|
float beatlen = 0f;
|
||||||
|
int i = 0;
|
||||||
|
for (TimingPoint pts : map.timingPoints) {
|
||||||
|
if (p == null || pts.getTime() < MusicController.getPosition()) {
|
||||||
|
i++;
|
||||||
|
p = pts;
|
||||||
|
if (!p.isInherited()) {
|
||||||
|
beatlen = p.getBeatLength();
|
||||||
|
time = p.getTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println(i);
|
||||||
|
if (p != null) {
|
||||||
|
double beatLength = beatlen * 100;
|
||||||
|
int realtime = MusicController.getPosition() * 100;
|
||||||
|
scale -= (0 - (((realtime - time * 100) % beatLength) / beatLength)) * 0.05;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logo.draw(Color.white, scale);
|
||||||
|
|
||||||
// draw music buttons
|
// draw music buttons
|
||||||
if (MusicController.isPlaying())
|
if (MusicController.isPlaying())
|
||||||
|
|
|
@ -191,14 +191,21 @@ public class MenuButton {
|
||||||
/**
|
/**
|
||||||
* Draws the button.
|
* Draws the button.
|
||||||
*/
|
*/
|
||||||
public void draw() { draw(Color.white); }
|
public void draw() { draw(Color.white, 1.0f); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw the button with a color filter.
|
* Draws the button with a color filter.
|
||||||
* @param filter the color to filter with when drawing
|
* @param filter the color to filter with when drawing
|
||||||
*/
|
*/
|
||||||
|
public void draw(Color filter) { draw(filter, 1.0f); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the button with a color filter and scale.
|
||||||
|
* @param filter the color to filter with when drawing
|
||||||
|
* @param scaleoverride the scale to use when drawing
|
||||||
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void draw(Color filter) {
|
public void draw(Color filter, float scaleoverride) {
|
||||||
// animations: get current frame
|
// animations: get current frame
|
||||||
Image image = this.img;
|
Image image = this.img;
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
|
@ -208,8 +215,15 @@ public class MenuButton {
|
||||||
|
|
||||||
// normal images
|
// normal images
|
||||||
if (imgL == null) {
|
if (imgL == null) {
|
||||||
|
float scaleposmodx = 0;
|
||||||
|
float scaleposmody = 0;
|
||||||
|
if (scaleoverride != 1f) {
|
||||||
|
image = image.getScaledCopy(scaleoverride);
|
||||||
|
scaleposmodx = image.getWidth() / 2 - xRadius;
|
||||||
|
scaleposmody = image.getHeight() / 2 - yRadius;
|
||||||
|
}
|
||||||
if (hoverEffect == 0)
|
if (hoverEffect == 0)
|
||||||
image.draw(x - xRadius, y - yRadius, filter);
|
image.draw(x - xRadius - scaleposmodx, y - yRadius - scaleposmody, filter);
|
||||||
else {
|
else {
|
||||||
float oldAlpha = image.getAlpha();
|
float oldAlpha = image.getAlpha();
|
||||||
float oldAngle = image.getRotation();
|
float oldAngle = image.getRotation();
|
||||||
|
@ -223,7 +237,7 @@ public class MenuButton {
|
||||||
image.setAlpha(alpha.getValue());
|
image.setAlpha(alpha.getValue());
|
||||||
if ((hoverEffect & EFFECT_ROTATE) > 0)
|
if ((hoverEffect & EFFECT_ROTATE) > 0)
|
||||||
image.setRotation(angle.getValue());
|
image.setRotation(angle.getValue());
|
||||||
image.draw(x - xRadius, y - yRadius, filter);
|
image.draw(x - xRadius - scaleposmodx, y - yRadius - scaleposmody, filter);
|
||||||
if (image == this.img) {
|
if (image == this.img) {
|
||||||
image.setAlpha(oldAlpha);
|
image.setAlpha(oldAlpha);
|
||||||
image.setRotation(oldAngle);
|
image.setRotation(oldAngle);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user