|
@@ -1,6 +1,6 @@
|
|
= Main Update Loop
|
|
= Main Update Loop
|
|
-:author:
|
|
|
|
-:revnumber:
|
|
|
|
|
|
+:author:
|
|
|
|
+:revnumber:
|
|
:revdate: 2016/03/17 20:48
|
|
:revdate: 2016/03/17 20:48
|
|
:keywords: basegame, control, input, init, keyinput, loop, states, state
|
|
:keywords: basegame, control, input, init, keyinput, loop, states, state
|
|
:relfileprefix: ../../
|
|
:relfileprefix: ../../
|
|
@@ -16,7 +16,7 @@ To let you see the main update loop in context, understand that the SimpleApplic
|
|
|
|
|
|
* *Initialization* – Execute `simpleInitApp()` method once.
|
|
* *Initialization* – Execute `simpleInitApp()` method once.
|
|
* *Main Update Loop*
|
|
* *Main Update Loop*
|
|
-.. Input listeners respond to mouse clicks and keyboard presses – <<jme3/advanced/input_handling#,Input handling>>
|
|
|
|
|
|
+.. Input listeners respond to mouse clicks and keyboard presses – <<jme3/advanced/input_handling#,Input handling>>
|
|
.. Update game state:
|
|
.. Update game state:
|
|
... Update overall game state – Execute <<jme3/advanced/application_states#,Application States>>
|
|
... Update overall game state – Execute <<jme3/advanced/application_states#,Application States>>
|
|
... User code update – Execute `simpleUpdate()` method
|
|
... User code update – Execute `simpleUpdate()` method
|
|
@@ -35,7 +35,7 @@ The jME window closes and the loop ends.
|
|
|
|
|
|
== Usage
|
|
== Usage
|
|
|
|
|
|
-In a trivial <<jme3/intermediate/simpleapplication#,SimpleApplication>> (such as a <<jme3/beginner#,Hello World tutorial>>), all code is either in the `simpleInitApp()` (initialization) or `simpleUpdate()` (behaviour) method – or in a helper method/class that is called from one of these two. This trivial approach will make your main class very long, hard to read, and hard to maintain. You don't need to load the whole scene at once, and you don't need to run all conditionals tests all the time.
|
|
|
|
|
|
+In a trivial <<jme3/intermediate/simpleapplication#,SimpleApplication>> (such as a xref:tutorials:beginner.adoc[Hello World tutorial]), all code is either in the `simpleInitApp()` (initialization) or `simpleUpdate()` (behaviour) method – or in a helper method/class that is called from one of these two. This trivial approach will make your main class very long, hard to read, and hard to maintain. You don't need to load the whole scene at once, and you don't need to run all conditionals tests all the time.
|
|
|
|
|
|
It's a best practice to modularize your game mechanics and spread out initialization and update loop code over several Java objects:
|
|
It's a best practice to modularize your game mechanics and spread out initialization and update loop code over several Java objects:
|
|
|
|
|