Move static rendering methods to RenderUtil

This commit is contained in:
mezz committed 2017-01-24 21:36:55 -08:00
1 parent 9c4b081f6d
commit 460a7db190
42 files changed
+442 -414

No files matched your search

@@ -12,6 +12,7 @@ import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.core.geometry.TextJustification;
import binnie.craftgui.core.renderer.RenderUtil;
import binnie.craftgui.events.EventMouse;
import binnie.craftgui.minecraft.MinecraftGUI;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
@@ -67,9 +68,9 @@ public class AnalystPageDatabase extends ControlAnalystPage {
@Override
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.colour(5592405);
RenderUtil.setColour(5592405);
CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().inset(1));
CraftGUI.render.colour(AnalystPageDatabase.this.getColour());
RenderUtil.setColour(AnalystPageDatabase.this.getColour());
CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea());
super.renderTextField();
}
@@ -100,7 +101,7 @@ public class AnalystPageDatabase extends ControlAnalystPage {
@Override
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.text(this.getArea(), TextJustification.MiddleCenter, this.value.getName(), 16777215);
RenderUtil.drawText(this.getArea(), TextJustification.MiddleCenter, this.value.getName(), 16777215);
}
};
}
@@ -114,8 +115,8 @@ public class AnalystPageDatabase extends ControlAnalystPage {
if (!this.isEnabled()) {
return;
}
CraftGUI.render.gradientRect(this.getArea(), 1140850688 + AnalystPageDatabase.this.getColour(), 1140850688 + AnalystPageDatabase.this.getColour());
CraftGUI.render.solid(this.getRenderArea(), AnalystPageDatabase.this.getColour());
RenderUtil.drawGradientRect(this.getArea(), 1140850688 + AnalystPageDatabase.this.getColour(), 1140850688 + AnalystPageDatabase.this.getColour());
RenderUtil.drawSolidRect(this.getRenderArea(), AnalystPageDatabase.this.getColour());
}
};
}
@@ -146,12 +147,12 @@ public class AnalystPageDatabase extends ControlAnalystPage {
public void onRenderBackground(int guiWidth, int guiHeight) {
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
if (window.getIndividual() != null && window.getIndividual().getGenome().getPrimary() == species) {
CraftGUI.render.colour(15658734);
RenderUtil.setColour(15658734);
CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().outset(1));
CraftGUI.render.colour(AnalystPageDatabase.this.getColour());
RenderUtil.setColour(AnalystPageDatabase.this.getColour());
CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea().outset(1));
} else if (this.calculateIsMouseOver()) {
CraftGUI.render.colour(15658734);
RenderUtil.setColour(15658734);
CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().outset(1));
}
super.onRenderBackground(guiWidth, guiHeight);
@@ -7,12 +7,11 @@ import binnie.core.genetics.ForestryAllele;
import binnie.craftgui.controls.ControlTextCentered;
import binnie.craftgui.controls.core.Control;
import binnie.craftgui.core.Attribute;
import binnie.craftgui.core.CraftGUI;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.geometry.CraftGUIUtil;
import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.core.geometry.TextJustification;
import binnie.craftgui.core.renderer.RenderUtil;
import binnie.craftgui.minecraft.EnumColor;
import binnie.craftgui.minecraft.Window;
import binnie.craftgui.minecraft.control.ControlItemDisplay;
@@ -131,15 +130,15 @@ public class AnalystPageMutations extends ControlAnalystPage {
@Override
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUIUtil.renderItem(IPoint.ZERO, system.getDefaultMember(mutation.getAllele0().getUID()));
CraftGUIUtil.renderItem(new IPoint(28, 0), system.getDefaultMember(mutation.getAllele1().getUID()));
RenderUtil.drawItem(IPoint.ZERO, system.getDefaultMember(mutation.getAllele0().getUID()));
RenderUtil.drawItem(new IPoint(28, 0), system.getDefaultMember(mutation.getAllele1().getUID()));
if (specificChance != mutation.getBaseChance()) {
CraftGUI.render.colour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
RenderUtil.setColour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
//CraftGUI.Render.iconItem(new IPoint(14, 0), ModuleItem.iconAdd0.getIcon());
CraftGUI.render.colour(AnalystPageMutations.this.getMutationColour(specificChance).getColour());
RenderUtil.setColour(AnalystPageMutations.this.getMutationColour(specificChance).getColour());
//CraftGUI.Render.iconItem(new IPoint(14, 0), ModuleItem.iconAdd1.getIcon());
} else {
CraftGUI.render.colour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
RenderUtil.setColour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
//CraftGUI.Render.iconItem(new IPoint(14, 0), ModuleItem.iconAdd.getIcon());
}
}
@@ -189,16 +188,16 @@ public class AnalystPageMutations extends ControlAnalystPage {
@Override
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUIUtil.renderItem(IPoint.ZERO, system.getDefaultMember(speciesComb.getUID()));
CraftGUIUtil.renderItem(new IPoint(28, 0), system.getDefaultMember(mutation.getTemplate()[0].getUID()));
CraftGUI.render.colour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
RenderUtil.drawItem(IPoint.ZERO, system.getDefaultMember(speciesComb.getUID()));
RenderUtil.drawItem(new IPoint(28, 0), system.getDefaultMember(mutation.getTemplate()[0].getUID()));
RenderUtil.setColour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
if (specificChance2 != mutation.getBaseChance()) {
CraftGUI.render.colour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
RenderUtil.setColour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
//CraftGUI.Render.iconItem(new IPoint(14, 0), ModuleItem.iconArrow0.getIcon());
CraftGUI.render.colour(AnalystPageMutations.this.getMutationColour(specificChance2).getColour());
RenderUtil.setColour(AnalystPageMutations.this.getMutationColour(specificChance2).getColour());
//CraftGUI.Render.iconItem(new IPoint(14, 0), ModuleItem.iconArrow1.getIcon());
} else {
CraftGUI.render.colour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
RenderUtil.setColour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
//CraftGUI.Render.iconItem(new IPoint(14, 0), ModuleItem.iconArrow.getIcon());
}
}
@@ -258,7 +257,7 @@ public class AnalystPageMutations extends ControlAnalystPage {
@Override
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.text(this.getArea(), TextJustification.MiddleCenter, "UNKNOWN", 11184810);
RenderUtil.drawText(this.getArea(), TextJustification.MiddleCenter, "UNKNOWN", 11184810);
}
}
}
@@ -3,9 +3,9 @@ package binnie.genetics.gui;
import binnie.core.genetics.Gene;
import binnie.craftgui.controls.listbox.ControlList;
import binnie.craftgui.controls.listbox.ControlOption;
import binnie.craftgui.core.CraftGUI;
import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.TextJustification;
import binnie.craftgui.core.renderer.RenderUtil;
public class ControlGenesisOption extends ControlOption<Gene> {
public ControlGenesisOption(final ControlList<Gene> parent, final Gene gene, final int y) {
@@ -23,9 +23,9 @@ public class ControlGenesisOption extends ControlOption<Gene> {
@Override
public void onRenderBackground(int guiWidth, int guiHeight) {
super.onRenderBackground(guiWidth, guiHeight);
CraftGUI.render.text(new IArea(0, 0, 70, 22), TextJustification.MiddleCenter, this.getChromosomeName(), this.getColour());
CraftGUI.render.text(new IArea(75, 0, 80, 22), TextJustification.MiddleCenter, this.getAlleleName(), this.getColour());
CraftGUI.render.solid(new IArea(70, 2, 1, 16), -16777216 + this.getColour());
RenderUtil.drawText(new IArea(0, 0, 70, 22), TextJustification.MiddleCenter, this.getChromosomeName(), this.getColour());
RenderUtil.drawText(new IArea(75, 0, 80, 22), TextJustification.MiddleCenter, this.getAlleleName(), this.getColour());
RenderUtil.drawSolidRect(new IArea(70, 2, 1, 16), -16777216 + this.getColour());
}
}
@@ -3,12 +3,12 @@ package binnie.genetics.gui;
import binnie.core.genetics.Tolerance;
import binnie.craftgui.controls.core.Control;
import binnie.craftgui.core.Attribute;
import binnie.craftgui.core.CraftGUI;
import binnie.craftgui.core.ITooltip;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.Tooltip;
import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.IBorder;
import binnie.craftgui.core.renderer.RenderUtil;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.EnumTolerance;
import net.minecraft.util.text.TextFormatting;
@@ -48,13 +48,13 @@ public abstract class ControlToleranceBar<T extends Enum<T>> extends Control imp
@Override
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.gradientRect(this.getArea(), -1431655766, -1431655766);
RenderUtil.drawGradientRect(this.getArea(), -1431655766, -1431655766);
final int w = this.getArea().w() / this.fullSet.size();
int t = 0;
for (final T value : this.fullSet) {
final int col = (this.tolerated.contains(value) ? -16777216 : 855638016) + this.getColour(value);
final IBorder inset = new IBorder(this.tolerated.contains(value) ? 1 : 3);
CraftGUI.render.gradientRect(new IArea(w * t, 0, w, this.h()).inset(inset), col, col);
RenderUtil.drawGradientRect(new IArea(w * t, 0, w, this.h()).inset(inset), col, col);
++t;
}
}
@@ -14,10 +14,10 @@ import binnie.craftgui.core.CraftGUI;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.Tooltip;
import binnie.craftgui.core.Widget;
import binnie.craftgui.core.geometry.CraftGUIUtil;
import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.core.geometry.Position;
import binnie.craftgui.core.renderer.RenderUtil;
import binnie.craftgui.events.EventKey;
import binnie.craftgui.events.EventMouse;
import binnie.craftgui.minecraft.InventoryType;
@@ -151,14 +151,14 @@ public class WindowAnalyst extends Window {
@Override
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.colour(syst.getColour());
RenderUtil.setColour(syst.getColour());
final int outset = (WindowAnalyst.this.getSystem() == syst) ? 1 : 0;
CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea().outset(outset));
if (WindowAnalyst.this.getSystem() == syst) {
CraftGUI.render.colour(1140850688 + syst.getColour());
RenderUtil.setColour(1140850688 + syst.getColour());
CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().outset(outset));
}
CraftGUIUtil.renderItem(new IPoint(2, 2), syst.getItemStackRepresentitive());
RenderUtil.drawItem(new IPoint(2, 2), syst.getItemStackRepresentitive());
}
};
x += 22;
@@ -174,7 +174,7 @@ public class WindowAnalyst extends Window {
this.analystPanel = new Panel(this, 16, 54, 280, 164, MinecraftGUI.PanelType.Outline) {
@Override
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.gradientRect(this.getArea(), 1157627903, 1728053247);
RenderUtil.drawGradientRect(this.getArea(), 1157627903, 1728053247);
super.onRenderBackground(guiWidth, guiHeight);
}
@@ -188,7 +188,7 @@ public class WindowAnalyst extends Window {
if (this.getContent() == null) {
return;
}
CraftGUI.render.colour(this.getContent().getColour());
RenderUtil.setColour(this.getContent().getColour());
CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea());
}
};
@@ -201,8 +201,8 @@ public class WindowAnalyst extends Window {
if (WindowAnalyst.this.leftPage.getContent() == null) {
return;
}
CraftGUI.render.gradientRect(this.getArea(), 1140850688 + WindowAnalyst.this.leftPage.getContent().getColour(), 1140850688 + WindowAnalyst.this.leftPage.getContent().getColour());
CraftGUI.render.solid(this.getRenderArea(), WindowAnalyst.this.leftPage.getContent().getColour());
RenderUtil.drawGradientRect(this.getArea(), 1140850688 + WindowAnalyst.this.leftPage.getContent().getColour(), 1140850688 + WindowAnalyst.this.leftPage.getContent().getColour());
RenderUtil.drawSolidRect(this.getRenderArea(), WindowAnalyst.this.leftPage.getContent().getColour());
}
};
WindowAnalyst.this.rightPage = new ControlScrollableContent<IWidget>(this, 3 + sectionWidth + 4, 3, sectionWidth + 2, this.h() - 8 + 2, 0) {
@@ -211,7 +211,7 @@ public class WindowAnalyst extends Window {
if (this.getContent() == null) {
return;
}
CraftGUI.render.colour(this.getContent().getColour());
RenderUtil.setColour(this.getContent().getColour());
CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea());
}
};
@@ -224,8 +224,8 @@ public class WindowAnalyst extends Window {
if (WindowAnalyst.this.rightPage.getContent() == null) {
return;
}
CraftGUI.render.gradientRect(this.getArea(), 1140850688 + WindowAnalyst.this.rightPage.getContent().getColour(), 1140850688 + WindowAnalyst.this.rightPage.getContent().getColour());
CraftGUI.render.solid(this.getRenderArea(), WindowAnalyst.this.rightPage.getContent().getColour());
RenderUtil.drawGradientRect(this.getArea(), 1140850688 + WindowAnalyst.this.rightPage.getContent().getColour(), 1140850688 + WindowAnalyst.this.rightPage.getContent().getColour());
RenderUtil.drawSolidRect(this.getRenderArea(), WindowAnalyst.this.rightPage.getContent().getColour());
}
};
WindowAnalyst.this.analystPageSize = new IArea(1, 1, sectionWidth, this.h() - 8);
@@ -381,9 +381,9 @@ public class WindowAnalyst extends Window {
@Override
public void onRenderBackground(int guiWidth, int guiHeight) {
final boolean active = this.value == WindowAnalyst.this.leftPage.getContent() || this.value == WindowAnalyst.this.rightPage.getContent();
CraftGUI.render.colour((active ? -16777216 : 1140850688) + this.value.getColour());
RenderUtil.setColour((active ? -16777216 : 1140850688) + this.value.getColour());
CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().inset(1));
CraftGUI.render.colour(this.value.getColour());
RenderUtil.setColour(this.value.getColour());
CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea().inset(1));
super.onRenderBackground(guiWidth, guiHeight);
}