- cleanup BulletAppState startPhysics/stopPhysics
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10405 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
31e327bbac
commit
fe20cbb55f
@ -154,6 +154,9 @@ public class BulletAppState implements AppState, PhysicsTickListener {
|
|||||||
* start it before for some reason, you can use this method.
|
* start it before for some reason, you can use this method.
|
||||||
*/
|
*/
|
||||||
public void startPhysics() {
|
public void startPhysics() {
|
||||||
|
if (initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
//start physics thread(pool)
|
//start physics thread(pool)
|
||||||
if (threadingType == ThreadingType.PARALLEL) {
|
if (threadingType == ThreadingType.PARALLEL) {
|
||||||
startPhysicsOnExecutor();
|
startPhysicsOnExecutor();
|
||||||
@ -164,12 +167,23 @@ public class BulletAppState implements AppState, PhysicsTickListener {
|
|||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize(AppStateManager stateManager, Application app) {
|
public void stopPhysics() {
|
||||||
if(!initialized){
|
if(!initialized){
|
||||||
startPhysics();
|
return;
|
||||||
}
|
}
|
||||||
|
if (executor != null) {
|
||||||
|
executor.shutdown();
|
||||||
|
executor = null;
|
||||||
|
}
|
||||||
|
pSpace.removeTickListener(this);
|
||||||
|
pSpace.destroy();
|
||||||
|
initialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initialize(AppStateManager stateManager, Application app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.stateManager = stateManager;
|
this.stateManager = stateManager;
|
||||||
|
startPhysics();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInitialized() {
|
public boolean isInitialized() {
|
||||||
@ -263,13 +277,7 @@ public class BulletAppState implements AppState, PhysicsTickListener {
|
|||||||
stateManager.detach(debugAppState);
|
stateManager.detach(debugAppState);
|
||||||
debugAppState = null;
|
debugAppState = null;
|
||||||
}
|
}
|
||||||
if (executor != null) {
|
stopPhysics();
|
||||||
executor.shutdown();
|
|
||||||
executor = null;
|
|
||||||
}
|
|
||||||
initialized = false;
|
|
||||||
pSpace.removeTickListener(this);
|
|
||||||
pSpace.destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user