edu.trinity.cs.gamecore.madison
Class MadisonGameSetup

java.lang.Object
  extended by edu.trinity.cs.gamecore.madison.MadisonGameSetup
All Implemented Interfaces:
GameSetup<MadisonBlock,MadisonEntity>

public class MadisonGameSetup
extends java.lang.Object
implements GameSetup<MadisonBlock,MadisonEntity>


Method Summary
 MadisonPlayer getLocalPlayer()
          Returns the instance of your Player subclass that should be used in this game.
 MainFrame<MadisonBlock,MadisonEntity> getMainFrame()
           
 javax.swing.JMenuBar getMenuBar()
          This function returns a JMenuBar object that will be added to the main display window.
 PriorityQueue<MadisonBlock,MadisonEntity> getPriorityQueue()
          Return the priority queue that you are using for the game.
 int getScrollingX()
          Tells the display class is this game has a scrolling background in the x direction.
 int getScrollingY()
          Tells the display class is this game has a scrolling background in the y direction.
static MadisonGameSetup instance()
          This method returns the singleton of the BasicGameSetup class.
 void setMainFrame(MainFrame<MadisonBlock,MadisonEntity> mf)
          This method is called in the constructor of a main frame so that the GameSetup class will be able to communicate with the frame that the game is being played in.
 void stopGame()
          This function will automatically be called when the player begins to return something other than GAME_RUNNING.
 boolean useDrawOptimization()
          If this returns true, the drawing routine will use an optimization of drawing the images for all the blocks once to a large image and just putting up that image as long as the player hasn't changed screens.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static MadisonGameSetup instance()
This method returns the singleton of the BasicGameSetup class.


setMainFrame

public void setMainFrame(MainFrame<MadisonBlock,MadisonEntity> mf)
This method is called in the constructor of a main frame so that the GameSetup class will be able to communicate with the frame that the game is being played in.

Specified by:
setMainFrame in interface GameSetup<MadisonBlock,MadisonEntity>
Parameters:
mf - The MainFrame object the game is being played in.

getMainFrame

public MainFrame<MadisonBlock,MadisonEntity> getMainFrame()

getLocalPlayer

public MadisonPlayer getLocalPlayer()
Returns the instance of your Player subclass that should be used in this game.

Specified by:
getLocalPlayer in interface GameSetup<MadisonBlock,MadisonEntity>

getPriorityQueue

public PriorityQueue<MadisonBlock,MadisonEntity> getPriorityQueue()
Return the priority queue that you are using for the game. You will write two of these during the semester.

Specified by:
getPriorityQueue in interface GameSetup<MadisonBlock,MadisonEntity>

getScrollingX

public int getScrollingX()
Tells the display class is this game has a scrolling background in the x direction.

Specified by:
getScrollingX in interface GameSetup<MadisonBlock,MadisonEntity>
Returns:
This value tells the program how many squares across it should draw around the player. Return -1 for no scrolling.

getScrollingY

public int getScrollingY()
Tells the display class is this game has a scrolling background in the y direction.

Specified by:
getScrollingY in interface GameSetup<MadisonBlock,MadisonEntity>
Returns:
This value tells the program how many squares vertically it should draw around the player. Return -1 for no scrolling.

useDrawOptimization

public boolean useDrawOptimization()
If this returns true, the drawing routine will use an optimization of drawing the images for all the blocks once to a large image and just putting up that image as long as the player hasn't changed screens. This can be significantly faster. However, if it is true, it means that changes to blocks won't normally be drawn so you can't have animated blocks, or moving blocks, or blocks that disappear (doors). This flag is checked at every step so you could have it return true most of the time, but return false when some event has occured that should require the blocks to be redrawn.

Specified by:
useDrawOptimization in interface GameSetup<MadisonBlock,MadisonEntity>
Returns:
Whether or not the framework should double-buffer the blocks as a background image.

getMenuBar

public javax.swing.JMenuBar getMenuBar()
This function returns a JMenuBar object that will be added to the main display window. All of the functions that you want the menus to be able to doo will need to be connected from here.

Specified by:
getMenuBar in interface GameSetup<MadisonBlock,MadisonEntity>

stopGame

public void stopGame()
This function will automatically be called when the player begins to return something other than GAME_RUNNING.

Specified by:
stopGame in interface GameSetup<MadisonBlock,MadisonEntity>