diff options
author | ubq323 <ubq323@ubq323.website> | 2024-04-16 12:34:18 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2024-04-16 12:34:18 +0100 |
commit | 187d6d32e71aface08c1c486874901ecc9b160c1 (patch) | |
tree | f6c7e69d099e5a6ffcc9ca88a41f9cf15b76d8e1 /drawing | |
parent | 9bb892b35308919ff93d22e12387e6bdc0a64223 (diff) |
fix chunkloading and unloading on client
Diffstat (limited to 'drawing')
-rw-r--r-- | drawing/drawing.ha | 23 |
1 files changed, 12 insertions, 11 deletions
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); +}; |