fumarole/unit.odin

39 lines
713 B
Odin
Raw Normal View History

2025-06-22 21:35:03 +02:00
package main
2025-06-28 15:08:49 +02:00
import "util"
2025-06-22 21:35:03 +02:00
import "vendor:sdl3"
Faction :: enum {
Player,
2025-06-22 21:47:58 +02:00
Allied,
2025-06-22 21:35:03 +02:00
Enemy,
}
Unit :: struct {
faction: Faction,
2025-06-28 15:08:49 +02:00
position: util.Position,
velocity: util.Velocity,
2025-06-22 21:35:03 +02:00
hp: u32,
}
RenderUnit :: proc(unit: Unit, game: ^Game) {
2025-06-22 21:35:03 +02:00
switch unit.faction {
case Faction.Player:
sdl3.SetRenderDrawColor(game.render, 0, 255, 0, 0)
case Faction.Enemy:
sdl3.SetRenderDrawColor(game.render, 255, 0, 0, 0)
2025-06-22 21:47:58 +02:00
case Faction.Allied:
sdl3.SetRenderDrawColor(game.render, 0, 0, 255, 0)
2025-06-22 21:35:03 +02:00
}
sdl3.RenderRect(
game.render,
&sdl3.FRect{x = unit.position.x, y = unit.position.y, w = 10, h = 10},
)
}
2025-06-22 21:47:58 +02:00
Projectile :: struct {
faction: Faction,
2025-06-28 15:08:49 +02:00
position: util.Position,
direction: util.Velocity,
2025-06-22 21:47:58 +02:00
}