|
The Game Engine
1
|
This is a stand alone Level that will have varying jobs. More...
#include <Level.h>
Collaboration diagram for Level:Public Member Functions | |
| Level (string name, Condition winCond, Behavior loadBehave=NULL, Behavior updateBehave=NULL, Behavior endBehave=NULL, Behavior pBehave=NULL) | |
| Level constructor. More... | |
| ~Level () | |
| void | drawScene () |
| Draws everything that is set to draw on the screen. More... | |
| void | LoadBG (string name) |
| Loads the Background. More... | |
| virtual void | postEvent (SDL_Event event) |
| Passes along SDL events. More... | |
| void | update () |
| Loop that runs every game frame that calculates movement, placement, etc. More... | |
| void | load () |
| Runs load action. More... | |
| void | unload () |
| Runs load action. More... | |
| void | addObject (WorldObject *o) |
| add a WorldObject to the list of objects More... | |
| void | removeObject (WorldObject *o) |
| remove the WorldObject sp from the list of sprites More... | |
| void | removeAllSprites (string name) |
| remove the WorldObject sp from the list of sprites More... | |
| void | addParticleSystem (ParticleSystem *sp) |
| add a ParticleSystem to the list of sprites More... | |
| void | removeParticleSystem (ParticleSystem *sp) |
| remove the ParticleSystem sp from the list of sprites More... | |
| void | removeAllParticleSystems (string name) |
| remove the ParticleSystem sp from the list of sprites More... | |
| string | getName () |
| returns the current level's name More... | |
| void | setBackground (Background *b) |
| sets the current level's background and deletes the old one More... | |
| Background * | getBackground () |
| gets the current level's name More... | |
| Sprite * | findSprite (string name) |
| gets the first sprite with the given name More... | |
| vector< Sprite * > | findSprites (string name, int count=-1) |
| returns the first count Sprites contained in this level More... | |
| ParticleSystem * | findParticleSystem (string name) |
| gets the first ParticleSystem with the given name More... | |
| vector< ParticleSystem * > | findParticleSystems (string name, int count=-1) |
| returns the first count ParticleSystems contained in this level More... | |
| unsigned int | getNumPlayers () |
| Returns the Player at a given index. More... | |
| unsigned int | getMaxNumPlayers () |
| Returns the Maximum number of players a Level can contain. More... | |
| void | setMaxNumPlayers (unsigned int i) |
| Sets the Maximum number of players a Level can contain. More... | |
| Player * | getPlayer (unsigned int index) |
| Returns the Player at a given index. More... | |
| bool | addPlayer (Player *p) |
| Adds a Player to the game if the number of players in the current level is not exceeded. More... | |
| bool | removePlayer (Player *p) |
| Removes the specified player p. More... | |
| int | removePlayers (int count) |
| Removes the specified player p. More... | |
Public Attributes | |
| bool | Loaded |
| Shows if the level has loaded or not (level changing) More... | |
Protected Member Functions | |
| void | DrawCollisions () |
| Draws all CollisionObject data. More... | |
| void | DrawMenus () |
| Draws all Menu elements on the screen. More... | |
| void | clearData () |
| This will clear the data and make this level as if new. More... | |
Protected Attributes | |
| string | mName |
| Background * | mBackground |
| Pointer to the current Background. More... | |
| vector< WorldObject * > | mWorldObjects |
| Vector of all objects on the level. More... | |
| vector< Sprite * > | mSprites |
| Vector of all Sprites on the level. More... | |
| vector< WorldObject * > | ToAdd |
| List of Sprites that should be added this game loop. More... | |
| vector< WorldObject * > | ToRemove |
| List of Sprites that should die after this game loop. More... | |
| vector< ParticleSystem * > | mParticleSystems |
| Vector of all ParticleSystems on the level. More... | |
| HUD | mHUD |
| Display to draw on everything else. More... | |
| Behavior | mInitialBehavior |
| will be used to define the Load action of the level More... | |
| Behavior | mMainBehavior |
| will be used to define the update action of the level More... | |
| Behavior | mUnloadBehavior |
| will be used to define the end action of the level as it close More... | |
| Condition | mWinCondition |
| Conditions for the level to wait upon before exiting. More... | |
| Behavior | mPauseBehavior |
| Enacts a Pause menu or any set of menus based on what we have. More... | |
| vector< Menu > | mMenus |
| Menus mMenus[0] will always be the pause menu. More... | |
| vector< Player * > | mPlayers |
| All the players active in this Level. More... | |
| unsigned int | mMaxNumPlayers |
| Maximum number of players allowed on this Level. More... | |
This is a stand alone Level that will have varying jobs.
This class is tasked with the following:
| Level::Level | ( | string | name, |
| Condition | winCond, | ||
| Behavior | loadBehave = NULL, |
||
| Behavior | updateBehave = NULL, |
||
| Behavior | endBehave = NULL, |
||
| Behavior | pBehave = NULL |
||
| ) |
Level constructor.
| name | name of the level |
| loadBehave | the Loading Behavior for this level (Run when loading). |
| updateBehave | the Updating Behavior for this level (Run every loop). |
| endBehave | the Unloading Behavior for this level (when leaving level). |
| pBehave | The Paused Behavior (defaultly pauses the updates of the level and runs this) |
| winCond | Function thateturns a boolean telling the level that it shuold unload. |
Set behavior
| void Level::addObject | ( | WorldObject * | o | ) |
add a WorldObject to the list of objects
| o | WorldObject to add |
Definition at line 233 of file Level.cpp.
Here is the caller graph for this function:| void Level::addParticleSystem | ( | ParticleSystem * | sp | ) |
add a ParticleSystem to the list of sprites
| sp | ParticleSystem to add |
| bool Level::addPlayer | ( | Player * | p | ) |
|
protected |
|
protected |
Draws all CollisionObject data.
Definition at line 57 of file Level.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
| void Level::drawScene | ( | ) |
| ParticleSystem * Level::findParticleSystem | ( | string | name | ) |
gets the first ParticleSystem with the given name
| name | Name of the ParticleSystem |
Definition at line 276 of file Level.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| vector< ParticleSystem * > Level::findParticleSystems | ( | string | name, |
| int | count = -1 |
||
| ) |
returns the first count ParticleSystems contained in this level
| name | Name of the ParticleSystems to return |
| count | number to return defaults to all |
Definition at line 285 of file Level.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| Sprite * Level::findSprite | ( | string | name | ) |
| vector< Sprite * > Level::findSprites | ( | string | name, |
| int | count = -1 |
||
| ) |
returns the first count Sprites contained in this level
| name | Name of the sprites to return |
| count | number to return defaults to all |
Definition at line 265 of file Level.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
gets the current level's name
Definition at line 136 of file Level.h.
Here is the caller graph for this function:| unsigned int Level::getMaxNumPlayers | ( | ) |
|
inline |
| unsigned int Level::getNumPlayers | ( | ) |
| Player * Level::getPlayer | ( | unsigned int | index | ) |
| void Level::load | ( | ) |
| void Level::LoadBG | ( | string | name | ) |
Loads the Background.
| name | Name of the background to load |
Definition at line 67 of file Level.cpp.
Here is the call graph for this function:
|
virtual |
| void Level::removeAllParticleSystems | ( | string | name | ) |
remove the ParticleSystem sp from the list of sprites
| name | ParticleSystems to remove |
Definition at line 249 of file Level.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void Level::removeAllSprites | ( | string | name | ) |
remove the WorldObject sp from the list of sprites
| name | WorldObjects to remove |
Definition at line 241 of file Level.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void Level::removeObject | ( | WorldObject * | o | ) |
remove the WorldObject sp from the list of sprites
| o | WorldObject to remove |
Definition at line 237 of file Level.cpp.
Here is the caller graph for this function:| void Level::removeParticleSystem | ( | ParticleSystem * | sp | ) |
remove the ParticleSystem sp from the list of sprites
| sp | ParticleSystem to remove |
| bool Level::removePlayer | ( | Player * | p | ) |
| int Level::removePlayers | ( | int | count | ) |
|
inline |
sets the current level's background and deletes the old one
| b | Background |
Definition at line 127 of file Level.h.
Here is the caller graph for this function:| void Level::setMaxNumPlayers | ( | unsigned int | i | ) |
| void Level::unload | ( | ) |
| void Level::update | ( | ) |
Loop that runs every game frame that calculates movement, placement, etc.
Will handle all movement and dynamic triggers.
as well as obtains key strokes (limited by keyboard hardware)
Definition at line 78 of file Level.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| bool Level::Loaded |
|
protected |
Pointer to the current Background.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |