mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 14:19:13 +00:00
Failed attempts at fixing scroll lists within scrolls
This commit is contained in:
1 parent
767ebc5131
commit
f9483b8292
2 files changed
+11
-15
No files matched your search
@@ -43,7 +43,8 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
public boolean closeOnEsc = false;
|
||||
public int guiLeft,guiTop,xSize,ySize;
|
||||
private SubGuiInterface subgui;
|
||||
public int mouseX, mouseY;
|
||||
public int mouseX, mouseY, mouseScroll;
|
||||
public static boolean recordScroll = true;
|
||||
|
||||
public float bgScale = 1;
|
||||
public float bgScaleX = 1;
|
||||
@@ -237,7 +238,9 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
drawBackground();
|
||||
}
|
||||
|
||||
int scrolled = Mouse.getDWheel();
|
||||
if(recordScroll) {
|
||||
mouseScroll = Mouse.getDWheel();
|
||||
}
|
||||
|
||||
boolean subGui = hasSubGui();
|
||||
drawCenteredString(fontRendererObj, title, width / 2, guiTop + 4, 0xffffff);
|
||||
@@ -248,7 +251,7 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
}
|
||||
for(GuiCustomScroll scroll : scrolls.values()){
|
||||
scroll.updateSubGUI(subGui);
|
||||
scroll.drawScreen(i, j, f, !subGui && scroll.isMouseOver(i, j)?scrolled:0);
|
||||
scroll.drawScreen(i, j, f, !subGui && scroll.isMouseOver(i, j)?mouseScroll:0);
|
||||
}
|
||||
for(GuiScreen gui : extra.values())
|
||||
gui.drawScreen(i, j, f);
|
||||
@@ -264,7 +267,7 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
}
|
||||
}
|
||||
for(GuiScrollableComponent guiScrollableComponent : scrollableGuiInserts.values()){
|
||||
guiScrollableComponent.drawScreen(i, j, f, guiScrollableComponent.isMouseOver(i,j)?scrolled:0);
|
||||
guiScrollableComponent.drawScreen(i, j, f, guiScrollableComponent.isMouseOver(i,j)?mouseScroll:0);
|
||||
}
|
||||
|
||||
if(subgui != null)
|
||||
|
||||
@@ -58,13 +58,6 @@ public class GuiScrollableComponent extends GuiNPCInterface{
|
||||
super.initGui();
|
||||
scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
|
||||
addButton(new GuiNpcButton(0, 0, 0, "Testtt"));
|
||||
GuiCustomScroll scroll = new GuiCustomScroll(this, 0);
|
||||
scroll.setList(Arrays.asList("Test", "Testing2", "testing 3"));
|
||||
scroll.guiTop = 10;
|
||||
scroll.guiLeft = 30;
|
||||
addScroll(scroll);
|
||||
|
||||
float scrollPerc = 0;
|
||||
if((guiTop+clipHeight) != 0){
|
||||
scrollPerc = (nextScrollY) / (clipHeight);
|
||||
@@ -96,7 +89,7 @@ public class GuiScrollableComponent extends GuiNPCInterface{
|
||||
setClip(xPos, yPos, clipWidth-13, clipHeight);
|
||||
|
||||
GL11.glTranslatef(xPos, yPos-scrollY, 0);
|
||||
super.drawScreen(mouseX-xPos, (int) (mouseY-scrollY-yPos), partialTicks);
|
||||
super.drawScreen(mouseX-xPos, (int) (mouseY+scrollY-yPos), partialTicks);
|
||||
|
||||
this.drawDefaultBackground = drawBackground;
|
||||
|
||||
@@ -116,7 +109,9 @@ public class GuiScrollableComponent extends GuiNPCInterface{
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks, int mouseScroll){
|
||||
adjustScroll(mouseScroll);
|
||||
|
||||
GuiNPCInterface.recordScroll = false;
|
||||
this.drawScreen(mouseX, mouseY, partialTicks);
|
||||
GuiNPCInterface.recordScroll = true;
|
||||
}
|
||||
|
||||
private void drawScrollBar()
|
||||
@@ -156,7 +151,7 @@ public class GuiScrollableComponent extends GuiNPCInterface{
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton){
|
||||
super.mouseClicked(mouseX-xPos, (int) (mouseY-yPos+scrollY), mouseButton);
|
||||
super.mouseClicked(mouseX-xPos, (int) (mouseY-yPos+scrollY), mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,8 +170,6 @@ public class GuiScrollableComponent extends GuiNPCInterface{
|
||||
return;
|
||||
int scaleFactor = scaledResolution.getScaleFactor();
|
||||
|
||||
// if(drawingScrollbar)
|
||||
// width-=10;
|
||||
|
||||
//Correct the positions for Screen Space in OpenGL
|
||||
x*=scaleFactor;
|
||||
|
||||
Reference in new issue
Block a user