/** * Do not call directly: Called by the state manager to terminate this * state post-detachment or during state manager termination. * This implementation calls onDisable() if the state is enabled and * then cleanup(app). */ @Override public final void cleanup() { log.log(Level.FINEST, "cleanup():{0}", this); if( isEnabled() ) { log.log(Level.FINEST, "onDisable():{0}", this); onDisable(); } cleanup(app); initialized = false; } }
public final <T extends AppState> T getState( Class<T> type, boolean failOnMiss ) { return getStateManager().getState( type, failOnMiss ); }
/** * Do not call directly: Called by the state manager to initialize this * state post-attachment. * This implementation calls initialize(app) and then onEnable() if the * state is enabled. */ @Override public final void initialize( AppStateManager stateManager, Application app ) { log.log(Level.FINEST, "initialize():{0}", this); this.app = app; initialized = true; initialize(app); if( isEnabled() ) { log.log(Level.FINEST, "onEnable():{0}", this); onEnable(); } }
@Override public final void setEnabled( boolean enabled ) { if( this.enabled == enabled ) return; this.enabled = enabled; if( !isInitialized() ) return; if( enabled ) { log.log(Level.FINEST, "onEnable():{0}", this); onEnable(); } else { log.log(Level.FINEST, "onDisable():{0}", this); onDisable(); } }
public final <T extends AppState> T getState( Class<T> type ) { return getState( type, false ); }
@Override public void update( float tpf ) { super.update(tpf); long time = System.nanoTime(); if( time - lastSample < sampleFrequency ) return; lastSample = time; dispatchMotion(); }
@Override public final void setEnabled( boolean enabled ) { if( this.enabled == enabled ) return; this.enabled = enabled; if( !isInitialized() ) return; if( enabled ) { log.log(Level.FINEST, "onEnable():{0}", this); onEnable(); } else { log.log(Level.FINEST, "onDisable():{0}", this); onDisable(); } }
/** * Do not call directly: Called by the state manager to terminate this * state post-detachment or during state manager termination. * This implementation calls onDisable() if the state is enabled and * then cleanup(app). */ @Override public final void cleanup() { log.log(Level.FINEST, "cleanup():{0}", this); if( isEnabled() ) { log.log(Level.FINEST, "onDisable():{0}", this); onDisable(); } cleanup(app); initialized = false; } }
/** * Do not call directly: Called by the state manager to initialize this * state post-attachment. * This implementation calls initialize(app) and then onEnable() if the * state is enabled. */ @Override public final void initialize( AppStateManager stateManager, Application app ) { log.log(Level.FINEST, "initialize():{0}", this); this.app = app; initialized = true; initialize(app); if( isEnabled() ) { log.log(Level.FINEST, "onEnable():{0}", this); onEnable(); } }
public final <T extends AppState> T getState( Class<T> type ) { return getStateManager().getState(type); }