sdl3 and uh some fun stuff!
This commit is contained in:
parent
bbd12beab2
commit
d5e67552d4
4 changed files with 65 additions and 25 deletions
27
unit.odin
Normal file
27
unit.odin
Normal file
|
@ -0,0 +1,27 @@
|
|||
package main
|
||||
|
||||
import "vendor:sdl3"
|
||||
|
||||
Faction :: enum {
|
||||
Player,
|
||||
Enemy,
|
||||
}
|
||||
|
||||
Unit :: struct {
|
||||
faction: Faction,
|
||||
position: Position,
|
||||
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)
|
||||
}
|
||||
sdl3.RenderRect(
|
||||
game.render,
|
||||
&sdl3.FRect{x = unit.position.x, y = unit.position.y, w = 10, h = 10},
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue