38 lines
713 B
Odin
38 lines
713 B
Odin
package main
|
|
|
|
import "util"
|
|
import "vendor:sdl3"
|
|
|
|
Faction :: enum {
|
|
Player,
|
|
Allied,
|
|
Enemy,
|
|
}
|
|
|
|
Unit :: struct {
|
|
faction: Faction,
|
|
position: util.Position,
|
|
velocity: util.Velocity,
|
|
hp: u32,
|
|
}
|
|
|
|
RenderUnit :: proc(unit: Unit, game: ^Game) {
|
|
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)
|
|
case Faction.Allied:
|
|
sdl3.SetRenderDrawColor(game.render, 0, 0, 255, 0)
|
|
}
|
|
sdl3.RenderRect(
|
|
game.render,
|
|
&sdl3.FRect{x = unit.position.x, y = unit.position.y, w = 10, h = 10},
|
|
)
|
|
}
|
|
|
|
Projectile :: struct {
|
|
faction: Faction,
|
|
position: util.Position,
|
|
direction: util.Velocity,
|
|
}
|