convert classes to es6
(cherry picked from commit e7615d49a4071fe5b5f192884f142c9f3385211a)
This commit is contained in:
@@ -1,4 +1,28 @@
|
||||
window.Gui = class {
|
||||
import Point from "../render/isometric/Point.js";
|
||||
import IsometricRenderer from "../render/isometric/IsometricRenderer.js";
|
||||
import EnumBlockFace from "../../util/EnumBlockFace.js";
|
||||
|
||||
export default class Gui {
|
||||
|
||||
constructor(minecraft = null) {
|
||||
this.minecraft = minecraft;
|
||||
}
|
||||
|
||||
getTexture(id) {
|
||||
return this.minecraft.resources[id];
|
||||
}
|
||||
|
||||
drawCenteredString(stack, string, x, y, color = -1) {
|
||||
this.minecraft.fontRenderer.drawString(stack, string, x - this.getStringWidth(stack, string) / 2, y, color);
|
||||
}
|
||||
|
||||
drawString(stack, string, x, y, color = -1) {
|
||||
this.minecraft.fontRenderer.drawString(stack, string, x, y, color);
|
||||
}
|
||||
|
||||
getStringWidth(stack, string) {
|
||||
return this.minecraft.fontRenderer.getStringWidth(string);
|
||||
}
|
||||
|
||||
drawRect(stack, left, top, right, bottom, color, alpha = 1) {
|
||||
stack.save();
|
||||
@@ -8,18 +32,6 @@ window.Gui = class {
|
||||
stack.restore();
|
||||
}
|
||||
|
||||
drawCenteredString(stack, string, x, y, color = -1) {
|
||||
FontRenderer.INSTANCE.drawString(stack, string, x - this.getStringWidth(stack, string) / 2, y, color);
|
||||
}
|
||||
|
||||
drawString(stack, string, x, y, color = -1) {
|
||||
FontRenderer.INSTANCE.drawString(stack, string, x, y, color);
|
||||
}
|
||||
|
||||
getStringWidth(stack, string) {
|
||||
return FontRenderer.INSTANCE.getStringWidth(string);
|
||||
}
|
||||
|
||||
drawTexture(stack, texture, x, y, width, height, alpha = 1.0) {
|
||||
Gui.drawSprite(stack, texture, 0, 0, 256, 256, x, y, width, height, alpha);
|
||||
}
|
||||
@@ -109,8 +121,4 @@ window.Gui = class {
|
||||
stack.drawImage(texture, spriteX, spriteY, spriteWidth, spriteHeight, x, y, width, height);
|
||||
stack.restore();
|
||||
}
|
||||
|
||||
static loadTexture(path) {
|
||||
return document.textures[path];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user