use of com.builtbroken.jlib.data.science.units.UnitDisplay in project Engine by VoltzEngine-Project.
the class GuiContainerBase method renderUniversalDisplay.
// TODO update and docs
public void renderUniversalDisplay(int x, int y, double energy, double maxEnergy, int mouseX, int mouseY, Unit unit, boolean symbol) {
String displaySuffix = "";
if (unit == Unit.WATT) {
displaySuffix = "/s";
}
String display = new UnitDisplay(unit, energy).symbol(symbol) + "/" + new UnitDisplay(unit, maxEnergy).symbol(symbol);
// TODO: Check if this rect works.
if (new Rectangle(x, y, x + display.length() * 5, y + 9).isWithin(new Point(mouseX, mouseY))) {
if (Mouse.isButtonDown(0) && this.lastChangeFrameTime <= 0) {
energyType = (energyType + 1) % 4;
this.lastChangeFrameTime = 60;
} else {
this.drawTooltip(mouseX - this.guiLeft, mouseY - this.guiTop + 10, "Click to change unit.");
}
}
this.lastChangeFrameTime--;
fontRendererObj.drawString(display, x, y, 4210752);
}
Aggregations