minart
minart copied to clipboard
Experiment with subsystems as capabilities
The AppLoop logic is currently a bit wonky, especially the *AppLoop variants, with a (CanvasSubsystem with AudioPlayerSubsystem) cake.
With Scala 3, I think it should be possible to redefine it as something like:
def statefulAppLoop[State](
renderFrame: State => (Canvas, AudioPlayer) ?=> State,
terminateWhen: State => Boolean = (_: State) => false
): AppLoop.Definition[State, (Canvas.Settings, AudioPlayer.Settings), LowLevelAllSubsystems] =
statefulLoop[State, (Canvas.Settings, AudioPlayer.Settings), LowLevelAllSubsystems](
renderFrame,
terminateWhen
)
I think I still need to think a bit about the (Canvas.Settings, AudioPlayer.Settings) and LowLevelAllSubsystems. It's not as easy as it looks due to the default backends.
Some inspiration: https://nrinaudo.github.io/articles/capabilities.html