add player
This commit is contained in:
parent
aab03eafef
commit
8babb48fd2
3 changed files with 21 additions and 2 deletions
|
@ -10,6 +10,7 @@ HEIGHT :: 900
|
|||
Game :: struct {
|
||||
render: ^sdl3.Renderer,
|
||||
units: [dynamic]Unit,
|
||||
player: Unit,
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
|
@ -23,13 +24,15 @@ main :: proc() {
|
|||
render := sdl3.CreateRenderer(window, "vulkan")
|
||||
|
||||
assert(render != nil)
|
||||
|
||||
units := make([dynamic]Unit)
|
||||
append(&units, Unit{faction = Faction.Player, position = Position{x = 500, y = 500}, hp = 100})
|
||||
append(&units, Unit{faction = Faction.Allied, position = Position{x = 500, y = 500}, hp = 100})
|
||||
append(&units, Unit{faction = Faction.Enemy, position = Position{x = 700, y = 700}, hp = 100})
|
||||
|
||||
game := Game {
|
||||
render = render,
|
||||
units = units,
|
||||
units = units,
|
||||
player = Unit{faction = Faction.Player, position = Position{x = 255, y = 255}, hp = 100},
|
||||
}
|
||||
|
||||
for {
|
||||
|
@ -57,6 +60,8 @@ RenderGame :: proc(game: Game) {
|
|||
RenderUnit(unit, game)
|
||||
}
|
||||
|
||||
RenderUnit(game.player, game)
|
||||
|
||||
sdl3.RenderPresent(game.render)
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue