Last active
February 14, 2022 22:41
-
-
Save hobnob/9a1e5a2d1039576948e3a904d915fc64 to your computer and use it in GitHub Desktop.
A diff describing the changes needed to make HelloIndigo use `IndigoGame`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1,17 +1,15 @@ | |
import indigo._ | |
+import indigo.scenes._ | |
import scala.scalajs.js.annotation.JSExportTopLevel | |
@JSExportTopLevel("IndigoGame") | |
-object HelloIndigo extends IndigoSandbox[Unit, Model] { | |
+object HelloIndigo extends IndigoGame[Unit, Unit, Model, Unit] { | |
val magnification = 3 | |
val config: GameConfig = | |
GameConfig.default.withMagnification(magnification) | |
- val animations: Set[Animation] = | |
- Set() | |
- | |
val assetName = AssetName("dots") | |
val assets: Set[AssetType] = | |
@@ -19,13 +17,24 @@ | |
AssetType.Image(AssetName("dots"), AssetPath("assets/dots.png")) | |
) | |
- val fonts: Set[FontInfo] = | |
- Set() | |
+ def initialScene(bootData: Unit): Option[SceneName] = | |
+ None | |
+ | |
+ def scenes(bootData: Unit): NonEmptyList[Scene[Unit, Model, Unit]] = | |
+ NonEmptyList(Scene.empty) | |
+ | |
+ val eventFilters: EventFilters = | |
+ EventFilters.Permissive | |
- val shaders: Set[Shader] = | |
- Set() | |
+ def boot(flags: Map[String, String]): Outcome[BootResult[Unit]] = | |
+ Outcome( | |
+ BootResult | |
+ .noData(config) | |
+ .withAssets(assets) | |
+ ) | |
def setup( | |
+ bootData: Unit, | |
assetCollection: AssetCollection, | |
dice: Dice | |
): Outcome[Startup[Unit]] = | |
@@ -66,9 +75,20 @@ | |
Outcome(model) | |
} | |
+ def initialViewModel(startupData: Unit, model: Model): Outcome[Unit] = | |
+ Outcome(()) | |
+ | |
+ def updateViewModel( | |
+ context: FrameContext[Unit], | |
+ model: Model, | |
+ viewModel: Unit | |
+ ): GlobalEvent => Outcome[Unit] = | |
+ _ => Outcome(()) | |
+ | |
def present( | |
context: FrameContext[Unit], | |
- model: Model | |
+ model: Model, | |
+ viewModel: Unit | |
): Outcome[SceneUpdateFragment] = | |
Outcome( | |
SceneUpdateFragment( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment