org.hermit.android.instruments
Class Instrument

java.lang.Object
  extended by org.hermit.android.instruments.Instrument
Direct Known Subclasses:
AudioAnalyser

public class Instrument
extends java.lang.Object

An instrument which measures some quantity, or accesses or produces some data, which can be displayed on one or more Gauge objects.


Constructor Summary
Instrument(SurfaceRunner parent)
          Set up this view.
 
Method Summary
 void appStart()
          The application is starting.
 void appStop()
          The application is closing down.
protected  void doUpdate(long now)
          Update the state of the instrument for the current frame.
protected  SurfaceRunner getSurface()
          Get the app context of this Element.
 void measureStart()
          We are starting the main run; start measurements.
 void measureStop()
          We are stopping / pausing the run; stop measurements.
protected  void restoreState(Bundle icicle)
          Restore the game state from the given Bundle.
protected  void saveState(Bundle icicle)
          Save the state of the game in the provided Bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Instrument

public Instrument(SurfaceRunner parent)
Set up this view.

Parameters:
parent - Parent surface.
Method Detail

appStart

public void appStart()
The application is starting. Perform any initial set-up prior to starting the application.


measureStart

public void measureStart()
We are starting the main run; start measurements.


measureStop

public void measureStop()
We are stopping / pausing the run; stop measurements.


appStop

public void appStop()
The application is closing down. Clean up any resources.


doUpdate

protected void doUpdate(long now)
Update the state of the instrument for the current frame.

Instruments may override this, and can use it to read the current input state. This method is invoked in the main animation loop -- i.e. frequently.

Parameters:
now - Nominal time of the current frame in ms.

getSurface

protected SurfaceRunner getSurface()
Get the app context of this Element.

Returns:
The app context we're running in.

saveState

protected void saveState(Bundle icicle)
Save the state of the game in the provided Bundle.

Parameters:
icicle - The Bundle in which we should save our state.

restoreState

protected void restoreState(Bundle icicle)
Restore the game state from the given Bundle.

Parameters:
icicle - The Bundle containing the saved state.