public class ConvexMerger
extends java.lang.Object
implements java.awt.KeyEventDispatcher
Modifier and Type | Class and Description |
---|---|
private class |
ConvexMerger.GameThread
Thread responsible for managing the game turns,
generating the playfield and executing AI moves.
|
Modifier and Type | Field and Description |
---|---|
private javax.swing.JFrame |
frame
Application main frame.
|
private ConvexMerger.GameThread |
gameThread
The thread running the active game (if any).
|
private java.awt.Point |
lastLocation
Window location before switching to full screen.
|
private java.awt.Dimension |
lastSize
Window size before switching to full screen.
|
private NewGameMenu |
newGame
Cached new game menu to persist settings.
|
private ScreenRenderer |
renderer
The renderer rending the active game screen.
|
Constructor and Description |
---|
ConvexMerger() |
Modifier and Type | Method and Description |
---|---|
void |
abortGame()
Aborts the active game, if any.
|
boolean |
dispatchKeyEvent(java.awt.event.KeyEvent e) |
void |
exit()
Exits this game context, possibly exiting
the application as a whole.
|
void |
initialiseGame(GameConstructor ctor)
Initialises a new game with the given game constructor.
|
void |
showGame()
Shows the main game window.
|
void |
showNewGame()
Shows the new game menu.
|
Screen |
switchScene(Screen next)
Switches the scene being displayed to the user
to the given screen.
|
private javax.swing.JFrame frame
private java.awt.Dimension lastSize
private java.awt.Point lastLocation
private ScreenRenderer renderer
private ConvexMerger.GameThread gameThread
private NewGameMenu newGame
public void showGame()
public void exit()
public void showNewGame()
public void initialiseGame(GameConstructor ctor)
ctor
- The constructor to build the game.public Screen switchScene(Screen next)
next
- The new screen to display.public void abortGame()
public boolean dispatchKeyEvent(java.awt.event.KeyEvent e)
dispatchKeyEvent
in interface java.awt.KeyEventDispatcher