Bug fixes and tweaks.

- Check if other Desktop actions are supported (follow-up to #114).
- The cursor-middle image is no longer scaled (when clicking).
- Changed the options menu background image (created with Trianglify at http://qrohlf.com/trianglify/), and made it fit the entire page.
- Slightly increased minimum splash screen time.
- Switched more animations to use AnimatedValue.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-08-08 12:04:15 -05:00
parent cd59c332ab
commit 40ab94794f
8 changed files with 116 additions and 89 deletions

View File

@@ -135,8 +135,6 @@ public class Cursor {
if (cursorScale != 1f) {
cursor = cursor.getScaledCopy(cursorScale);
cursorTrail = cursorTrail.getScaledCopy(cursorScale);
if (hasMiddle)
cursorMiddle = cursorMiddle.getScaledCopy(cursorScale);
}
// TODO: use an image buffer

View File

@@ -26,6 +26,7 @@ import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.audio.SoundController;
import itdelatrisu.opsu.beatmap.BeatmapParser;
import itdelatrisu.opsu.replay.ReplayImporter;
import itdelatrisu.opsu.ui.animations.AnimatedValue;
import itdelatrisu.opsu.ui.animations.AnimationEquation;
import javax.swing.JOptionPane;
@@ -71,11 +72,8 @@ public class UI {
/** Whether or not to check the current tooltip for line breaks. */
private static boolean tooltipNewlines;
/** The current tooltip timer. */
private static int tooltipTimer = -1;
/** Duration, in milliseconds, to fade tooltips. */
private static final int TOOLTIP_FADE_TIME = 200;
/** The alpha level of the current tooltip (if any). */
private static AnimatedValue tooltipAlpha = new AnimatedValue(200, 0f, 1f, AnimationEquation.LINEAR);
// game-related variables
private static GameContainer container;
@@ -120,8 +118,7 @@ public class UI {
cursor.update(delta);
updateVolumeDisplay(delta);
updateBarNotification(delta);
if (tooltipTimer > 0)
tooltipTimer -= delta;
tooltipAlpha.update(-delta);
}
/**
@@ -363,12 +360,7 @@ public class UI {
if (s != null) {
tooltip = s;
tooltipNewlines = newlines;
if (tooltipTimer <= 0)
tooltipTimer = delta;
else
tooltipTimer += delta * 2;
if (tooltipTimer > TOOLTIP_FADE_TIME)
tooltipTimer = TOOLTIP_FADE_TIME;
tooltipAlpha.update(delta * 2);
}
}
@@ -378,7 +370,7 @@ public class UI {
* @param g the graphics context
*/
public static void drawTooltip(Graphics g) {
if (tooltipTimer <= 0 || tooltip == null)
if (tooltipAlpha.getTime() == 0 || tooltip == null)
return;
int containerWidth = container.getWidth(), containerHeight = container.getHeight();
@@ -411,7 +403,7 @@ public class UI {
y = margin;
// draw tooltip text inside a filled rectangle
float alpha = (float) tooltipTimer / TOOLTIP_FADE_TIME;
float alpha = tooltipAlpha.getValue();
float oldAlpha = Utils.COLOR_BLACK_ALPHA.a;
Utils.COLOR_BLACK_ALPHA.a = alpha;
g.setColor(Utils.COLOR_BLACK_ALPHA);
@@ -433,7 +425,7 @@ public class UI {
* Resets the tooltip.
*/
public static void resetTooltip() {
tooltipTimer = -1;
tooltipAlpha.setTime(0);
tooltip = null;
}