ui
Class GameThread
java.lang.Object
java.lang.Thread
ui.GameThread
- All Implemented Interfaces:
- Runnable, EventListener, StopwatchListener
public class GameThread
- extends Thread
- implements StopwatchListener
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 |
GameThread
public GameThread(GraphicUI gui)
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