|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GameSetup<B extends Block<B,E>,E extends GameEntity<B,E>>
This interface provides methods for the main frame to get the components of the game. When a MainFrame is created, it is passed one of these. Basically, by using different GameSetup instances, the game can take on many different forms with the same "standard" mechanism around it.
Students will be given a basic implementation of this interface as well as the other various interfaces in code format. Implementations of all the other classes will only be distributed in compiled, .jar format. Over the course of the semester, the students will modify the implementation to fit their game and write their own implementations of the basic interfaces to provide the behavior of the game.
The implementation of this class should specify the abstract superclasses students are using for their game as the generic types. It is also recommended that your implementation use the singleton pattern. The code you are provided with does this so that you will have something to follow. Students should also add other public methods to there implementation as needed for their game. Refer to the documentation of the provided BasicGameSetup to see this.
This interface is a generic that takes the general block type and the general entity type for each game.
Method Summary | |
---|---|
Player<B,E> |
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<B,E> |
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<B,E> 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. |
Method Detail |
---|
void setMainFrame(MainFrame<B,E> mf)
mf
- The MainFrame object the game is being played in.Player<B,E> getLocalPlayer()
PriorityQueue<B,E> getPriorityQueue()
int getScrollingX()
int getScrollingY()
boolean useDrawOptimization()
javax.swing.JMenuBar getMenuBar()
void stopGame()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |