mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-03 21:21:34 +00:00
24 lines
529 B
Swift
24 lines
529 B
Swift
|
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
|
||
|
}
|
||
|
}
|