commands, towers, etc

This commit is contained in:
2026-06-10 02:32:01 -07:00
parent 2e09dbe65d
commit 114c298219
5 changed files with 65 additions and 4 deletions
+32
View File
@@ -0,0 +1,32 @@
package game
import rl "vendor:raylib"
Command_Kind :: enum {
None,
Place_Tower,
}
Command :: struct {
kind: Command_Kind,
gx: int,
gy: int,
}
gather_commands :: proc(world: ^World) -> Command {
if rl.IsMouseButtonPressed(.LEFT) {
mouse := rl.GetMousePosition()
gx, gy := screen_to_grid(mouse.x, mouse.y)
return Command{kind = .Place_Tower, gx = gx, gy = gy}
}
return Command{kind = .None}
}
execute_command :: proc(world: ^World, cmd: Command) {
switch cmd.kind {
case .None:
case .Place_Tower:
try_place_tower(world, cmd.gx, cmd.gy)
}
}