implement settings and controls screen

This commit is contained in:
LabyStudio
2022-02-05 16:58:30 +01:00
parent 52427e610d
commit e1c5ccfa89
10 changed files with 108 additions and 14 deletions
@@ -0,0 +1,40 @@
window.GuiControls = class extends GuiScreen {
constructor(previousScreen) {
super();
this.previousScreen = previousScreen;
}
init() {
super.init();
let settings = this.minecraft.settings;
let scope = this;
this.buttonList.push(new GuiKeyButton("Crouch", settings.crouching, this.width / 2 - 100, this.height / 2 - 20, 200, 20, function (key) {
settings.crouching = key;
scope.init();
}));
this.buttonList.push(new GuiKeyButton("Sprint", settings.sprinting, this.width / 2 - 100, this.height / 2 + 5, 200, 20, function (key) {
settings.sprinting = key;
scope.init();
}));
this.buttonList.push(new GuiButton("Done", this.width / 2 - 100, this.height / 2 + 70, 200, 20, function () {
scope.minecraft.displayScreen(scope.previousScreen);
}));
}
drawScreen(stack, mouseX, mouseY, partialTicks) {
// Background
this.drawRect(stack, 0, 0, this.width, this.height, 'black', 0.6);
// Title
this.drawCenteredString(stack, "Controls", this.width / 2, 50);
super.drawScreen(stack, mouseX, mouseY, partialTicks);
}
}