* 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;
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) {
public boolean isInitialized();
/**
+ * Use setEnabled() instead.
* Activate or deactivate the functionality of the <code>AppState</code>.
* The effect of this call depends on implementation. An
* <code>AppState</code> 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 <code>AppState</code> is active, false otherwise.
*
* @see AppState#setActive(boolean)
*/
+ @Deprecated
public boolean isActive();
/**
+ * Enable or disable the functionality of the <code>AppState</code>.
+ * The effect of this call depends on implementation. An
+ * <code>AppState</code> starts as being enabled by default.
+ *
+ * @param active activate the AppState or not.
+ */
+ public void setEnabled(boolean active);
+
+ /**
+ * @return True if the <code>AppState</code> is enabled, false otherwise.
+ *
+ * @see AppState#setEnabled(boolean)
+ */
+ public boolean isEnabled();
+ /**
* Called when the state was attached.
*
* @param stateManager State manager to which the state was attached to.
if (!state.isInitialized())\r
state.initialize(this, app);\r
\r
- if (state.isActive()) {\r
+ if (state.isEnabled()) {\r
state.update(tpf);\r
}\r
}\r
if (!state.isInitialized())\r
state.initialize(this, app);\r
\r
- if (state.isActive()) {\r
+ if (state.isEnabled()) {\r
state.render(rm);\r
}\r
}\r
if (!state.isInitialized())\r
state.initialize(this, app);\r
\r
- if (state.isActive()) {\r
+ if (state.isEnabled()) {\r
state.postRender();\r
}\r
}\r
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) {
}
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;
}