diff --git a/engine/src/core/com/jme3/app/state/AbstractAppState.java b/engine/src/core/com/jme3/app/state/AbstractAppState.java index c075d0252..bfc320122 100644 --- a/engine/src/core/com/jme3/app/state/AbstractAppState.java +++ b/engine/src/core/com/jme3/app/state/AbstractAppState.java @@ -49,7 +49,7 @@ public class AbstractAppState implements AppState { * is set back to false. */ protected boolean initialized = false; - private boolean active = true; + private boolean enabled = true; public void initialize(AppStateManager stateManager, Application app) { initialized = true; @@ -59,12 +59,28 @@ public class AbstractAppState implements AppState { return initialized; } + /** + * Use setEnabled() instead + */ + @Deprecated public void setActive(boolean active) { - this.active = active; + setEnabled(active); } + /** + * Use isEnabled() instead + */ + @Deprecated public boolean isActive() { - return active; + return isEnabled(); + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public boolean isEnabled() { + return enabled; } public void stateAttached(AppStateManager stateManager) { diff --git a/engine/src/core/com/jme3/app/state/AppState.java b/engine/src/core/com/jme3/app/state/AppState.java index c8c1f66a1..77450b1a0 100644 --- a/engine/src/core/com/jme3/app/state/AppState.java +++ b/engine/src/core/com/jme3/app/state/AppState.java @@ -64,21 +64,40 @@ public interface AppState { public boolean isInitialized(); /** + * Use setEnabled() instead. * Activate or deactivate the functionality of the AppState. * The effect of this call depends on implementation. An * AppState starts as being active by default. * * @param active activate the AppState or not. */ + @Deprecated public void setActive(boolean active); /** + * Use isEnabled() instead. * @return True if the AppState is active, false otherwise. * * @see AppState#setActive(boolean) */ + @Deprecated public boolean isActive(); + /** + * Enable or disable the functionality of the AppState. + * The effect of this call depends on implementation. An + * AppState starts as being enabled by default. + * + * @param active activate the AppState or not. + */ + public void setEnabled(boolean active); + + /** + * @return True if the AppState is enabled, false otherwise. + * + * @see AppState#setEnabled(boolean) + */ + public boolean isEnabled(); /** * Called when the state was attached. * diff --git a/engine/src/core/com/jme3/app/state/AppStateManager.java b/engine/src/core/com/jme3/app/state/AppStateManager.java index 2ea5b5ad7..4af07984b 100644 --- a/engine/src/core/com/jme3/app/state/AppStateManager.java +++ b/engine/src/core/com/jme3/app/state/AppStateManager.java @@ -139,7 +139,7 @@ public class AppStateManager { if (!state.isInitialized()) state.initialize(this, app); - if (state.isActive()) { + if (state.isEnabled()) { state.update(tpf); } } @@ -158,7 +158,7 @@ public class AppStateManager { if (!state.isInitialized()) state.initialize(this, app); - if (state.isActive()) { + if (state.isEnabled()) { state.render(rm); } } @@ -177,7 +177,7 @@ public class AppStateManager { if (!state.isInitialized()) state.initialize(this, app); - if (state.isActive()) { + if (state.isEnabled()) { state.postRender(); } } diff --git a/engine/src/core/com/jme3/cinematic/Cinematic.java b/engine/src/core/com/jme3/cinematic/Cinematic.java index 2ca24ba6d..e2a29fb63 100644 --- a/engine/src/core/com/jme3/cinematic/Cinematic.java +++ b/engine/src/core/com/jme3/cinematic/Cinematic.java @@ -198,16 +198,33 @@ public class Cinematic extends AbstractCinematicEvent implements Savable, AppSta return initialized; } + /** + * Use setEnabled() instead + */ + @Deprecated public void setActive(boolean active) { - if (active) { - play(); - } + setEnabled(active); } + /** + * Use isEnabled() instead + */ + @Deprecated public boolean isActive() { + return isEnabled(); + } + + public void setEnabled(boolean enabled) { + if (enabled) { + play(); + } + } + + public boolean isEnabled() { return playState == PlayState.Playing; } + public void stateAttached(AppStateManager stateManager) { } diff --git a/engine/src/jbullet/com/jme3/bullet/BulletAppState.java b/engine/src/jbullet/com/jme3/bullet/BulletAppState.java index 3617d15ea..a94755872 100644 --- a/engine/src/jbullet/com/jme3/bullet/BulletAppState.java +++ b/engine/src/jbullet/com/jme3/bullet/BulletAppState.java @@ -149,11 +149,27 @@ public class BulletAppState implements AppState, PhysicsTickListener { return initialized; } + /** + * Use setEnabled() instead + */ + @Deprecated public void setActive(boolean active) { - this.active = active; + setEnabled(active); } + /** + * Use isEnabled() instead + */ + @Deprecated public boolean isActive() { + return isEnabled(); + } + + public void setEnabled(boolean enabled) { + this.active = enabled; + } + + public boolean isEnabled() { return active; }