Remove duplicate code
This commit is contained in:
@@ -115,6 +115,17 @@ interface Graphics {
|
||||
measure_text(text: string, scale?: number): number;
|
||||
// any texture. part is [u, v, width, height] from 0 to 1, the part of it to draw, like a progress bar's filled part
|
||||
texture(id: string, x: number, y: number, w: number, h: number, part?: [u, v, w, h]): void;
|
||||
// full drawn over empty, filled from 0 to 1 of the way from the left, or from the bottom when direction is "up"
|
||||
progress(
|
||||
empty: string,
|
||||
full: string,
|
||||
x: number,
|
||||
y: number,
|
||||
w: number,
|
||||
h: number,
|
||||
filled: number,
|
||||
direction?: "right" | "up",
|
||||
): void;
|
||||
item(id: string, x: number, y: number, count?: number): void; // an item as a slot shows it
|
||||
clip(x: number, y: number, w: number, h: number, draw: () => void): void; // only draws inside the box
|
||||
|
||||
|
||||
@@ -144,8 +144,8 @@ export function setup(ctx: ClientContext) {
|
||||
height: 166,
|
||||
on_render_background(g) {
|
||||
g.panel(0, 0, 176, 166);
|
||||
const done = menu.data.progress / menu.data.progress_max || 0;
|
||||
g.texture("bworld:arrow_full", 85, 34, 18 * done, 18, [0, 0, done, 1]);
|
||||
const { progress, progress_max } = menu.data;
|
||||
g.progress("bworld:arrow_empty", "bworld:arrow_full", 85, 34, 18, 18, progress / progress_max);
|
||||
},
|
||||
on_render_labels(g) {
|
||||
g.text(menu.title, 8, 6);
|
||||
|
||||
Reference in New Issue
Block a user