mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-03 05:10:57 +00:00
break up gameplay stuff
This commit is contained in:
23
Sources/Voxelotl/GameDelegate.swift
Normal file
23
Sources/Voxelotl/GameDelegate.swift
Normal 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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user