break up gameplay stuff

This commit is contained in:
2024-08-13 08:38:21 +10:00
parent 5b97a02288
commit dc88042a36
13 changed files with 448 additions and 132 deletions

View File

@ -0,0 +1,23 @@
public protocol GameDelegate {
func fixedUpdate(_ time: GameTime)
func update(_ time: GameTime)
func draw(_ renderer: Renderer, _ time: GameTime)
func resize(_ size: Size<Int>)
}
public extension GameDelegate {
func fixedUpdate(_ time: GameTime) {}
func update(_ time: GameTime) {}
func resize(_ size: Size<Int>) {}
}
public struct GameTime {
let total: Duration
let delta: Duration
}
extension Duration {
var asFloat: Double {
Double(components.seconds) + Double(components.attoseconds) * 1e-18
}
}