Gui rendering cleanup

This commit is contained in:
mezz committed 2017-01-24 20:53:27 -08:00
1 parent 17f036522e
commit 31a305ffc2
173 files changed
+1317 -1349

No files matched your search

@@ -10,7 +10,7 @@ class ControlBranchBox extends ControlListBox<IClassification> {
return new ControlBranchBoxOption(this.getContent(), value, y);
}
public ControlBranchBox(final IWidget parent, final float x, final float y, final float width, final float height) {
super(parent, x, y, width, height, 12.0f);
public ControlBranchBox(final IWidget parent, final int x, final int y, final int width, final int height) {
super(parent, x, y, width, height, 12);
}
}
@@ -23,10 +23,10 @@ class ControlBreedingProgress extends Control {
}
@Override
public void onRenderBackground() {
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(CraftGUITexture.PanelBlack, this.getArea());
final IArea area = this.getArea().inset(1);
area.setSize(new IPoint(area.size().x() * this.percentage, area.size().y()));
area.setSize(new IPoint(Math.round(area.size().x() * this.percentage), area.size().y()));
CraftGUI.render.colour(this.colour);
CraftGUI.render.texture(ControlBreedingProgress.Progress, area);
}
@@ -39,11 +39,11 @@ public class ControlDatabaseIndividualDisplay extends ControlItemDisplay impleme
this.addAttribute(Attribute.MouseOver);
}
public ControlDatabaseIndividualDisplay(final IWidget parent, final float x, final float y) {
this(parent, x, y, 16.0f);
public ControlDatabaseIndividualDisplay(final IWidget parent, final int x, final int y) {
this(parent, x, y, 16);
}
public ControlDatabaseIndividualDisplay(final IWidget parent, final float x, final float y, final float size) {
public ControlDatabaseIndividualDisplay(final IWidget parent, final int x, final int y, final int size) {
super(parent, x, y, size);
this.species = null;
this.discovered = EnumDiscoveryState.Show;
@@ -58,7 +58,7 @@ public class ControlDatabaseIndividualDisplay extends ControlItemDisplay impleme
}
@Override
public void onRenderForeground() {
public void onRenderForeground(int guiWidth, int guiHeight) {
//TODO RENDERING
// IIcon icon = null;
@@ -14,11 +14,11 @@ public class ControlItemStackOption extends ControlTextOption<ItemStack> {
public ControlItemStackOption(final ControlList<ItemStack> controlList, final ItemStack option, final int y) {
super(controlList, option, option.getDisplayName(), y);
this.setSize(new IPoint(this.getSize().x(), 20.0f));
(this.controlBee = new ControlItemDisplay(this, 2.0f, 2.0f)).setItemStack(option);
this.setSize(new IPoint(this.getSize().x(), 20));
(this.controlBee = new ControlItemDisplay(this, 2, 2)).setItemStack(option);
this.addAttribute(Attribute.MouseOver);
CraftGUIUtil.moveWidget(this.textWidget, new IPoint(22.0f, 0.0f));
this.textWidget.setSize(this.textWidget.getSize().sub(new IPoint(24.0f, 0.0f)));
CraftGUIUtil.moveWidget(this.textWidget, new IPoint(22, 0));
this.textWidget.setSize(this.textWidget.getSize().sub(new IPoint(24, 0)));
final int th = (int) CraftGUI.render.textHeight(this.textWidget.getValue(), this.textWidget.getSize().x());
final int height = Math.max(20, th + 6);
this.setSize(new IPoint(this.size().x(), height));
@@ -20,7 +20,7 @@ class ControlMutationBox extends ControlListBox<IMutation> {
}
public ControlMutationBox(final IWidget parent, final int x, final int y, final int width, final int height, final Type type) {
super(parent, x, y, width, height, 12.0f);
super(parent, x, y, width, height, 12);
this.species = null;
this.type = type;
}
@@ -16,9 +16,9 @@ class ControlMutationItem extends ControlOption<IMutation> {
public ControlMutationItem(final ControlList<IMutation> controlList, final IMutation option, final IAlleleSpecies species, final int y) {
super(controlList, option, y);
this.itemWidget1 = new ControlDatabaseIndividualDisplay(this, 4.0f, 4.0f);
this.itemWidget2 = new ControlDatabaseIndividualDisplay(this, 44.0f, 4.0f);
this.itemWidget3 = new ControlDatabaseIndividualDisplay(this, 104.0f, 4.0f);
this.itemWidget1 = new ControlDatabaseIndividualDisplay(this, 4, 4);
this.itemWidget2 = new ControlDatabaseIndividualDisplay(this, 44, 4);
this.itemWidget3 = new ControlDatabaseIndividualDisplay(this, 104, 4);
this.addSymbol = new ControlMutationSymbol(this, 24, 4, 0);
this.arrowSymbol = new ControlMutationSymbol(this, 64, 4, 1);
final boolean isNEI = ((WindowAbstractDatabase) this.getSuperParent()).isNEI();
@@ -23,8 +23,8 @@ class ControlMutationSymbol extends Control implements ITooltip {
private int type;
@Override
public void onRenderBackground() {
super.onRenderBackground();
public void onRenderBackground(int guiWidth, int guiHeight) {
super.onRenderBackground(guiWidth, guiHeight);
if (this.type == 0) {
CraftGUI.render.texture(ControlMutationSymbol.MutationPlus, IPoint.ZERO);
} else {
@@ -33,7 +33,7 @@ class ControlMutationSymbol extends Control implements ITooltip {
}
protected ControlMutationSymbol(final IWidget parent, final int x, final int y, final int type) {
super(parent, x, y, 16 + type * 16, 16.0f);
super(parent, x, y, 16 + type * 16, 16);
this.value = null;
this.type = type;
this.addAttribute(Attribute.MouseOver);
@@ -20,8 +20,8 @@ public class ControlSpeciesBox extends ControlListBox<IAlleleSpecies> {
return new ControlSpeciexBoxOption(this.getContent(), value, y);
}
public ControlSpeciesBox(final IWidget parent, final float x, final float y, final float width, final float height) {
super(parent, x, y, width, height, 12.0f);
public ControlSpeciesBox(final IWidget parent, final int x, final int y, final int width, final int height) {
super(parent, x, y, width, height, 12);
this.branch = null;
}
@@ -13,8 +13,8 @@ class ControlSpeciexBoxOption extends ControlTextOption<IAlleleSpecies> {
public ControlSpeciexBoxOption(final ControlList<IAlleleSpecies> controlList, final IAlleleSpecies option, final int y) {
super(controlList, option, option.getName(), y);
this.setSize(new IPoint(this.getSize().x(), 20.0f));
(this.controlBee = new ControlDatabaseIndividualDisplay(this, 2.0f, 2.0f)).setSpecies(this.getValue(), EnumDiscoveryState.Undetermined);
this.setSize(new IPoint(this.getSize().x(), 20));
(this.controlBee = new ControlDatabaseIndividualDisplay(this, 2, 2)).setSpecies(this.getValue(), EnumDiscoveryState.Undetermined);
if (this.controlBee.discovered == EnumDiscoveryState.Discovered) {
this.controlBee.discovered = EnumDiscoveryState.Show;
}
@@ -22,8 +22,8 @@ class ControlSpeciexBoxOption extends ControlTextOption<IAlleleSpecies> {
if (this.controlBee.discovered == EnumDiscoveryState.Show) {
this.addAttribute(Attribute.MouseOver);
}
CraftGUIUtil.moveWidget(this.textWidget, new IPoint(22.0f, 0.0f));
this.textWidget.setSize(this.textWidget.getSize().sub(new IPoint(24.0f, 0.0f)));
CraftGUIUtil.moveWidget(this.textWidget, new IPoint(22, 0));
this.textWidget.setSize(this.textWidget.getSize().sub(new IPoint(24, 0)));
final int th = (int) CraftGUI.render.textHeight(this.textWidget.getValue(), this.textWidget.getSize().x());
final int height = Math.max(20, th + 6);
this.setSize(new IPoint(this.size().x(), height));
@@ -5,7 +5,7 @@ import binnie.craftgui.core.IWidget;
public abstract class PageAbstract<T> extends ControlPage<DatabaseTab> {
public PageAbstract(final IWidget parent, final DatabaseTab tab) {
super(parent, 0.0f, 0.0f, parent.getSize().x(), parent.getSize().y(), tab);
super(parent, 0, 0, parent.getSize().x(), parent.getSize().y(), tab);
}
public abstract void onValueChanged(final T p0);
@@ -21,9 +21,9 @@ public class PageBranchOverview extends PageBranch {
public PageBranchOverview(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
this.pageBranchOverview_branchDescription = new ArrayList<>();
this.pageBranchOverview_branchName = new ControlTextCentered(this, 8.0f, "");
this.pageBranchOverview_branchScientific = new ControlTextCentered(this, 32.0f, "");
this.pageBranchOverview_branchAuthority = new ControlTextCentered(this, 44.0f, "");
this.pageBranchOverview_branchName = new ControlTextCentered(this, 8, "");
this.pageBranchOverview_branchScientific = new ControlTextCentered(this, 32, "");
this.pageBranchOverview_branchAuthority = new ControlTextCentered(this, 44, "");
}
@Override
@@ -19,7 +19,7 @@ public class PageBranchSpecies extends PageBranch {
public PageBranchSpecies(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
this.pageBranchSpecies_title = new ControlTextCentered(this, 8.0f, Binnie.LANGUAGE.localise("binniecore.gui.database.species"));
this.pageBranchSpecies_title = new ControlTextCentered(this, 8, Binnie.LANGUAGE.localise("binniecore.gui.database.species"));
this.addEventHandler(new EventValueChanged.Handler() {
@Override
public void onEvent(final EventValueChanged event) {
@@ -28,7 +28,7 @@ public class PageBranchSpecies extends PageBranch {
}
}
});
this.pageBranchSpecies_speciesList = new ControlSpeciesBox(this, 4.0f, 20.0f, 136.0f, 152.0f);
this.pageBranchSpecies_speciesList = new ControlSpeciesBox(this, 4, 20, 136, 152);
}
@Override
@@ -13,7 +13,7 @@ public class PageBreeder extends ControlPage<DatabaseTab> {
private GameProfile player;
public PageBreeder(final IWidget parent, final GameProfile player, final DatabaseTab tab) {
super(parent, 0.0f, 0.0f, parent.getSize().x(), parent.getSize().y(), tab);
super(parent, 0, 0, parent.getSize().x(), parent.getSize().y(), tab);
this.player = player;
this.onPageRefresh();
}
@@ -24,15 +24,15 @@ public class PageBreeder extends ControlPage<DatabaseTab> {
}
final BreedingSystem system = ((WindowAbstractDatabase) Window.get(this)).getBreedingSystem();
final String descriptor = system.getDescriptor();
new ControlTextCentered(this, 8.0f, TextFormatting.UNDERLINE + system.getDescriptor() + " " + Binnie.LANGUAGE.localise("binniecore.gui.database.breeder.profile"));
new ControlTextCentered(this, 75.0f, "" + system.discoveredSpeciesCount + "/" + system.totalSpeciesCount + " " + Binnie.LANGUAGE.localise("binniecore.gui.database.species"));
new ControlTextCentered(this, 8, TextFormatting.UNDERLINE + system.getDescriptor() + " " + Binnie.LANGUAGE.localise("binniecore.gui.database.breeder.profile"));
new ControlTextCentered(this, 75, "" + system.discoveredSpeciesCount + "/" + system.totalSpeciesCount + " " + Binnie.LANGUAGE.localise("binniecore.gui.database.species"));
new ControlBreedingProgress(this, 20, 87, 102, 14, system, system.discoveredSpeciesPercentage);
new ControlTextCentered(this, 115.0f, "" + system.discoveredBranchCount + "/" + system.totalBranchCount + " " + Binnie.LANGUAGE.localise("binniecore.gui.database.breeder.branches"));
new ControlTextCentered(this, 115, "" + system.discoveredBranchCount + "/" + system.totalBranchCount + " " + Binnie.LANGUAGE.localise("binniecore.gui.database.breeder.branches"));
new ControlBreedingProgress(this, 20, 127, 102, 14, system, system.discoveredBranchPercentage);
if (system.discoveredSecretCount > 0) {
new ControlTextCentered(this, 155.0f, "" + system.discoveredSecretCount + "/" + system.totalSecretCount + " " + Binnie.LANGUAGE.localise("binniecore.gui.database.breeder.species.secret"));
new ControlTextCentered(this, 155, "" + system.discoveredSecretCount + "/" + system.totalSecretCount + " " + Binnie.LANGUAGE.localise("binniecore.gui.database.breeder.species.secret"));
}
new ControlTextCentered(this, 32.0f, this.player.getName());
new ControlTextCentered(this, 44.0f, TextFormatting.ITALIC + system.getEpitome());
new ControlTextCentered(this, 32, this.player.getName());
new ControlTextCentered(this, 44, TextFormatting.ITALIC + system.getEpitome());
}
}
@@ -12,9 +12,9 @@ public class PageBreederStats extends Control {
String player;
public PageBreederStats(final IWidget parent, final int w, final int h, final String player) {
super(parent, 0.0f, 0.0f, w, h);
super(parent, 0, 0, w, h);
this.player = player;
final ControlText pageBranchOverview_branchName = new ControlTextCentered(this, 8.0f, TextFormatting.UNDERLINE + Binnie.LANGUAGE.localise("binniecore.gui.database.breeder.stats"));
final ControlText pageBranchOverview_branchName = new ControlTextCentered(this, 8, TextFormatting.UNDERLINE + Binnie.LANGUAGE.localise("binniecore.gui.database.breeder.stats"));
final BreedingSystem system = ((WindowAbstractDatabase) this.getSuperParent()).getBreedingSystem();
}
}
@@ -12,7 +12,7 @@ public class PageSpeciesMutations extends PageSpecies {
public PageSpeciesMutations(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8.0f, Binnie.LANGUAGE.localise("binniecore.gui.database.mutations.further"));
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8, Binnie.LANGUAGE.localise("binniecore.gui.database.mutations.further"));
this.pageSpeciesFurther_List = new ControlMutationBox(this, 4, 20, 136, 152, ControlMutationBox.Type.Further);
}
@@ -25,14 +25,14 @@ public class PageSpeciesOverview extends PageSpecies {
public PageSpeciesOverview(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
this.controlInd1 = new ControlDatabaseIndividualDisplay(this, 5.0f, 5.0f);
this.controlInd2 = new ControlDatabaseIndividualDisplay(this, 123.0f, 5.0f);
this.controlName = new ControlTextCentered(this, 8.0f, "");
this.controlScientific = new ControlTextCentered(this, 32.0f, "");
this.controlAuthority = new ControlTextCentered(this, 44.0f, "");
this.controlComplexity = new ControlTextCentered(this, 68.0f, "");
this.controlDescription = new ControlText(this, new IArea(8.0f, 84.0f, this.getSize().x() - 16.0f, 0.0f), "", TextJustification.MiddleCenter);
this.controlSignature = new ControlText(this, new IArea(8.0f, 84.0f, this.getSize().x() - 16.0f, 0.0f), "", TextJustification.BottomRight);
this.controlInd1 = new ControlDatabaseIndividualDisplay(this, 5, 5);
this.controlInd2 = new ControlDatabaseIndividualDisplay(this, 123, 5);
this.controlName = new ControlTextCentered(this, 8, "");
this.controlScientific = new ControlTextCentered(this, 32, "");
this.controlAuthority = new ControlTextCentered(this, 44, "");
this.controlComplexity = new ControlTextCentered(this, 68, "");
this.controlDescription = new ControlText(this, new IArea(8, 84, this.getSize().x() - 16, 0), "", TextJustification.MiddleCenter);
this.controlSignature = new ControlText(this, new IArea(8, 84, this.getSize().x() - 16, 0), "", TextJustification.BottomRight);
}
@Override
@@ -62,7 +62,7 @@ public class PageSpeciesOverview extends PageSpecies {
}
this.controlDescription.setValue(descBody + TextFormatting.RESET);
this.controlSignature.setValue(descSig);
final float descHeight = CraftGUI.render.textHeight(this.controlDescription.getValue(), this.controlDescription.getSize().x());
this.controlSignature.setPosition(new IPoint(this.controlSignature.pos().x(), this.controlDescription.getPosition().y() + descHeight + 10.0f));
final int descHeight = CraftGUI.render.textHeight(this.controlDescription.getValue(), this.controlDescription.getSize().x());
this.controlSignature.setPosition(new IPoint(this.controlSignature.pos().x(), this.controlDescription.getPosition().y() + descHeight + 10));
}
}
@@ -12,7 +12,7 @@ public class PageSpeciesResultant extends PageSpecies {
public PageSpeciesResultant(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
this.pageSpeciesResultant_Title = new ControlTextCentered(this, 8.0f, Binnie.LANGUAGE.localise("binniecore.gui.database.mutations.resultant"));
this.pageSpeciesResultant_Title = new ControlTextCentered(this, 8, Binnie.LANGUAGE.localise("binniecore.gui.database.mutations.resultant"));
this.pageSpeciesResultant_List = new ControlMutationBox(this, 4, 20, 136, 152, ControlMutationBox.Type.Resultant);
}
@@ -35,12 +35,12 @@ import java.util.Map;
import java.util.Objects;
public abstract class WindowAbstractDatabase extends Window {
private float selectionBoxWidth;
private final float infoBoxWidth = 144.0f;
private final float infoBoxHeight = 176.0f;
private final float infoTabWidth = 16.0f;
private final float modeTabWidth = 22.0f;
private final float searchBoxHeight = 16.0f;
private int selectionBoxWidth;
private final int infoBoxWidth = 144;
private final int infoBoxHeight = 176;
private final int infoTabWidth = 16;
private final int modeTabWidth = 22;
private final int searchBoxHeight = 16;
private Map<IDatabaseMode, ModeWidgets> modes;
boolean isNEI;
private BreedingSystem system;
@@ -53,9 +53,9 @@ public abstract class WindowAbstractDatabase extends Window {
this.modePages.setValue(mode);
}
public WindowAbstractDatabase(final EntityPlayer player, final Side side, final boolean nei, final BreedingSystem system, final float wid) {
super(100.0f, 192.0f, player, null, side);
this.selectionBoxWidth = 95.0f;
public WindowAbstractDatabase(final EntityPlayer player, final Side side, final boolean nei, final BreedingSystem system, final int wid) {
super(100, 192, player, null, side);
this.selectionBoxWidth = 95;
this.modes = new HashMap<>();
this.panelInformation = null;
this.panelSearch = null;
@@ -79,7 +79,7 @@ public abstract class WindowAbstractDatabase extends Window {
}
public WindowAbstractDatabase(final EntityPlayer player, final Side side, final boolean nei, final BreedingSystem system) {
this(player, side, nei, system, 95.0f);
this(player, side, nei, system, 95);
}
protected ModeWidgets createMode(final IDatabaseMode mode, final ModeWidgets widgets) {
@@ -89,7 +89,7 @@ public abstract class WindowAbstractDatabase extends Window {
@Override
public void initialiseClient() {
this.setSize(new IPoint(176.0f + this.selectionBoxWidth + 22.0f + 8.0f, 208.0f));
this.setSize(new IPoint(176 + this.selectionBoxWidth + 22 + 8, 208));
this.addEventHandler(new EventValueChanged.Handler() {
@Override
public void onEvent(final EventValueChanged event) {
@@ -127,11 +127,11 @@ public abstract class WindowAbstractDatabase extends Window {
}
}
}.setOrigin(EventHandler.Origin.DirectChild, this));
new ControlHelp(this, 4.0f, 4.0f);
(this.panelInformation = new Panel(this, 24.0f, 24.0f, 144.0f, 176.0f, MinecraftGUI.PanelType.Black)).setColour(860416);
(this.panelSearch = new Panel(this, 176.0f, 24.0f, this.selectionBoxWidth, 160.0f, MinecraftGUI.PanelType.Black)).setColour(860416);
this.modePages = new ControlPages<>(this, 0.0f, 0.0f, this.getSize().x(), this.getSize().y());
new ControlTextEdit(this, 176.0f, 184.0f, this.selectionBoxWidth, 16.0f);
new ControlHelp(this, 4, 4);
(this.panelInformation = new Panel(this, 24, 24, 144, 176, MinecraftGUI.PanelType.Black)).setColour(860416);
(this.panelSearch = new Panel(this, 176, 24, this.selectionBoxWidth, 160, MinecraftGUI.PanelType.Black)).setColour(860416);
this.modePages = new ControlPages<>(this, 0, 0, this.getSize().x(), this.getSize().y());
new ControlTextEdit(this, 176, 184, this.selectionBoxWidth, 16);
this.createMode(Mode.Species, new ModeWidgets(Mode.Species, this) {
@Override
public void createListBox(final IArea area) {
@@ -152,13 +152,13 @@ public abstract class WindowAbstractDatabase extends Window {
this.createMode(Mode.Breeder, new ModeWidgets(Mode.Breeder, this) {
@Override
public void createListBox(final IArea area) {
this.listBox = new ControlListBox(this.modePage, area.x(), area.y(), area.w(), area.h(), 12.0f);
this.listBox = new ControlListBox(this.modePage, area.x(), area.y(), area.w(), area.h(), 12);
}
});
this.addTabs();
final ControlTabBar<IDatabaseMode> tab = new ControlTabBar<IDatabaseMode>(this, 176.0f + this.selectionBoxWidth, 24.0f, 22.0f, 176.0f, Position.Right) {
final ControlTabBar<IDatabaseMode> tab = new ControlTabBar<IDatabaseMode>(this, 176 + this.selectionBoxWidth, 24, 22, 176, Position.Right) {
@Override
public ControlTab<IDatabaseMode> createTab(final float x, final float y, final float w, final float h, final IDatabaseMode value) {
public ControlTab<IDatabaseMode> createTab(final int x, final int y, final int w, final int h, final IDatabaseMode value) {
return new ControlTab<IDatabaseMode>(this, x, y, w, h, value) {
@Override
public String getName() {
@@ -171,7 +171,7 @@ public abstract class WindowAbstractDatabase extends Window {
CraftGUIUtil.linkWidgets(tab, this.modePages);
this.changeMode(Mode.Species);
for (final IDatabaseMode mode : this.modes.keySet()) {
this.modes.get(mode).infoTabs = new ControlTabBar(this.modes.get(mode).modePage, 8.0f, 24.0f, 16.0f, 176.0f, Position.Left);
this.modes.get(mode).infoTabs = new ControlTabBar(this.modes.get(mode).modePage, 8, 24, 16, 176, Position.Left);
this.modes.get(mode).infoTabs.setValues(this.modes.get(mode).infoPages.getValues());
CraftGUIUtil.linkWidgets(this.modes.get(mode).infoTabs, this.modes.get(mode).infoPages);
}
@@ -229,12 +229,12 @@ public abstract class WindowAbstractDatabase extends Window {
public ModeWidgets(final IDatabaseMode mode, final WindowAbstractDatabase database) {
this.database = database;
this.modePage = new ControlPage<>(database.modePages, 0.0f, 0.0f, database.getSize().x(), database.getSize().y(), mode);
this.modePage = new ControlPage<>(database.modePages, 0, 0, database.getSize().x(), database.getSize().y(), mode);
final IArea listBoxArea = database.panelSearch.area().inset(2);
this.createListBox(listBoxArea);
CraftGUIUtil.alignToWidget(this.listBox, database.panelSearch);
CraftGUIUtil.moveWidget(this.listBox, new IPoint(2.0f, 2.0f));
CraftGUIUtil.alignToWidget(this.infoPages = new ControlPages<>(this.modePage, 0.0f, 0.0f, 144.0f, 176.0f), database.panelInformation);
CraftGUIUtil.moveWidget(this.listBox, new IPoint(2, 2));
CraftGUIUtil.alignToWidget(this.infoPages = new ControlPages<>(this.modePage, 0, 0, 144, 176), database.panelInformation);
}
public abstract void createListBox(final IArea p0);