legacy
Class Legacy

java.lang.Object
  extended by legacy.Legacy
Direct Known Subclasses:
DesignGuide

public abstract class Legacy
extends java.lang.Object

Legacy.class is the base class and drive any application extending it. This class is abstract and requires you to overide the following methods Also enusre super(args) is called from you constructor.

public abstract void render(VideoAdapter v);
public abstract boolean updateGame(long gameTime);
public abstract Configuration getConfiguration();
Effort has been taken to ensure this class is far from bulky and internally well protected.
Recommend reading the java doc for this class.

Author:
Benjamin Tarrant
See Also:
main(java.lang.String[])

Field Summary
static java.lang.String applicationName
          applicationName refers to the name of this project.
protected static boolean isRunning
          Internal reference flage for execution.
 
Constructor Summary
Legacy(java.lang.String[] args)
          Legacy(String[] args) is the primary constructor and must always be called with super(args) in any extended constructor.
 
Method Summary
abstract  Configuration getConfiguration(java.lang.String[] args)
          getConfiguration() is called once and is used to set the enviroment for the game values are read once only and will any changes will not be recoginized internaly.
 java.lang.Object getConstructionLock()
          getConstructionLock() is used to prevent race conditions.
static void main(java.lang.String[] args)
          Application entry point.
abstract  void render(VideoAdapter v)
          render(Video v) is called when needed as defined by the Conifiguration suppled by the abstract method Configuration getConfiguration().
abstract  boolean updateGame(long gameTime)
          updateGame(long gameTime) is called to allow the came to update its state this method is called independantly of render(Video v) as Renditions are usually operating on a framerate and are only updated as needed, where updates can occour more frequently to allow for extra operation to occour.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

applicationName

public static final java.lang.String applicationName
applicationName refers to the name of this project.

See Also:
Constant Field Values

isRunning

protected static boolean isRunning
Internal reference flage for execution. will be true by default or false on request or forced termination

Constructor Detail

Legacy

public Legacy(java.lang.String[] args)
Legacy(String[] args) is the primary constructor and must always be called with super(args) in any extended constructor. This constructor prepairs all variables and configuration and executes the kernel.

Coding practices Constructor invokes Thread.start()
Legacy can only be constructed by extending this class and as no other constructors are defined a call to super(args) is forced unless an innerclass is created as in tests.
Ensure all data is prepaired to prevent concurrent race conditions

Parameters:
args - argument to be parsed on for configurations
Method Detail

render

public abstract void render(VideoAdapter v)
render(Video v) is called when needed as defined by the Conifiguration suppled by the abstract method Configuration getConfiguration(). The need is determined by the recommeded frames per second or framrate defined.

Parameters:
v - Video output class
See Also:
getConfiguration(java.lang.String[]), Configuration

updateGame

public abstract boolean updateGame(long gameTime)
updateGame(long gameTime) is called to allow the came to update its state this method is called independantly of render(Video v) as Renditions are usually operating on a framerate and are only updated as needed, where updates can occour more frequently to allow for extra operation to occour. Recommended use.
 ...
 long totalTime = 0;
 boolean updateMode = GAME;   //GAME = true and OTHER = false
 boolean continue = true;
 ...
 public boolean updateGame(long gameTime) {
      if (updateMode ^= GAME) {
          continue = doGameStuff();
      }else{
          continue = doOtherStuff();
      }
      return continue;
 }
 

Parameters:
gameTime - time in Nano Seconds since last call
Returns:
true to request to be recalled false otherwize

getConfiguration

public abstract Configuration getConfiguration(java.lang.String[] args)
getConfiguration() is called once and is used to set the enviroment for the game values are read once only and will any changes will not be recoginized internaly. Recommended use.
 public Configuration getConfiguration(){
      return new Configuration(){
          ...
      }
 }
 

Parameters:
args - argumens supplied from the commandline
Returns:
Configuration to be used.
See Also:
Configuration

getConstructionLock

public final java.lang.Object getConstructionLock()
getConstructionLock() is used to prevent race conditions.
Warning no method other than the constructor may call this class. The correct and only possible usage is as follows.
 class myGame extends legacy{
      public myGame(String[] args){
          synchronized(getConstructionLock()){    //load resources here that are required before any other overridden method call
              ...
          }
      }
 

Returns:
construction lock object

main

public static void main(java.lang.String[] args)
Application entry point. This methods main method acts as a test bed for the Hêbê system and creates a Annonomys Legacy class. All extenstion of Legacy should include their own main method.

Parameters:
args - argments to be handled by Legacy(String[] args)