Renaming AppState.setActive()/isActive() to setEnabled()/isEnabled() for consistency git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7143 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
2762ba3b27
commit
16fc60c8a0
@ -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) {
|
||||
|
@ -64,21 +64,40 @@ public interface AppState {
|
||||
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.
|
||||
*
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
setEnabled(active);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use isEnabled() instead
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isActive() {
|
||||
return isEnabled();
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
if (enabled) {
|
||||
play();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
|
||||
public boolean isEnabled() {
|
||||
return playState == PlayState.Playing;
|
||||
}
|
||||
|
||||
|
||||
public void stateAttached(AppStateManager stateManager) {
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user