ui
Class GameThread

java.lang.Object
  extended by java.lang.Thread
      extended by ui.GameThread
All Implemented Interfaces:
Runnable, EventListener, StopwatchListener

public class GameThread
extends Thread
implements StopwatchListener


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GameThread(GraphicUI gui)
           
 
Method Summary
 Game getGame()
           
 void requestLoadGame(File file)
          This method is called by the GUI when the user requests to load a game.
 void requestNewGame()
          This method is called by the GUI when the user requests a new game.
 void run()
          Sets up a default game, and then runs the game loop
 void suggestMove(Move m)
          This method is called by the GUI when the user tries to make a move.
 void timeChanged(long millis, Stopwatch s)
          Triggered by Stopwatch events.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameThread

public GameThread(GraphicUI gui)
Method Detail

run

public void run()
Sets up a default game, and then runs the game loop

Specified by:
run in interface Runnable
Overrides:
run in class Thread

getGame

public Game getGame()
Returns:
the Game this thread is running

requestNewGame

public void requestNewGame()
This method is called by the GUI when the user requests a new game.


requestLoadGame

public void requestLoadGame(File file)
This method is called by the GUI when the user requests to load a game.


suggestMove

public void suggestMove(Move m)
This method is called by the GUI when the user tries to make a move.


timeChanged

public void timeChanged(long millis,
                        Stopwatch s)
Triggered by Stopwatch events. Keeps the GameState and GUI updated as far as time left in the game.

Specified by:
timeChanged in interface StopwatchListener