Jelajahi Sumber

Added BaseAppState earlier in doc.

mitm001 4 tahun lalu
induk
melakukan
2b959f3e13

+ 7 - 6
docs/modules/core/pages/app/state/application_states.adoc

@@ -52,9 +52,11 @@ AppStates are extremely handy to swap out, or pause/unpause whole sets of other
 
 === Usage
 
+There are two ways to implement AppStates, extend either AbstractAppState or BaseAppState. The differences will be explained in greater detail later.
+
 To implement game logic:
 
-.  Create one AbstractAppState instance for each set of game mechanics.
+.  Create one AbstractAppState or BaseAppState instance for each set of game mechanics.
 .  Implement game behaviour in the AppState's update() method.
 **  You can pass custom data as arguments in the constructor.
 **  The AppState has access to everything inside the app's scope via the Application `app` object.
@@ -87,6 +89,7 @@ a|Usage
 
 a|initialize(asm,app)
 a|When this AppState is added to the game, the RenderThread initializes the AppState and then calls this method. You can modify the scene graph from here (e.g. attach nodes). To get access to the main app, call:
+  |
 [source,java]
 ----
 super.initialize(stateManager, app);
@@ -125,11 +128,10 @@ a|Called after all rendering commands are flushed, including your optional custo
 
 == AbstractAppState
 
-The link:https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-core/src/main/java/com/jme3/app/state/AbstractAppState.java[AbstractAppState] class already implements some common methods (`isInitialized(), setEnabled(), isEnabled()`) and makes creation of custom AppStates a bit easier. We recommend you extend AbstractAppState and override the remaining AppState methods: `initialize(), setEnabled(), cleanup()`.
+The link:https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-core/src/main/java/com/jme3/app/state/AbstractAppState.java[AbstractAppState] class already implements some common methods (`isInitialized(), setEnabled(), isEnabled()`) and makes creation of custom AppStates a bit easier. When you extend AbstractAppState, we recommend you override the remaining AppState methods: `initialize(), setEnabled(), cleanup()`.
 
 Definition:
-
-[source,java]
+[source, java]
 ----
 public class MyAppState extends AbstractAppState {
 
@@ -165,8 +167,7 @@ public class MyAppState extends AbstractAppState {
         this.app.getRootNode().attachChild(getX()); // modify scene graph...
         this.app.doSomethingElse();                 // call custom methods...
       } else {
-        // take away everything not needed while this state is PAUSED
-        ...
+        // take away everything not needed while this state is PAUSED ...
       }
     }