Kinetic Scrolling Fixes
This commit is contained in:
parent
133241f630
commit
d69e5fa5e7
|
@ -41,7 +41,7 @@ import itdelatrisu.opsu.downloads.servers.YaSOnlineServer;
|
|||
import itdelatrisu.opsu.ui.Colors;
|
||||
import itdelatrisu.opsu.ui.DropdownMenu;
|
||||
import itdelatrisu.opsu.ui.Fonts;
|
||||
import itdelatrisu.opsu.ui.KinecticScrolling;
|
||||
import itdelatrisu.opsu.ui.KineticScrolling;
|
||||
import itdelatrisu.opsu.ui.MenuButton;
|
||||
import itdelatrisu.opsu.ui.UI;
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class DownloadsMenu extends BasicGameState {
|
|||
private int focusTimer = 0;
|
||||
|
||||
/** Current start result button (topmost entry). */
|
||||
KinecticScrolling startResultPos = new KinecticScrolling();
|
||||
KineticScrolling startResultPos = new KineticScrolling();
|
||||
|
||||
/** Total number of results for current query. */
|
||||
private int totalResults = 0;
|
||||
|
@ -116,7 +116,7 @@ public class DownloadsMenu extends BasicGameState {
|
|||
private boolean rankedOnly = true;
|
||||
|
||||
/** Current start download index. */
|
||||
KinecticScrolling startDownloadIndexPos = new KinecticScrolling();
|
||||
KineticScrolling startDownloadIndexPos = new KineticScrolling();
|
||||
|
||||
/** Query thread. */
|
||||
private Thread queryThread;
|
||||
|
|
|
@ -44,7 +44,7 @@ import itdelatrisu.opsu.beatmap.OszUnpacker;
|
|||
import itdelatrisu.opsu.db.BeatmapDB;
|
||||
import itdelatrisu.opsu.db.ScoreDB;
|
||||
import itdelatrisu.opsu.states.ButtonMenu.MenuState;
|
||||
import itdelatrisu.opsu.ui.KinecticScrolling;
|
||||
import itdelatrisu.opsu.ui.KineticScrolling;
|
||||
import itdelatrisu.opsu.ui.Colors;
|
||||
import itdelatrisu.opsu.ui.Fonts;
|
||||
import itdelatrisu.opsu.ui.MenuButton;
|
||||
|
@ -138,7 +138,7 @@ public class SongMenu extends BasicGameState {
|
|||
private BeatmapSetNode startNode;
|
||||
|
||||
/** The first node is about this high above the header. */
|
||||
KinecticScrolling songScrolling = new KinecticScrolling();
|
||||
KineticScrolling songScrolling = new KineticScrolling();
|
||||
|
||||
/** The number of Nodes to offset from the top to the startNode. */
|
||||
private int startNodeOffset;
|
||||
|
@ -210,7 +210,7 @@ public class SongMenu extends BasicGameState {
|
|||
private ScoreData[] focusScores;
|
||||
|
||||
/** Current start score (topmost score entry). */
|
||||
KinecticScrolling startScorePos = new KinecticScrolling();
|
||||
KineticScrolling startScorePos = new KineticScrolling();
|
||||
|
||||
|
||||
/** Header and footer end and start y coordinates, respectively. */
|
||||
|
@ -380,13 +380,13 @@ public class SongMenu extends BasicGameState {
|
|||
|
||||
// song buttons
|
||||
BeatmapSetNode node = startNode;
|
||||
int startNodeOffsetoffset = 0;
|
||||
if (node.prev != null) {
|
||||
startNodeOffsetoffset = -1;
|
||||
int songButtonIndex = 0;
|
||||
if (node != null && node.prev != null) {
|
||||
node = node.prev;
|
||||
songButtonIndex = -1;
|
||||
}
|
||||
g.setClip(0, (int) (headerY + DIVIDER_LINE_WIDTH / 2), width, (int) (footerY - headerY));
|
||||
for (int i = startNodeOffset + startNodeOffsetoffset; i < MAX_SONG_BUTTONS + 1 && node != null; i++, node = node.next) {
|
||||
for (int i = startNodeOffset + songButtonIndex; i < MAX_SONG_BUTTONS + 1 && node != null; i++, node = node.next) {
|
||||
// draw the node
|
||||
float offset = (node == hoverIndex) ? hoverOffset.getValue() : 0f;
|
||||
float ypos = buttonY + (i*buttonOffset) ;
|
||||
|
@ -577,9 +577,6 @@ public class SongMenu extends BasicGameState {
|
|||
(searchResultString == null) ? "Searching..." : searchResultString, Color.white);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// reloading beatmaps
|
||||
if (reloadThread != null) {
|
||||
// darken the screen
|
||||
|
@ -1265,7 +1262,7 @@ public class SongMenu extends BasicGameState {
|
|||
buttonY = -songNodePosDrawn + buttonOffset * startNodeIndex + headerY - DIVIDER_LINE_WIDTH;
|
||||
|
||||
float max = (BeatmapSetList.get().size() + (focusNode != null ? focusNode.getBeatmapSet().size() : 0));
|
||||
songScrolling.setMinMax(0 - buttonOffset * 3, (max - MAX_SONG_BUTTONS- 1 + 3) * buttonOffset);
|
||||
songScrolling.setMinMax(0 - buttonOffset * 2, (max - MAX_SONG_BUTTONS- 1 + 2) * buttonOffset);
|
||||
|
||||
//negative startNodeIndex means the first Node is below the header so offset it.
|
||||
if (startNodeIndex <= 0) {
|
||||
|
@ -1316,7 +1313,6 @@ public class SongMenu extends BasicGameState {
|
|||
if (node.index != expandedIndex) {
|
||||
node = BeatmapSetList.get().expand(node.index);
|
||||
|
||||
|
||||
// calculate difficulties
|
||||
calculateStarRatings(node.getBeatmapSet());
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ package itdelatrisu.opsu.ui;
|
|||
*
|
||||
* @author fluddokt (https://github.com/fluddokt)
|
||||
*/
|
||||
public class KinecticScrolling {
|
||||
public class KineticScrolling {
|
||||
|
||||
/** The moving averaging constant */
|
||||
final static private float AVG_CONST = 0.2f;
|
|
@ -1240,6 +1240,8 @@ public class Input {
|
|||
|
||||
pressedX = (int) (xoffset + (Mouse.getEventX() * scaleX));
|
||||
pressedY = (int) (yoffset + ((height-Mouse.getEventY()) * scaleY));
|
||||
lastMouseX = pressedX;
|
||||
lastMouseY = pressedY;
|
||||
|
||||
for (int i=0;i<mouseListeners.size();i++) {
|
||||
MouseListener listener = (MouseListener) mouseListeners.get(i);
|
||||
|
|
Loading…
Reference in New Issue
Block a user