Package ch.epfl.cs107.play.areagame
Class AreaGame
java.lang.Object
ch.epfl.cs107.play.areagame.AreaGame
- All Implemented Interfaces:
Drawable,Game,PauseMenu.Pausable,Playable,Updatable
AreaGames are a concept of Game which is displayed in a (MxN) Grid which is called an Area
An AreaGame has multiple Areas
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidAdd an Area to the AreaGame listbooleanbegin(Window window, FileSystem fileSystem) Initialises game state : display and controls Note: Need to be Overridevoiddraw()voidend()Cleans up things, called even if initialisation failed.protected final AreaGetter for the current areaprotected final FileSystemprotected final WindowbooleanisPaused()voidvoidprotected final AreasetCurrentArea(String key, boolean forceBegin) Setter for the current area: Select an Area in the list from its key - the area is then begin or resume depending if the area is already started or not and if it is forcedprotected final PauseMenusetPauseMenu(PauseMenu menu) Set the pause menuvoidupdate(float deltaTime) Simulates a single time step.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ch.epfl.cs107.play.engine.Game
getFrameRate
-
Constructor Details
-
AreaGame
public AreaGame()
-
-
Method Details
-
addArea
Add an Area to the AreaGame list- Parameters:
a- (Area): The area to add, not null
-
setCurrentArea
Setter for the current area: Select an Area in the list from its key - the area is then begin or resume depending if the area is already started or not and if it is forced- Parameters:
key- (String): Key of the Area to select, not nullforceBegin- (boolean): force the key area to call begin even if it was already started- Returns:
- (Area): after setting it, return the new current area
-
setPauseMenu
Set the pause menu- Parameters:
menu- (PauseMenu) : the new pause menu, not null- Returns:
- (PauseMenu): the new pause menu, not null
-
getWindow
- Returns:
- (Window) : the Graphic and Audio context
-
getFileSystem
- Returns:
- (FIleSystem): the linked file system
-
getCurrentArea
Getter for the current area- Returns:
- (Area)
-
begin
Description copied from interface:PlayableInitialises game state : display and controls Note: Need to be Override -
update
public void update(float deltaTime) Description copied from interface:UpdatableSimulates a single time step. Note: Need to be Override -
draw
public void draw() -
end
public void end()Description copied from interface:PlayableCleans up things, called even if initialisation failed. Note: Need to be Override -
requestPause
public void requestPause()- Specified by:
requestPausein interfacePauseMenu.Pausable
-
requestResume
public void requestResume()- Specified by:
requestResumein interfacePauseMenu.Pausable
-
isPaused
public boolean isPaused()- Specified by:
isPausedin interfacePauseMenu.Pausable
-