extract math util into sub package

This commit is contained in:
Morrígan 2025-06-28 15:08:49 +02:00
parent 538c8c215f
commit 60d71ae1c0
Signed by: morrigan
GPG key ID: CACB010F463A77D0
4 changed files with 35 additions and 8 deletions

View file

@ -2,6 +2,7 @@ package main
import "core:fmt"
import "core:image/png"
import "util"
import "vendor:sdl3"
WIDTH :: 1600
@ -29,8 +30,24 @@ main :: proc() {
assert(render != nil)
units := make([dynamic]Unit)
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})
append(
&units,
Unit {
faction = Faction.Allied,
position = util.Position{x = 500, y = 500},
velocity = DEFAULT_VELOCITY,
hp = 100,
},
)
append(
&units,
Unit {
faction = Faction.Enemy,
position = util.Position{x = 700, y = 700},
velocity = DEFAULT_VELOCITY,
hp = 100,
},
)
input_state := make(map[sdl3.Scancode]bool)
time := sdl3.GetTicksNS()
@ -39,7 +56,12 @@ main :: proc() {
game := Game {
render = render,
units = units,
player = Unit{faction = Faction.Player, position = Position{x = 255, y = 255}, hp = 100},
player = Unit {
faction = Faction.Player,
position = util.Position{x = 255, y = 255},
velocity = DEFAULT_VELOCITY,
hp = 100,
},
time = time,
delta = 0.0,
input_state = input_state,