mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-19 03:49:31 +00:00
Merge branch 'inventory_panel2'
This commit is contained in:
commit
ef26336fca
4 files changed
+39
-25
No files matched your search
@@ -116,16 +116,19 @@ public final class IconEIO {
|
||||
public static final IconEIO X_BUT_HOVER = new IconEIO(200, 48, 8, 8);
|
||||
public static final IconEIO X_BUT_HOVER_PRESSED = new IconEIO(200, 56, 8, 8);
|
||||
|
||||
public static final IconEIO UP_ARROW_OFF = new IconEIO(201, 64, 11, 8);
|
||||
public static final IconEIO UP_ARROW_ON = new IconEIO(212, 64, 11, 8);
|
||||
public static final IconEIO UP_ARROW_OFF = new IconEIO(212, 64, 11, 8);
|
||||
public static final IconEIO UP_ARROW_ON = new IconEIO(223, 64, 11, 8);
|
||||
public static final IconEIO UP_ARROW_HOVER_OFF = new IconEIO(234, 64, 11, 8);
|
||||
public static final IconEIO UP_ARROW_HOVER_ON = new IconEIO(245, 64, 11, 8);
|
||||
public static final IconEIO DOWN_ARROW_OFF = new IconEIO(201, 72, 11, 8);
|
||||
public static final IconEIO DOWN_ARROW_ON = new IconEIO(212, 72, 11, 8);
|
||||
public static final IconEIO DOWN_ARROW_OFF = new IconEIO(212, 72, 11, 8);
|
||||
public static final IconEIO DOWN_ARROW_ON = new IconEIO(223, 72, 11, 8);
|
||||
public static final IconEIO DOWN_ARROW_HOVER_OFF = new IconEIO(234, 72, 11, 8);
|
||||
public static final IconEIO DOWN_ARROW_HOVER_ON = new IconEIO(245, 72, 11, 8);
|
||||
public static final IconEIO VSCROLL_THUMB = new IconEIO(223, 64, 11, 8);
|
||||
public static final IconEIO VSCROLL_THUMB_HOVER = new IconEIO(223, 72, 11, 8);
|
||||
|
||||
public static final IconEIO VSCROLL_THUMB_OFF = new IconEIO(234, 80, 11, 8);
|
||||
public static final IconEIO VSCROLL_THUMB_HOVER_OFF = new IconEIO(234, 88, 11, 8);
|
||||
public static final IconEIO VSCROLL_THUMB_ON = new IconEIO(245, 80, 11, 8);
|
||||
public static final IconEIO VSCROLL_THUMB_HOVER_ON = new IconEIO(245, 88, 11, 8);
|
||||
|
||||
public static final IconEIO SOUND = new IconEIO(176, 208);
|
||||
|
||||
|
||||
@@ -42,13 +42,13 @@ public class VScrollbarEIO {
|
||||
xPosition = xOrigin + gui.getGuiLeft();
|
||||
yPosition = yOrigin + gui.getGuiTop();
|
||||
wholeArea = new Rectangle(xPosition, yPosition,
|
||||
(int)IconEIO.VSCROLL_THUMB.width, height);
|
||||
(int)IconEIO.VSCROLL_THUMB_OFF.width, height);
|
||||
btnUp = new Rectangle(xPosition, yPosition,
|
||||
(int)IconEIO.UP_ARROW_OFF.width, (int)IconEIO.UP_ARROW_OFF.height);
|
||||
btnDown = new Rectangle(xPosition, yPosition + Math.max(0, height - (int)IconEIO.DOWN_ARROW_OFF.height),
|
||||
(int)IconEIO.DOWN_ARROW_OFF.width, (int)IconEIO.DOWN_ARROW_OFF.height);
|
||||
thumbArea = new Rectangle(xPosition, yPosition + btnUp.height,
|
||||
(int)IconEIO.VSCROLL_THUMB.width, Math.max(0, height - (btnUp.height + btnDown.height)));
|
||||
(int)IconEIO.VSCROLL_THUMB_OFF.width, Math.max(0, height - (btnUp.height + btnDown.height)));
|
||||
}
|
||||
|
||||
public int getScrollPos() {
|
||||
@@ -112,10 +112,14 @@ public class VScrollbarEIO {
|
||||
|
||||
if(scrollMax > 0) {
|
||||
int thumbPos = getThumbPosition();
|
||||
boolean hoverThumb = thumbArea.contains(mouseX, mouseY) &&
|
||||
mouseY >= thumbPos && mouseY < thumbPos + (int)IconEIO.VSCROLL_THUMB.height;
|
||||
|
||||
IconEIO iconThumb = hoverThumb ? IconEIO.VSCROLL_THUMB_HOVER : IconEIO.VSCROLL_THUMB;
|
||||
boolean hoverThumb = thumbArea.contains(mouseX, mouseY) && mouseY >= thumbPos && mouseY < thumbPos + (int) IconEIO.VSCROLL_THUMB_OFF.height;
|
||||
|
||||
IconEIO iconThumb;
|
||||
if(pressedThumb) {
|
||||
iconThumb = IconEIO.VSCROLL_THUMB_HOVER_ON;
|
||||
} else {
|
||||
iconThumb = hoverThumb ? IconEIO.VSCROLL_THUMB_HOVER_OFF : IconEIO.VSCROLL_THUMB_OFF;
|
||||
}
|
||||
iconThumb.renderIcon(thumbArea.x, thumbPos, false);
|
||||
}
|
||||
|
||||
@@ -128,7 +132,7 @@ public class VScrollbarEIO {
|
||||
if(scrollMax > 0 && thumbArea.contains(x, y)) {
|
||||
int thumbPos = getThumbPosition();
|
||||
pressedUp = y < thumbPos;
|
||||
pressedDown = y >= thumbPos + (int)IconEIO.VSCROLL_THUMB.height;
|
||||
pressedDown = y >= thumbPos + (int)IconEIO.VSCROLL_THUMB_OFF.height;
|
||||
pressedThumb = !pressedUp && !pressedDown;
|
||||
} else {
|
||||
pressedUp = btnUp.contains(x, y);
|
||||
@@ -147,8 +151,8 @@ public class VScrollbarEIO {
|
||||
|
||||
public boolean mouseClickMove(int x, int y, int button, long time) {
|
||||
if(pressedThumb) {
|
||||
int pos = y - (thumbArea.y + (int)IconEIO.VSCROLL_THUMB.height/2);
|
||||
int len = thumbArea.height - (int)IconEIO.VSCROLL_THUMB.height;
|
||||
int pos = y - (thumbArea.y + (int)IconEIO.VSCROLL_THUMB_OFF.height/2);
|
||||
int len = thumbArea.height - (int)IconEIO.VSCROLL_THUMB_OFF.height;
|
||||
if(len > 0) {
|
||||
setScrollPos(Math.round(pos * (float)scrollMax / (float)len));
|
||||
}
|
||||
@@ -175,7 +179,7 @@ public class VScrollbarEIO {
|
||||
}
|
||||
|
||||
protected int getThumbPosition() {
|
||||
return thumbArea.y + (thumbArea.height - (int)IconEIO.VSCROLL_THUMB.height) * scrollPos / scrollMax;
|
||||
return thumbArea.y + (thumbArea.height - (int)IconEIO.VSCROLL_THUMB_OFF.height) * scrollPos / scrollMax;
|
||||
}
|
||||
|
||||
protected int limitPos(int pos) {
|
||||
|
||||
@@ -74,19 +74,21 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
|
||||
focused = f;
|
||||
}
|
||||
}
|
||||
boolean hadOverlays = false;
|
||||
if(key == 1 || key == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
|
||||
if(!hideOverlays()) {
|
||||
if(focused == null) {
|
||||
this.mc.thePlayer.closeScreen();
|
||||
} else if(key == 1) {
|
||||
focused.setFocused(false);
|
||||
focused = null;
|
||||
}
|
||||
if(focused != null && key == 1) {
|
||||
focused.setFocused(false);
|
||||
focused = null;
|
||||
return;
|
||||
} else if(!hideOverlays()) {
|
||||
this.mc.thePlayer.closeScreen();
|
||||
return;
|
||||
} else {
|
||||
hadOverlays = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (c == '\t') {
|
||||
if(c == '\t') {
|
||||
for (int i = 0; i < textFields.size(); i++) {
|
||||
TextFieldEIO f = textFields.get(i);
|
||||
if (f.isFocused()) {
|
||||
@@ -101,6 +103,11 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (hadOverlays) {
|
||||
return;
|
||||
}
|
||||
|
||||
super.keyTyped(c, key);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user