A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/AlmasB/FXGL/commit/7b85fe017 below:

added EngineService onGameReset() to allow services to clean up… · AlmasB/FXGL@7b85fe0 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+11

-0

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+11

-0

lines changed Original file line number Diff line number Diff line change

@@ -47,6 +47,12 @@ abstract class EngineService : Updatable, SerializableType {

47 47

*/

48 48

open fun onGameUpdate(tpf: Double) { }

49 49 50 +

/**

51 +

* Called on the JavaFX thread after the game scene has been reset,

52 +

* when starting a new game or loading the game from a save file.

53 +

*/

54 +

open fun onGameReset() { }

55 + 50 56

/**

51 57

* Called just before the engine exits and the application shuts down.

52 58

*/

Original file line number Diff line number Diff line change

@@ -174,6 +174,10 @@ internal class Engine(val settings: ReadOnlyGameSettings) {

174 174

services.forEach { it.onMainLoopResumed() }

175 175

}

176 176 177 +

fun resetServices() {

178 +

services.forEach { it.onGameReset() }

179 +

}

180 + 177 181

fun write(bundle: Bundle) {

178 182

settings.write(bundle)

179 183

services.forEach { it.write(bundle) }

Original file line number Diff line number Diff line change

@@ -636,6 +636,7 @@ class FXGLApplication : Application() {

636 636

log.debug("Clearing previous game")

637 637 638 638

gameSceneRef.reset()

639 +

engine.resetServices()

639 640

}

640 641 641 642

fun saveGame(dataFile: DataFile) {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4