Added some methods for bulk-attaching a bunch

of app states at once.  This is useful when
attaching several app states from a different
thread because there is a guarantee that they
all get initialized together before any of their
update() methods are called.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10504 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
PSp..om 12 years ago
parent c689ba4e9b
commit a62a2d0299
  1. 26
      engine/src/core/com/jme3/app/state/AppStateManager.java

@ -139,6 +139,32 @@ public class AppStateManager {
}
}
/**
* Attaches many state to the AppStateManager in a way that is guaranteed
* that they will all get initialized before any of their updates are run.
* The same state cannot be attached twice and will be ignored.
*
* @param states The states to attach
*/
public void attachAll(AppState... states){
attachAll(Arrays.asList(states));
}
/**
* Attaches many state to the AppStateManager in a way that is guaranteed
* that they will all get initialized before any of their updates are run.
* The same state cannot be attached twice and will be ignored.
*
* @param states The states to attach
*/
public void attachAll(Iterable<AppState> states){
synchronized (this.states){
for( AppState state : states ) {
attach(state);
}
}
}
/**
* Detaches the state from the AppStateManager.
*

Loading…
Cancel
Save