- Add execution of queued tasks to FakeApplication

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10080 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 2d1af0f1f8
commit 4c87e3ecae
  1. 22
      sdk/jme3-core/src/com/jme3/gde/core/scene/FakeApplication.java
  2. 3
      sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java

@ -431,6 +431,28 @@ public class FakeApplication extends SimpleApplication {
}
}
public boolean runQueuedFake() {
Future fut = fakeAppThread.submit(new Callable<Void>() {
public Void call() throws Exception {
runQueuedTasks();
return null;
}
});
try {
fut.get(1, TimeUnit.MINUTES);
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
} catch (ExecutionException ex) {
DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message("Exception in queued Tasks."));
return false;
} catch (TimeoutException ex) {
fut.cancel(true);
DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message("Update loop was blocked for too long, task execution halted."));
return false;
}
return true;
}
public boolean updateFake(final float tpf) {
Future fut = fakeAppThread.submit(new Callable<Void>() {
public Void call() throws Exception {

@ -266,6 +266,9 @@ public class SceneApplication extends Application implements LookupProvider {
try {
super.update();
FakeApplication fakap = fakeApp;
if (fakap != null) {
fakap.runQueuedFake();
}
float tpf = timer.getTimePerFrame();
camLight.setPosition(cam.getLocation());
secondCounter += tpf;

Loading…
Cancel
Save