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