|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object legacy.Legacy
public abstract class Legacy
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.
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 |
---|
public static final java.lang.String applicationName
protected static boolean isRunning
Constructor Detail |
---|
public Legacy(java.lang.String[] args)
args
- argument to be parsed on for configurationsMethod Detail |
---|
public abstract void render(VideoAdapter v)
v
- Video output classgetConfiguration(java.lang.String[])
,
Configuration
public abstract boolean updateGame(long gameTime)
... 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; }
gameTime
- time in Nano Seconds since last call
public abstract Configuration getConfiguration(java.lang.String[] args)
public Configuration getConfiguration(){ return new Configuration(){ ... } }
args
- argumens supplied from the commandline
Configuration
public final java.lang.Object getConstructionLock()
class myGame extends legacy{ public myGame(String[] args){ synchronized(getConstructionLock()){ //load resources here that are required before any other overridden method call ... } }
public static void main(java.lang.String[] args)
args
- argments to be handled by Legacy(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |