From c00b2b877a469ec8e81cef9ce3918f15d60d158a Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 29 Jan 2017 22:55:11 +0100 Subject: [PATCH] apply upstream fixes --- res/search.png | Bin 0 -> 730 bytes src/itdelatrisu/opsu/ui/KineticScrolling.java | 3 ++- src/org/newdawn/slick/gui/TextField.java | 25 +++++++----------- src/yugecin/opsudance/ui/OptionsOverlay.java | 7 ++--- 4 files changed, 16 insertions(+), 19 deletions(-) create mode 100644 res/search.png diff --git a/res/search.png b/res/search.png new file mode 100644 index 0000000000000000000000000000000000000000..48bd6e6d84cfa6072ba7a9e0c5b3ee60d266facc GIT binary patch literal 730 zcmV<00ww*4P)500001b5ch_0Itp) z=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;t)BPS^kd0!v9mK~z{r&6pul96=O@5r_y5fZza;5r_z? zvPVE5A|fIX5s@5#Dr623kpmzi5F8*PG6E415rK%LD2hT1|2H)=we$M#nV#9q7Jt>Z z%=W(5-TV5z?p}7Ps+z){Sc&)Itbykv!Dr5=7~2?lB~Hbacn~@9*|qp2@Ns<&VjI`s zTmKeQ^+$XVuFovCQ4sP=v8m{zc==r8zW62nm*|T=-B>+h1K(n7B7em<@uh+1v8B8b zqY;V?Lre2R9E#}E!e`jzL~`#6=UcP>hGcbm66a#DqXuj!_gvL|6wa@veV`OwsF}!H z(Q_)`jc^lUiL+(jKCq8C5s{w51c;CmV>$b7GHhs3tbfVUv^(5jz%f+#1)&<(WI{QsTm9lQ?N;AVRL(r|Q1>>vSP{^y{P5@76NQ|p!hPqsB;-j> zH_l;cSVk%;>dqN&gA=j7OEbBZGu#&B**}5mf1fy`ZNh=tY=G6yGa5DjIYQA<6#xJL M07*qoM6N<$g4pOnJOBUy literal 0 HcmV?d00001 diff --git a/src/itdelatrisu/opsu/ui/KineticScrolling.java b/src/itdelatrisu/opsu/ui/KineticScrolling.java index 04a20875..b373d893 100644 --- a/src/itdelatrisu/opsu/ui/KineticScrolling.java +++ b/src/itdelatrisu/opsu/ui/KineticScrolling.java @@ -115,7 +115,8 @@ public class KineticScrolling { amplitude = 0; target = position = max; } - } else if (position < min) { + } + if (position < min) { if (allowOverScroll) { scrollToPosition(min); } else { diff --git a/src/org/newdawn/slick/gui/TextField.java b/src/org/newdawn/slick/gui/TextField.java index d58610df..a989d2c4 100644 --- a/src/org/newdawn/slick/gui/TextField.java +++ b/src/org/newdawn/slick/gui/TextField.java @@ -96,7 +96,16 @@ public class TextField extends Component { } public void render(Graphics g) { - performKeyRepeat(); + if (lastKey != -1) { + if (displayContainer.input.isKeyDown(lastKey)) { + if (repeatTimer < System.currentTimeMillis()) { + repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL; + keyPressed(lastKey, lastChar); + } + } else { + lastKey = -1; + } + } Rectangle oldClip = g.getClip(); g.setWorldClip(x,y,width, height); @@ -136,20 +145,6 @@ public class TextField extends Component { g.setClip(oldClip); } - public void performKeyRepeat() { - if (lastKey == -1) { - return; - } - if (!displayContainer.input.isKeyDown(lastKey)) { - lastKey = -1; - return; - } - if (repeatTimer < System.currentTimeMillis()) { - repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL; - keyPressed(lastKey, lastChar); - } - } - public String getText() { return value; } diff --git a/src/yugecin/opsudance/ui/OptionsOverlay.java b/src/yugecin/opsudance/ui/OptionsOverlay.java index 43e1f733..f9808cb3 100644 --- a/src/yugecin/opsudance/ui/OptionsOverlay.java +++ b/src/yugecin/opsudance/ui/OptionsOverlay.java @@ -151,6 +151,8 @@ public class OptionsOverlay extends OverlayOpsuState { listHoverIndex = -1; searchField = new TextField(displayContainer, null, 0, 0, 0, 0); + searchField.setMaxLength(20); + scrollHandler = new KineticScrolling(); scrollHandler.setAllowOverScroll(true); } @@ -263,7 +265,7 @@ public class OptionsOverlay extends OverlayOpsuState { if (hoverOption.getType() == OptionType.NUMERIC) { tip = "(" + hoverOption.getValueString() + ") " + tip; } - UI.updateTooltip(displayContainer.renderDelta, tip, false); + UI.updateTooltip(displayContainer.renderDelta, tip, true); UI.drawTooltip(g); } } @@ -509,6 +511,7 @@ public class OptionsOverlay extends OverlayOpsuState { @Override public void hide() { + searchField.setFocused(false); acceptInput = false; SoundController.playSound(SoundEffect.MENUBACK); hideAnimationTime = animationtime; @@ -535,8 +538,6 @@ public class OptionsOverlay extends OverlayOpsuState { scrollHandler.update(delta); - searchField.performKeyRepeat(); - updateShowHideAnimation(delta); if (animationtime <= 0) { active = false;