mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-23 21:50:02 +00:00
Move shared button and scrollbar textures to UIWidgetTexture
This commit is contained in:
1 parent
09e3846bea
commit
5420c3d347
12 files changed
+186
-24
No files matched your search
@@ -0,0 +1,47 @@
|
||||
package codechicken.nei.theme;
|
||||
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.scroll.ScrollBar;
|
||||
import codechicken.nei.scroll.ScrollBar.OverflowType;
|
||||
import codechicken.nei.scroll.ScrollBar.ScrollType;
|
||||
|
||||
public final class UIWidgetTexture {
|
||||
|
||||
private static final DrawableResource[] BTN = UISprite
|
||||
.frames("widgets/button", 12, 12, 4, UISprite.DEFAULT_SPACE, new int[] { 2, 2, 2, 3 });
|
||||
|
||||
public static final DrawableResource BTN_NORMAL = BTN[0];
|
||||
public static final DrawableResource BTN_HOVER = BTN[1];
|
||||
public static final DrawableResource BTN_ACTIVE = BTN[2];
|
||||
public static final DrawableResource BTN_DISABLED = BTN[3];
|
||||
public static final ButtonSkin BUTTON = new ButtonSkin(BTN_NORMAL, BTN_HOVER, BTN_ACTIVE, BTN_DISABLED);
|
||||
|
||||
private static final int[] THUMB_INSET = new int[] { 1, 1, 1, 1 };
|
||||
|
||||
// frame 0 is the track, frame 1 the thumb drawn inside a transparent THUMB_INSET border of the same frame size
|
||||
public static final DrawableResource SCROLL_V_TRACK = UISprite
|
||||
.frames("widgets/scroll_v", 8, 11, 2, UISprite.DEFAULT_SPACE, new int[] { 1, 1, 1, 1 })[0];
|
||||
public static final DrawableResource SCROLL_V_THUMB = UISprite
|
||||
.frames("widgets/scroll_v", 6, 9, 2, THUMB_INSET, new int[] { 1, 1, 1, 2 })[1];
|
||||
|
||||
public static final DrawableResource SCROLL_H_TRACK = UISprite
|
||||
.frames("widgets/scroll_h", 11, 8, 2, UISprite.DEFAULT_SPACE, new int[] { 1, 1, 1, 1 })[0];
|
||||
public static final DrawableResource SCROLL_H_THUMB = UISprite
|
||||
.frames("widgets/scroll_h", 9, 6, 2, THUMB_INSET, new int[] { 1, 1, 2, 1 })[1];
|
||||
|
||||
public static final int SCROLL_TRACK_WIDTH = 8;
|
||||
|
||||
private UIWidgetTexture() {}
|
||||
|
||||
public static ScrollBar verticalScrollBar() {
|
||||
return new ScrollBar().setTrackWidth(SCROLL_TRACK_WIDTH).setOverflowType(OverflowType.SCROLL)
|
||||
.setTrackTexture(SCROLL_V_TRACK).setThumbTexture(SCROLL_V_THUMB).setThumbPadding(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
public static ScrollBar horizontalScrollBar() {
|
||||
return new ScrollBar().setScrollType(ScrollType.HORIZONTAL).setTrackWidth(SCROLL_TRACK_WIDTH)
|
||||
.setOverflowType(OverflowType.SCROLL).setTrackTexture(SCROLL_H_TRACK).setThumbTexture(SCROLL_H_THUMB)
|
||||
.setThumbPadding(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user