summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorRadioactivity <85001747+voidwyrm-2@users.noreply.github.com>2025-07-25 15:27:58 -1000
committerRadioactivity <85001747+voidwyrm-2@users.noreply.github.com>2025-07-25 15:28:13 -1000
commitced33b055f97e6d2882c80f4d7499ff138e77725 (patch)
tree5ce52861f72e7fe21032c60c64599341fbc2dc2e /src/main.zig
parent9740213a305630799165fc03fd9c7bc0e6b9957a (diff)
Attempting mouse screen to world coord translation
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
index fff3c4d..3aa5c1f 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -372,6 +372,12 @@ const Wave = struct {
}
return self.map[y][x];
}
+
+ fn set(self: *Wave, x: usize, y: usize, cell: Cell) void {
+ if (x < cells_width and y < cells_height) {
+ self.map[y][x] = cell;
+ }
+ }
};
const TextureKind = enum {
@@ -514,6 +520,13 @@ const ScreenMainMenu = struct {
rl.beginMode2D(self.camera);
defer rl.endMode2D();
+ const msp = rl.getMousePosition();
+
+ const x = msp.x / (cells_width * cells_height);
+ const y = msp.y / (cells_width * cells_height);
+
+ rl.drawRectangleRec(rl.Rectangle.init(x, y, 100, 100), rl.Color.white);
+
// what are we actually calling this game?
rl.drawTextEx(game.font_title, "Bug Defenders", rl.Vector2.init(495, 160), 40, 4, rl.Color.white);