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

@@ -16,7 +16,7 @@ public class WindowAlvearyFrame extends Window {
ControlPlayerInventory playerInventory;
public WindowAlvearyFrame(final EntityPlayer player, final IInventory inventory, final Side side) {
super(176.0f, 144.0f, player, inventory, side);
super(176, 144, player, inventory, side);
this.machine = ((TileEntityMachine) inventory).getMachine();
}
@@ -31,7 +31,7 @@ public class WindowAlvearyFrame extends Window {
public void initialiseClient() {
this.setTitle("Frame Housing");
this.playerInventory = new ControlPlayerInventory(this);
final ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
final ControlSlot slot = new ControlSlot(this, 79, 30);
slot.assign(0);
}
@@ -17,7 +17,7 @@ public class WindowAlvearyHatchery extends Window {
ControlPlayerInventory playerInventory;
public WindowAlvearyHatchery(final EntityPlayer player, final IInventory inventory, final Side side) {
super(176.0f, 144.0f, player, inventory, side);
super(176, 144, player, inventory, side);
this.machine = ((TileEntityMachine) inventory).getMachine();
}
@@ -16,7 +16,7 @@ public class WindowAlvearyIndustrialFrame extends Window {
ControlPlayerInventory playerInventory;
public WindowAlvearyIndustrialFrame(final EntityPlayer player, final IInventory inventory, final Side side) {
super(176.0f, 144.0f, player, inventory, side);
super(176, 144, player, inventory, side);
this.machine = ((TileEntityMachine) inventory).getMachine();
}
@@ -31,7 +31,7 @@ public class WindowAlvearyIndustrialFrame extends Window {
public void initialiseClient() {
this.setTitle("Industrial Frame Housing");
this.playerInventory = new ControlPlayerInventory(this);
final ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
final ControlSlot slot = new ControlSlot(this, 79, 30);
slot.assign(0);
}
@@ -22,7 +22,7 @@ public class WindowAlvearyMutator extends Window {
ControlPlayerInventory playerInventory;
public WindowAlvearyMutator(final EntityPlayer player, final IInventory inventory, final Side side) {
super(176.0f, 176.0f, player, inventory, side);
super(176, 176, player, inventory, side);
this.machine = ((TileEntityMachine) inventory).getMachine();
}
@@ -37,18 +37,18 @@ public class WindowAlvearyMutator extends Window {
public void initialiseClient() {
this.setTitle("Mutator");
this.playerInventory = new ControlPlayerInventory(this);
final ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
final ControlSlot slot = new ControlSlot(this, 79, 30);
slot.assign(0);
new ControlText(this, new IArea(0.0f, 52.0f, this.w(), 16.0f), "Possible Mutagens:", TextJustification.MiddleCenter).setColour(5592405);
new ControlText(this, new IArea(0, 52, this.w(), 16), "Possible Mutagens:", TextJustification.MiddleCenter).setColour(5592405);
final int size = AlvearyMutator.getMutagens().size();
final int w = size * 18;
if (size > 0) {
float x = (this.w() - w) / 2.0f;
int x = (this.w() - w) / 2;
for (final ItemStack stack : AlvearyMutator.getMutagens()) {
final ControlItemDisplay display = new ControlItemDisplay(this, x, 66.0f);
final ControlItemDisplay display = new ControlItemDisplay(this, x, 66);
display.setItemStack(stack);
display.hastooltip = true;
x += 18.0f;
x += 18;
}
}
}
@@ -19,7 +19,7 @@ public class WindowAlvearyStimulator extends Window {
ControlPlayerInventory playerInventory;
public WindowAlvearyStimulator(final EntityPlayer player, final IInventory inventory, final Side side) {
super(176.0f, 144.0f, player, inventory, side);
super(176, 144, player, inventory, side);
this.machine = ((TileEntityMachine) inventory).getMachine();
}
@@ -34,7 +34,7 @@ public class WindowAlvearyStimulator extends Window {
public void initialiseClient() {
this.setTitle("Stimulator");
new ControlEnergyBar(this, 75, 29, 60, 16, Position.Left);
final ControlSlot slot = new ControlSlot(this, 41.0f, 28.0f);
final ControlSlot slot = new ControlSlot(this, 41, 28);
slot.assign(AlvearyStimulator.slotCircuit);
this.playerInventory = new ControlPlayerInventory(this);
}
@@ -43,7 +43,7 @@ public class ControlBiomes extends Control implements ITooltip {
}
@Override
public void onRenderForeground() {
public void onRenderForeground(int guiWidth, int guiHeight) {
for (int i = 0; i < this.tolerated.size(); ++i) {
final int x = i % 8 * 16;
final int y = i / 8 * 16;
@@ -51,7 +51,7 @@ public class ControlBiomes extends Control implements ITooltip {
//TODO FIND COLOR
//CraftGUI.Render.colour(Biome.getBiome(i).color);
}
CraftGUI.render.texture(CraftGUITexture.Button, new IArea(x, y, 16.0f, 16.0f));
CraftGUI.render.texture(CraftGUITexture.Button, new IArea(x, y, 16, 16));
}
}
@@ -63,7 +63,7 @@ public class ControlClimateBar extends Control implements ITooltip {
}
@Override
public void onRenderBackground() {
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(CraftGUITexture.EnergyBarBack, this.getArea());
final int types = this.isHumidity ? 3 : 6;
final int w = (int) ((this.getSize().x() - 2.0f) / types);
@@ -76,7 +76,7 @@ public class ControlClimateBar extends Control implements ITooltip {
} else {
colour = this.tempColours[i];
}
CraftGUI.render.solid(new IArea(x + 1, 1.0f, w, this.getSize().y() - 2.0f), colour);
CraftGUI.render.solid(new IArea(x + 1, 1, w, this.getSize().y() - 2), colour);
}
}
CraftGUI.render.texture(CraftGUITexture.EnergyBarGlass, this.getArea());
@@ -24,7 +24,7 @@ public class ControlProductsBox extends ControlListBox<ControlProductsBox.Produc
}
public ControlProductsBox(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;
}
@@ -15,19 +15,19 @@ public class ControlProductsItem extends ControlOption<ControlProductsBox.Produc
public ControlProductsItem(final ControlList<ControlProductsBox.Product> controlList, final ControlProductsBox.Product value, final int y) {
super(controlList, value, y);
(this.item = new ControlItemDisplay(this, 4.0f, 4.0f)).setTooltip();
final ControlText textWidget = new ControlTextCentered(this, 2.0f, "");
CraftGUIUtil.moveWidget(textWidget, new IPoint(12.0f, 0.0f));
(this.item = new ControlItemDisplay(this, 4, 4)).setTooltip();
final ControlText textWidget = new ControlTextCentered(this, 2, "");
CraftGUIUtil.moveWidget(textWidget, new IPoint(12, 0));
if (value != null) {
this.item.setItemStack(value.item);
final float time = (int) (55000.0 / value.chance);
final float seconds = time / 20.0f;
final float minutes = seconds / 60.0f;
final float hours = minutes / 60.0f;
final int time = (int) (55000.0 / value.chance);
final int seconds = time / 20;
final int minutes = seconds / 60;
final int hours = minutes / 60;
final DecimalFormat df = new DecimalFormat("#.0");
if (hours > 1.0f) {
if (hours > 1) {
textWidget.setValue("Every " + df.format(hours) + " hours");
} else if (minutes > 1.0f) {
} else if (minutes > 1) {
textWidget.setValue("Every " + df.format(minutes) + " min.");
} else {
textWidget.setValue("Every " + df.format(seconds) + " sec.");
@@ -14,10 +14,10 @@ public class PageSpeciesClimate extends PageSpecies {
public PageSpeciesClimate(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
new ControlTextCentered(this, 8.0f, "Climate");
new ControlTextCentered(this, 8, "Climate");
this.tempBar = new ControlClimateBar(this, 8, 24, 128, 12);
this.humidBar = new ControlClimateBar(this, 8, 42, 128, 12, true);
new ControlTextCentered(this, 70.0f, "Biomes");
new ControlTextCentered(this, 70, "Biomes");
this.biomes = new ControlBiomes(this, 8, 90, 8, 4);
}
@@ -29,28 +29,28 @@ public class PageSpeciesGenome extends PageSpecies {
public PageSpeciesGenome(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
this.pageSpeciesGenome_Title = new ControlTextCentered(this, 8.0f, "Genome");
new ControlText(this, new IArea(0.0f, 32.0f, 68.0f, 30.0f), "Speed:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 44.0f, 68.0f, 30.0f), "Lifespan:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 56.0f, 68.0f, 30.0f), "Fertility:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 68.0f, 68.0f, 30.0f), "Flowering:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 80.0f, 68.0f, 30.0f), "Territory:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 97.0f, 68.0f, 30.0f), "Behavior:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 109.0f, 68.0f, 30.0f), "Sunlight:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 121.0f, 68.0f, 30.0f), "Rain:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 138.0f, 68.0f, 30.0f), "Flower:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 155.0f, 68.0f, 30.0f), "Effect:", TextJustification.TopRight);
this.pageSpeciesGenome_Title = new ControlTextCentered(this, 8, "Genome");
new ControlText(this, new IArea(0, 32, 68, 30), "Speed:", TextJustification.TopRight);
new ControlText(this, new IArea(0, 44, 68, 30), "Lifespan:", TextJustification.TopRight);
new ControlText(this, new IArea(0, 56, 68, 30), "Fertility:", TextJustification.TopRight);
new ControlText(this, new IArea(0, 68, 68, 30), "Flowering:", TextJustification.TopRight);
new ControlText(this, new IArea(0, 80, 68, 30), "Territory:", TextJustification.TopRight);
new ControlText(this, new IArea(0, 97, 68, 30), "Behavior:", TextJustification.TopRight);
new ControlText(this, new IArea(0, 109, 68, 30), "Sunlight:", TextJustification.TopRight);
new ControlText(this, new IArea(0, 121, 68, 30), "Rain:", TextJustification.TopRight);
new ControlText(this, new IArea(0, 138, 68, 30), "Flower:", TextJustification.TopRight);
new ControlText(this, new IArea(0, 155, 68, 30), "Effect:", TextJustification.TopRight);
final int x = 72;
this.pageSpeciesGenome_SpeedText = new ControlText(this, new IArea(x, 32.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
this.pageSpeciesGenome_LifespanText = new ControlText(this, new IArea(x, 44.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
this.pageSpeciesGenome_FertilityText = new ControlText(this, new IArea(x, 56.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
this.pageSpeciesGenome_FloweringText = new ControlText(this, new IArea(x, 68.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
this.pageSpeciesGenome_TerritoryText = new ControlText(this, new IArea(x, 80.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
this.pageSpeciesGenome_NocturnalText = new ControlText(this, new IArea(x, 97.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
this.pageSpeciesGenome_CaveDwellingText = new ControlText(this, new IArea(x, 109.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
this.pageSpeciesGenome_TolerantFlyerText = new ControlText(this, new IArea(x, 121.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
this.pageSpeciesGenome_FlowerText = new ControlText(this, new IArea(x, 138.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
this.pageSpeciesGenome_EffectText = new ControlText(this, new IArea(x, 155.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
this.pageSpeciesGenome_SpeedText = new ControlText(this, new IArea(x, 32, 72, 30), "", TextJustification.TopLeft);
this.pageSpeciesGenome_LifespanText = new ControlText(this, new IArea(x, 44, 72, 30), "", TextJustification.TopLeft);
this.pageSpeciesGenome_FertilityText = new ControlText(this, new IArea(x, 56, 72, 30), "", TextJustification.TopLeft);
this.pageSpeciesGenome_FloweringText = new ControlText(this, new IArea(x, 68, 72, 30), "", TextJustification.TopLeft);
this.pageSpeciesGenome_TerritoryText = new ControlText(this, new IArea(x, 80, 72, 30), "", TextJustification.TopLeft);
this.pageSpeciesGenome_NocturnalText = new ControlText(this, new IArea(x, 97, 72, 30), "", TextJustification.TopLeft);
this.pageSpeciesGenome_CaveDwellingText = new ControlText(this, new IArea(x, 109, 72, 30), "", TextJustification.TopLeft);
this.pageSpeciesGenome_TolerantFlyerText = new ControlText(this, new IArea(x, 121, 72, 30), "", TextJustification.TopLeft);
this.pageSpeciesGenome_FlowerText = new ControlText(this, new IArea(x, 138, 72, 30), "", TextJustification.TopLeft);
this.pageSpeciesGenome_EffectText = new ControlText(this, new IArea(x, 155, 72, 30), "", TextJustification.TopLeft);
}
@Override
@@ -16,9 +16,9 @@ public class PageSpeciesProducts extends PageSpecies {
public PageSpeciesProducts(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
this.pageSpeciesProducts_Title = new ControlTextCentered(this, 8.0f, "Products");
this.pageSpeciesProducts_Title = new ControlTextCentered(this, 8, "Products");
this.pageSpeciesProducts_Products = new ControlProductsBox(this, 4, 20, 136, 48, ControlProductsBox.Type.Products);
this.pageSpeciesProducts_Title2 = new ControlTextCentered(this, 68.0f, "Specialties");
this.pageSpeciesProducts_Title2 = new ControlTextCentered(this, 68, "Specialties");
this.pageSpeciesProducts_Specialties = new ControlProductsBox(this, 4, 80, 136, 48, ControlProductsBox.Type.Specialties);
}
@@ -32,7 +32,7 @@ public class WindowApiaristDatabase extends WindowAbstractDatabase {
}
public WindowApiaristDatabase(final EntityPlayer player, final Side side, final boolean nei) {
super(player, side, nei, Binnie.GENETICS.beeBreedingSystem, 110.0f);
super(player, side, nei, Binnie.GENETICS.beeBreedingSystem, 110);
}
public static Window create(final EntityPlayer player, final Side side, final boolean nei) {
@@ -12,8 +12,8 @@ import forestry.api.genetics.IChromosomeType;
public class ControlChromosome extends Control implements IControlValue<IChromosomeType>, ITooltip {
IChromosomeType value;
protected ControlChromosome(final IWidget parent, final float x, final float y, final IChromosomeType type) {
super(parent, x, y, 16.0f, 16.0f);
protected ControlChromosome(final IWidget parent, final int x, final int y, final IChromosomeType type) {
super(parent, x, y, 16, 16);
this.setValue(type);
this.addAttribute(Attribute.MouseOver);
}
@@ -29,7 +29,7 @@ public class ControlChromosome extends Control implements IControlValue<IChromos
}
@Override
public void onRenderBackground() {
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(ExtraBeeGUITexture.Chromosome, this.getArea());
CraftGUI.render.colour(16711680);
CraftGUI.render.texture(ExtraBeeGUITexture.Chromosome2, this.getArea());
@@ -18,16 +18,16 @@ public class ControlPunnett extends Control {
static int boxWidth = 80;
static int boxHeight = 28;
protected ControlPunnett(final IWidget parent, final float x, final float y) {
protected ControlPunnett(final IWidget parent, final int x, final int y) {
super(parent, x, y, ControlPunnett.boxWidth * 3, ControlPunnett.boxWidth * 3);
}
@Override
public void onRenderBackground() {
CraftGUI.render.solid(new IArea(0.0f, ControlPunnett.boxHeight, ControlPunnett.boxWidth * 3, 1.0f), 11184810);
CraftGUI.render.solid(new IArea(ControlPunnett.boxWidth / 2.0f, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth * 2.5f, 1.0f), 11184810);
CraftGUI.render.solid(new IArea(ControlPunnett.boxWidth, 0.0f, 1.0f, ControlPunnett.boxHeight * 3), 11184810);
CraftGUI.render.solid(new IArea(ControlPunnett.boxWidth * 2, ControlPunnett.boxHeight / 2.0f, 1.0f, ControlPunnett.boxHeight * 2.5f), 11184810);
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.solid(new IArea(0, ControlPunnett.boxHeight, ControlPunnett.boxWidth * 3, 1), 11184810);
CraftGUI.render.solid(new IArea(ControlPunnett.boxWidth / 2, ControlPunnett.boxHeight * 2, Math.round(ControlPunnett.boxWidth * 2.5f), 1), 11184810);
CraftGUI.render.solid(new IArea(ControlPunnett.boxWidth, 0, 1, ControlPunnett.boxHeight * 3), 11184810);
CraftGUI.render.solid(new IArea(ControlPunnett.boxWidth * 2, ControlPunnett.boxHeight / 2, 1, Math.round(ControlPunnett.boxHeight * 2.5f)), 11184810);
}
public void setup(final IChromosomeType chromosome, final IIndividual ind1, final IIndividual ind2, final ISpeciesRoot root) {
@@ -64,10 +64,10 @@ public class ControlPunnett extends Control {
}
++x;
}
new ControlText(this, new IArea(ControlPunnett.boxWidth, 0.0f, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + primary1.getName(), TextJustification.TopCenter).setColour(11184810);
new ControlText(this, new IArea(ControlPunnett.boxWidth * 2, 0.0f, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + secondary1.getName(), TextJustification.TopCenter).setColour(11184810);
new ControlText(this, new IArea(0.0f, ControlPunnett.boxHeight, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColour(11184810);
new ControlText(this, new IArea(0.0f, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColour(11184810);
new ControlText(this, new IArea(ControlPunnett.boxWidth, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + primary1.getName(), TextJustification.TopCenter).setColour(11184810);
new ControlText(this, new IArea(ControlPunnett.boxWidth * 2, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + secondary1.getName(), TextJustification.TopCenter).setColour(11184810);
new ControlText(this, new IArea(0, ControlPunnett.boxHeight, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColour(11184810);
new ControlText(this, new IArea(0, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColour(11184810);
}
}
@@ -26,7 +26,7 @@ public class WindowPunnettSquare extends Window {
}
public WindowPunnettSquare(final EntityPlayer player, final IInventory inventory, final Side side) {
super(245.0f, 205.0f, player, inventory, side);
super(245, 205, player, inventory, side);
this.root = null;
}