com.brackeen.javagamebook.test
Class GameCore

java.lang.Object
  extended bycom.brackeen.javagamebook.test.GameCore
Direct Known Subclasses:
GameCore3D

public abstract class GameCore
extends java.lang.Object

Simple abstract class used for testing. Subclasses should implement the draw() method.


Constructor Summary
GameCore()
           
 
Method Summary
abstract  void draw(java.awt.Graphics2D g)
          Draws to the screen.
 void gameLoop()
          Runs through the game loop until stop() is called.
 void init()
          Sets full screen mode and initiates and objects.
 void init(java.awt.DisplayMode[] possibleModes)
          Sets full screen mode and initiates and objects.
 void lazilyExit()
          Exits the VM from a daemon thread.
 java.awt.Image loadImage(java.lang.String fileName)
           
 void run()
          Calls init() and gameLoop()
 void stop()
          Signals the game loop that it's time to quit
 void update(long elapsedTime)
          Updates the state of the game/animation based on the amount of elapsed time that has passed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameCore

public GameCore()
Method Detail

stop

public void stop()
Signals the game loop that it's time to quit


run

public void run()
Calls init() and gameLoop()


lazilyExit

public void lazilyExit()
Exits the VM from a daemon thread. The daemon thread waits 2 seconds then calls System.exit(0). Since the VM should exit when only daemon threads are running, this makes sure System.exit(0) is only called if neccesary. It's neccesary if the Java Sound system is running.


init

public void init()
Sets full screen mode and initiates and objects.


init

public void init(java.awt.DisplayMode[] possibleModes)
Sets full screen mode and initiates and objects.


loadImage

public java.awt.Image loadImage(java.lang.String fileName)

gameLoop

public void gameLoop()
Runs through the game loop until stop() is called.


update

public void update(long elapsedTime)
Updates the state of the game/animation based on the amount of elapsed time that has passed.


draw

public abstract void draw(java.awt.Graphics2D g)
Draws to the screen. Subclasses must override this method.