use of binnie.core.api.gui.Alignment in project Binnie by ForestryMC.
the class ControlTab method onRenderBackground.
@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
Object texture = CraftGUITexture.TAB_DISABLED;
if (this.isMouseOver()) {
texture = CraftGUITexture.TAB_HIGHLIGHTED;
} else if (this.isCurrentSelection()) {
texture = CraftGUITexture.TAB;
}
final ITexture lTexture = CraftGUI.RENDER.getTexture(texture);
final Alignment alignment = this.getTabPosition();
ITexture iTexture = lTexture.crop(alignment, 8);
final IArea area = this.getArea();
if (texture == CraftGUITexture.TAB_DISABLED) {
if (alignment == Alignment.TOP || alignment == Alignment.LEFT) {
area.setPosition(area.getPosition().sub(new Point(4 * alignment.x(), 4 * alignment.y())));
area.setSize(area.getSize().add(new Point(4 * alignment.x(), 4 * alignment.y())));
} else {
area.setSize(area.getSize().sub(new Point(4 * alignment.x(), 4 * alignment.y())));
}
}
CraftGUI.RENDER.texture(iTexture, area);
if (this instanceof ControlTabIcon) {
final ControlTabIcon icon = (ControlTabIcon) this;
final ControlItemDisplay item = (ControlItemDisplay) getFirstChild();
if (texture == CraftGUITexture.TAB_DISABLED) {
item.setColor(-1431655766);
} else {
item.setColor(-1);
}
if (icon.hasOutline()) {
iTexture = CraftGUI.RENDER.getTexture(CraftGUITexture.TAB_OUTLINE);
iTexture = iTexture.crop(alignment, 8);
RenderUtil.setColour(icon.getOutlineColour());
CraftGUI.RENDER.texture(iTexture, area.inset(2));
}
}
}
Aggregations