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

@ -1,8 +1,10 @@
package main
import "core:fmt"
import "util"
import "vendor:sdl3"
DEFAULT_VELOCITY: util.Velocity : util.Velocity{x = 0, y = 0}
SPEED: f32 : 200
HandleInput :: proc(game: ^Game, event: sdl3.Event) {
@ -15,6 +17,7 @@ MovePlayer :: proc(game: ^Game) {
y += game.input_state[sdl3.Scancode.S] ? SPEED : 0
x: f32 = game.input_state[sdl3.Scancode.A] ? -SPEED : 0
x += game.input_state[sdl3.Scancode.D] ? SPEED : 0
game.player.velocity = util.Velocity{x, y}
game.player.position.y += y * game.delta
game.player.position.x += x * game.delta