mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 08:31:32 +01:00
Better Scroll
This commit is contained in:
parent
441d373bb4
commit
b539f0715c
@ -21,6 +21,7 @@ import net.silentclient.client.gui.util.RenderUtil;
|
||||
import net.silentclient.client.utils.*;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
@ -102,11 +103,13 @@ public class SilentResourcePacksGui extends SilentScreen {
|
||||
RenderUtils.drawRect(blockX, blockY, blockWidth, blockHeight, Theme.backgroundColor().getRGB());
|
||||
Client.getInstance().getSilentFontRenderer().drawString("Resource Packs", blockX + 5, blockY + 5, 14, SilentFontRenderer.FontType.TITLE);
|
||||
|
||||
MouseCursorHandler.CursorType cursorType1 = this.drawAvailableResourcePacks(blockX + 5, blockY + 14 + 5 + 2, mouseX, mouseY);
|
||||
int wheel = Mouse.getDWheel();
|
||||
|
||||
MouseCursorHandler.CursorType cursorType1 = this.drawAvailableResourcePacks(blockX + 5, blockY + 14 + 5 + 2, mouseX, mouseY, wheel);
|
||||
if(cursorType1 != null) {
|
||||
cursorType = cursorType1;
|
||||
}
|
||||
MouseCursorHandler.CursorType cursorType2 = this.drawActiveResourcePacks(blockX + blockWidth - 193 - 5, blockY + 14 + 5 + 2, mouseX, mouseY);
|
||||
MouseCursorHandler.CursorType cursorType2 = this.drawActiveResourcePacks(blockX + blockWidth - 193 - 5, blockY + 14 + 5 + 2, mouseX, mouseY, wheel);
|
||||
if(cursorType2 != null) {
|
||||
cursorType = cursorType2;
|
||||
}
|
||||
@ -116,7 +119,7 @@ public class SilentResourcePacksGui extends SilentScreen {
|
||||
Client.getInstance().getMouseCursorHandler().enableCursor(cursorType);
|
||||
}
|
||||
|
||||
private MouseCursorHandler.CursorType drawAvailableResourcePacks(float x, float y, int mouseX, int mouseY) {
|
||||
private MouseCursorHandler.CursorType drawAvailableResourcePacks(float x, float y, int mouseX, int mouseY, int wheel) {
|
||||
MouseCursorHandler.CursorType cursorType = null;
|
||||
RenderUtil.drawRoundedOutline(x, y, 193, blockHeight - 45, 3, 1, Theme.borderColor().getRGB());
|
||||
scrollHelper.setStep(5);
|
||||
@ -130,7 +133,7 @@ public class SilentResourcePacksGui extends SilentScreen {
|
||||
scrollHelper.setFlag(false);
|
||||
}
|
||||
|
||||
float scrollY = scrollHelper.getScroll();
|
||||
float scrollY = scrollHelper.getScroll(wheel);
|
||||
|
||||
float itemY = y + 19 + scrollY;
|
||||
|
||||
@ -195,7 +198,7 @@ public class SilentResourcePacksGui extends SilentScreen {
|
||||
}
|
||||
}
|
||||
|
||||
private MouseCursorHandler.CursorType drawActiveResourcePacks(float x, float y, int mouseX, int mouseY) {
|
||||
private MouseCursorHandler.CursorType drawActiveResourcePacks(float x, float y, int mouseX, int mouseY, int wheel) {
|
||||
MouseCursorHandler.CursorType cursorType = null;
|
||||
RenderUtil.drawRoundedOutline(x, y, 193, blockHeight - 45, 3, 1, Theme.borderColor().getRGB());
|
||||
scrollHelper2.setStep(5);
|
||||
@ -207,7 +210,7 @@ public class SilentResourcePacksGui extends SilentScreen {
|
||||
} else {
|
||||
scrollHelper2.setFlag(false);
|
||||
}
|
||||
float scrollY = scrollHelper2.getScroll();
|
||||
float scrollY = scrollHelper2.getScroll(wheel);
|
||||
Scissor.start((int) x, (int) y, 193, blockHeight - 45);
|
||||
Client.getInstance().getSilentFontRenderer().drawString("Active", x + 3, y + 3 + scrollY, 14, SilentFontRenderer.FontType.TITLE);
|
||||
|
||||
|
@ -8,14 +8,14 @@ public class ScrollHelper {
|
||||
private float step = 0,real = 0,scroll = 0,elementsHeight = 0,maxScroll = 0,speed = 300F;
|
||||
private boolean flag = true;
|
||||
|
||||
public float getScroll() {
|
||||
return getScroll(Mouse.getDWheel());
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the smoothed scroll value, only call this once after you set all the setters
|
||||
*/
|
||||
public float getScroll() {
|
||||
if(!flag) {
|
||||
return -scroll;
|
||||
}
|
||||
int wheel = Mouse.getDWheel();
|
||||
public float getScroll(int wheel) {
|
||||
float delta = 1f / Minecraft.getDebugFPS();
|
||||
if(flag)
|
||||
real -= wheel / 120f * step;
|
||||
|
Loading…
Reference in New Issue
Block a user