From 187d6d32e71aface08c1c486874901ecc9b160c1 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Tue, 16 Apr 2024 12:34:18 +0100 Subject: fix chunkloading and unloading on client --- drawing/drawing.ha | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'drawing/drawing.ha') diff --git a/drawing/drawing.ha b/drawing/drawing.ha index 54116a3..ae36501 100644 --- a/drawing/drawing.ha +++ b/drawing/drawing.ha @@ -127,23 +127,24 @@ export fn stroke(picture: *picture, c0: pos, c1: pos, r: i32, color: u32) void = }; // ehh should check bounding box instead of doing all pictures maybe -export fn perform(pictures: []picture, op: op) void = { +export fn perform(pic: *picture, op: op) void = { match (op) { case let o: op_circle => const x = o.pos.0, y=o.pos.1; const r = o.radius; const c = o.color & 0xffffff; - for (const pic &.. pictures) { - let pos_within_pic = - (x - pic.world_pos.0, y - pic.world_pos.1): pos; - circle(pic, pos_within_pic, r: i32, c); - }; + const pos_within_pic: pos = + (x - pic.world_pos.0, y - pic.world_pos.1); + circle(pic, pos_within_pic, r: i32, c); case let s: op_stroke => const col = s.color & 0xffffff; - for (const pic &.. pictures) { - const c0 = (s.pos0.0 - pic.world_pos.0, s.pos0.1 - pic.world_pos.1); - const c1 = (s.pos1.0 - pic.world_pos.0, s.pos1.1 - pic.world_pos.1); - stroke(pic, c0, c1, s.radius: i32, col); - }; + const c0 = (s.pos0.0 - pic.world_pos.0, s.pos0.1 - pic.world_pos.1); + const c1 = (s.pos1.0 - pic.world_pos.0, s.pos1.1 - pic.world_pos.1); + stroke(pic, c0, c1, s.radius: i32, col); }; }; + +export fn perform_multi(pictures: []picture, op: op) void = { + for (const pic &.. pictures) + perform(pic, op); +}; -- cgit v1.2.3