Change whole gui system

This commit is contained in:
2026-10-01 16:22:02 -03:00
parent 013a4fbb97
commit deba36260e
48 changed files with 1925 additions and 1302 deletions
+24 -5
View File
@@ -1,10 +1,13 @@
// the curios button next to every inventory screen, or G like curios' keybind, asks the server to show the slots
// the curios button next to every inventory screen, or G like curios' keybind, asks the server to open the curios
// menu, and its screen
import type { ClientContext } from "bworld/client";
import { active_slots } from "./slots.ts";
const GAP = 16;
const WIDTH = 120;
const HEIGHT = 32;
// in gui pixels
const GAP = 5;
const BUTTON_WIDTH = 40;
const BUTTON_HEIGHT = 11;
const WIDTH = 176;
export function setup(ctx: ClientContext) {
// no item goes in any slot, so there's nothing to show
@@ -12,10 +15,26 @@ export function setup(ctx: ClientContext) {
ctx.ui.add_inventory_overlay({
on_render(g, screen) {
const clicked = g.button("Curios", screen.x - WIDTH - GAP, screen.y, WIDTH, HEIGHT);
const clicked = g.button("Curios", screen.x - BUTTON_WIDTH - GAP, screen.y, BUTTON_WIDTH, BUTTON_HEIGHT);
if (clicked || g.key_pressed("KeyG")) {
ctx.net.send("curios:open", {});
}
},
});
ctx.ui.register_menu_screen("curios:curios", (menu) => {
const { rows } = menu.open_data as { rows: number };
const height = 114 + rows * 18;
return {
width: WIDTH,
height,
on_render_background(g) {
g.panel(0, 0, WIDTH, height);
},
on_render_labels(g) {
g.text(menu.title, 8, 6);
g.text("Inventory", 8, height - 93);
},
};
});
}