feat: Add quit callback support to engine and UI components
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -82,7 +82,10 @@ class Wolf3d {
|
||||
/// Uses [activeGame], [activeEpisode], and [activeDifficulty]. Stores the
|
||||
/// engine so it can be retrieved via [engine]. [onGameWon] is invoked when
|
||||
/// the player completes the final level of the episode.
|
||||
WolfEngine launchEngine({required void Function() onGameWon}) {
|
||||
WolfEngine launchEngine({
|
||||
required void Function() onGameWon,
|
||||
void Function()? onQuit,
|
||||
}) {
|
||||
if (availableGames.isEmpty) {
|
||||
throw StateError(
|
||||
'No game data was discovered. Add game files before launching the engine.',
|
||||
@@ -102,6 +105,7 @@ class Wolf3d {
|
||||
// In Flutter we keep the renderer screen active while browsing menus,
|
||||
// so backing out of the top-level menu should not pop the route.
|
||||
onMenuExit: () {},
|
||||
onQuit: onQuit,
|
||||
onGameSelected: (game) {
|
||||
_activeGame = game;
|
||||
audio.activeGame = game;
|
||||
|
||||
Reference in New Issue
Block a user