/** * Runs tasks enqueued via {@link #enqueue(Callable)} */ protected void runQueuedTasks() { AppTask<?> task; while( (task = taskQueue.poll()) != null ) { if (!task.isCancelled()) { task.invoke(); } } }
@Override protected void controlUpdate(float tpf) { AppTask<?> task = taskQueue.poll(); toploop: do { if (task == null) break; while (task.isCancelled()) { task = taskQueue.poll(); if (task == null) break toploop; } task.invoke(); } while (((task = taskQueue.poll()) != null)); }
/** * Runs tasks enqueued via {@link #enqueue(Callable)} */ protected void runQueuedTasks() { AppTask<?> task; while( (task = taskQueue.poll()) != null ) { if (!task.isCancelled()) { task.invoke(); } } }
@Override public void internalTick(DynamicsWorld dw, float f) { //execute task list AppTask task = pQueue.poll(); task = pQueue.poll(); while (task != null) { while (task.isCancelled()) { task = pQueue.poll(); } try { task.invoke(); } catch (Exception ex) { logger.log(Level.SEVERE, null, ex); } task = pQueue.poll(); } for (Iterator<PhysicsTickListener> it = tickListeners.iterator(); it.hasNext();) { PhysicsTickListener physicsTickCallback = it.next(); physicsTickCallback.prePhysicsTick(space, f); } } };
/** * Callback invoked just before the physics is stepped. * <p> * This method is invoked from native code. * * @param timeStep the time per physics step (in seconds, ≥0) */ private void preTick_native(float f) { AppTask task; while((task=pQueue.poll())!=null){ if(task.isCancelled())continue; try{ task.invoke(); } catch (Exception ex) { logger.log(Level.SEVERE, null, ex); } } for (Iterator<PhysicsTickListener> it = tickListeners.iterator(); it.hasNext();) { PhysicsTickListener physicsTickCallback = it.next(); physicsTickCallback.prePhysicsTick(this, f); } }
@Override protected void controlUpdate(float tpf) { AppTask<?> task = taskQueue.poll(); toploop: do { if (task == null) break; while (task.isCancelled()) { task = taskQueue.poll(); if (task == null) break toploop; } task.invoke(); } while (((task = taskQueue.poll()) != null)); }
/** * Runs tasks enqueued via {@link #enqueue(Callable)} */ protected void runQueuedTasks() { AppTask<?> task; while( (task = taskQueue.poll()) != null ) { if (!task.isCancelled()) { task.invoke(); } } }
@Override protected void controlUpdate(float tpf) { AppTask<?> task = taskQueue.poll(); toploop: do { if (task == null) break; while (task.isCancelled()) { task = taskQueue.poll(); if (task == null) break toploop; } task.invoke(); } while (((task = taskQueue.poll()) != null)); }
private void preTick_native(float f) { AppTask task = pQueue.poll(); task = pQueue.poll(); while (task != null) { while (task.isCancelled()) { task = pQueue.poll(); } try { task.invoke(); } catch (Exception ex) { Logger.getLogger(PhysicsSpace.class.getName()).log(Level.SEVERE, null, ex); } task = pQueue.poll(); } for (Iterator<PhysicsTickListener> it = tickListeners.iterator(); it.hasNext();) { PhysicsTickListener physicsTickCallback = it.next(); physicsTickCallback.prePhysicsTick(this, f); } }
private void preTick_native(float f) { AppTask task = pQueue.poll(); task = pQueue.poll(); while (task != null) { while (task.isCancelled()) { task = pQueue.poll(); } try { task.invoke(); } catch (Exception ex) { logger.log(Level.SEVERE, null, ex); } task = pQueue.poll(); } for (Iterator<PhysicsTickListener> it = tickListeners.iterator(); it.hasNext();) { PhysicsTickListener physicsTickCallback = it.next(); physicsTickCallback.prePhysicsTick(this, f); } }
@Override public void internalTick(DynamicsWorld dw, float f) { //execute task list AppTask task = pQueue.poll(); task = pQueue.poll(); while (task != null) { while (task.isCancelled()) { task = pQueue.poll(); } try { task.invoke(); } catch (Exception ex) { logger.log(Level.SEVERE, null, ex); } task = pQueue.poll(); } for (Iterator<PhysicsTickListener> it = tickListeners.iterator(); it.hasNext();) { PhysicsTickListener physicsTickCallback = it.next(); physicsTickCallback.prePhysicsTick(space, f); } } };
/** * Do not call manually. * Callback from ContextListener. */ public void update(){ // Make sure the audio renderer is available to callables AudioContext.setAudioRenderer(audioRenderer); AppTask<?> task = taskQueue.poll(); toploop: do { if (task == null) break; while (task.isCancelled()) { task = taskQueue.poll(); if (task == null) break toploop; } task.invoke(); } while (((task = taskQueue.poll()) != null)); if (speed == 0 || paused) return; timer.update(); if (inputEnabled){ inputManager.update(timer.getTimePerFrame()); } if (audioRenderer != null){ audioRenderer.update(timer.getTimePerFrame()); } // user code here.. }