edu.trinity.cs.gamecore
Class EditorSetup

java.lang.Object
  extended by edu.trinity.cs.gamecore.EditorSetup
All Implemented Interfaces:
GameSetup

public class EditorSetup
extends java.lang.Object
implements GameSetup

This is the implementation of GameSetup that is used by the screen editor.

Author:
Mark Lewis

Constructor Summary
EditorSetup(Player pl)
           
 
Method Summary
 Player getLocalPlayer()
          Returns the instance of your Player subclass that should be used in this game.
 javax.swing.JMenuBar getMenuBar()
          This function returns a JMenuBar object that will be added to the main display window.
 PriorityQueue 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.
 void setMainFrame(MainFrame 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
 

Constructor Detail

EditorSetup

public EditorSetup(Player pl)
Method Detail

setMainFrame

public void setMainFrame(MainFrame mf)
Description copied from interface: GameSetup
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
Parameters:
mf - The MainFrame object the game is being played in.

getLocalPlayer

public Player getLocalPlayer()
Description copied from interface: GameSetup
Returns the instance of your Player subclass that should be used in this game. Your implementation can return a more specific type. This is highly recommended as it will prevent you from having to do so much casting of the player type.

Specified by:
getLocalPlayer in interface GameSetup

getPriorityQueue

public PriorityQueue getPriorityQueue()
Description copied from interface: GameSetup
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

getScrollingX

public int getScrollingX()
Description copied from interface: GameSetup
Tells the display class is this game has a scrolling background in the X direction. If this returns a value less than 1, then no scrolling will occur side-to-side. If it returns a positive value, then that many blocks will be displayed horizontally.

Specified by:
getScrollingX in interface GameSetup
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()
Description copied from interface: GameSetup
Tells the display class is this game has a scrolling background in the Y direction. If this returns a value less than 1, then no scrolling will occur top-to-bottom. If it returns a positive value, then that many blocks will be displayed vertically.

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

useDrawOptimization

public boolean useDrawOptimization()
Description copied from interface: GameSetup
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
Returns:
Whether or not the framework should double-buffer the blocks as a background image.

getMenuBar

public javax.swing.JMenuBar getMenuBar()
Description copied from interface: GameSetup
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

stopGame

public void stopGame()
Description copied from interface: GameSetup
This function will automatically be called when the player begins to return something other than GAME_RUNNING.

Specified by:
stopGame in interface GameSetup