protected void terminatePending(){ AppState[] array = getTerminating(); if (array.length == 0) return; for (AppState state : array) { state.cleanup(); } synchronized( states ) { // Remove just the states that were terminated... // which might now be a subset of the total terminating // list. terminating.removeAll(Arrays.asList(array)); } }
@Override protected void prepareTerrain() { if (!addedTerrains.isEmpty()) { for (TerrainQuad t : addedTerrains) { if (!terrains.contains(t)) { terrains.add(t); } } addedTerrains.clear(); } if (!removedTerrains.isEmpty()) { terrains.removeAll(removedTerrains); removedTerrains.clear(); } for (TerrainQuad terrain : terrains.getArray()) { // cache the terrain's world transforms so they can be accessed on the separate thread safely terrain.cacheTerrainTransforms(); } }
protected void initializePending(){ AppState[] array = getInitializing(); if (array.length == 0) return; synchronized( states ) { // Move the states that will be initialized // into the active array. In all but one case the // order doesn't matter but if we do this here then // a state can detach itself in initialize(). If we // did it after then it couldn't. List<AppState> transfer = Arrays.asList(array); states.addAll(transfer); initializing.removeAll(transfer); } for (AppState state : array) { state.initialize(this, app); } }
protected void terminatePending(){ AppState[] array = getTerminating(); for (AppState state : array) { state.cleanup(); } synchronized( states ) { // Remove just the states that were terminated... // which might now be a subset of the total terminating // list. terminating.removeAll(Arrays.asList(array)); } }
protected void terminatePending(){ AppState[] array = getTerminating(); if (array.length == 0) return; for (AppState state : array) { state.cleanup(); } synchronized( states ) { // Remove just the states that were terminated... // which might now be a subset of the total terminating // list. terminating.removeAll(Arrays.asList(array)); } }
protected void initializePending(){ AppState[] array = getInitializing(); synchronized( states ) { // Move the states that will be initialized // into the active array. In all but one case the // order doesn't matter but if we do this here then // a state can detach itself in initialize(). If we // did it after then it couldn't. List<AppState> transfer = Arrays.asList(array); states.addAll(transfer); initializing.removeAll(transfer); } for (AppState state : array) { state.initialize(this, app); } }
protected void initializePending(){ AppState[] array = getInitializing(); if (array.length == 0) return; synchronized( states ) { // Move the states that will be initialized // into the active array. In all but one case the // order doesn't matter but if we do this here then // a state can detach itself in initialize(). If we // did it after then it couldn't. List<AppState> transfer = Arrays.asList(array); states.addAll(transfer); initializing.removeAll(transfer); } for (AppState state : array) { state.initialize(this, app); } }