A bit more work
This commit is contained in:
parent
62743cfda7
commit
c38d0e4828
|
@ -98,6 +98,10 @@ public abstract class GuiElement
|
|||
return guiObj.getFont();
|
||||
}
|
||||
|
||||
protected void mouseClickMove(int mouseX, int mouseY, int button, long ticks) {}
|
||||
|
||||
protected void mouseMovedOrUp(int x, int y, int type) {}
|
||||
|
||||
public abstract Rectangle4i getBounds(int guiWidth, int guiHeight);
|
||||
|
||||
public abstract void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight);
|
||||
|
|
|
@ -274,9 +274,9 @@ public class GuiLogisticalSorter extends GuiMekanism
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void mouseMovedOrUp(int x, int y, int type)
|
||||
protected void mouseMovedOrUp(int mouseX, int mouseY, int type)
|
||||
{
|
||||
super.mouseMovedOrUp(x, y, type);
|
||||
super.mouseMovedOrUp(mouseX, mouseY, type);
|
||||
|
||||
if(type == 0 && isDragging)
|
||||
{
|
||||
|
|
|
@ -181,6 +181,34 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper
|
|||
return fontRendererObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove(int mouseX, int mouseY, int button, long ticks)
|
||||
{
|
||||
super.mouseClickMove(mouseX, mouseY, button, ticks);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
for(GuiElement element : guiElements)
|
||||
{
|
||||
element.mouseClickMove(xAxis, yAxis, button, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseMovedOrUp(int mouseX, int mouseY, int type)
|
||||
{
|
||||
super.mouseMovedOrUp(mouseX, mouseY, type);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
for(GuiElement element : guiElements)
|
||||
{
|
||||
element.mouseMovedOrUp(xAxis, yAxis, type);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleMouse(Slot slot, int slotIndex, int button, int modifier)
|
||||
{
|
||||
handleMouseClick(slot, slotIndex, button, modifier);
|
||||
|
|
|
@ -26,6 +26,8 @@ public class GuiScrollList extends GuiElement
|
|||
|
||||
public int scrollIndex;
|
||||
|
||||
public boolean isScrolling;
|
||||
|
||||
public GuiScrollList(IGuiWrapper gui, ResourceLocation def, int x, int y, int sizeX, int sizeY)
|
||||
{
|
||||
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiScrollList.png"), gui, def);
|
||||
|
@ -51,7 +53,7 @@ public class GuiScrollList extends GuiElement
|
|||
@Override
|
||||
public Rectangle4i getBounds(int guiWidth, int guiHeight)
|
||||
{
|
||||
return new Rectangle4i(guiWidth - 26, guiHeight + 6, 26, 26);
|
||||
return new Rectangle4i(guiWidth + xPosition, guiHeight + yPosition, xSize, size*10);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -98,7 +100,7 @@ public class GuiScrollList extends GuiElement
|
|||
|
||||
public int getMaxScroll()
|
||||
{
|
||||
return textEntries.size()-size;
|
||||
return size-2;
|
||||
}
|
||||
|
||||
public int getScroll()
|
||||
|
@ -109,7 +111,7 @@ public class GuiScrollList extends GuiElement
|
|||
@Override
|
||||
public void renderForeground(int xAxis, int yAxis)
|
||||
{
|
||||
if((scrollIndex > 0 && textEntries.size() <= size) || (scrollIndex > 0 && getMaxScroll() < scrollIndex))
|
||||
if((scrollIndex > 0 && textEntries.size() <= size) || (scrollIndex > 0 && textEntries.size()-size < scrollIndex))
|
||||
{
|
||||
scrollIndex = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue