dEngine
Simple 2D C++ game engine
|
A level of the game. More...
#include <GameLevel.h>
Public Member Functions | |
GameLevel () | |
Creates a new gamelevel. More... | |
virtual | ~GameLevel () |
Cleans up and removes any memory allocated by GameLevel. More... | |
virtual void | Load ()=0 |
Used for loading assets into memory. More... | |
virtual void | UnLoad ()=0 |
Used for removing assets from memory. More... | |
virtual void | Update ()=0 |
Used for performing logic updates. More... | |
virtual void | Render ()=0 |
Used for rendering graphics, text and more. More... | |
virtual void | Start ()=0 |
Called at instantiation. More... | |
virtual void | Pause ()=0 |
Pauses the game. More... | |
virtual void | Resume ()=0 |
Resumes the game. More... | |
virtual std::weak_ptr< GameObject > | AddObject (GameObject *go) |
Adds an object to the level. More... | |
virtual std::weak_ptr< GameObject > | GetObject (std::string gameObjectName) |
Retrieves a pointer to the object from the level. More... | |
virtual std::weak_ptr< GameObject > | GetObjectByComponent (std::string componentName) |
Retrieves an object from the level based on if it has a component or not. More... | |
Protected Member Functions | |
void | StartObjects () |
Calls the start method on any registered objects. More... | |
virtual void | UpdateObjects () |
Calls the Update method on any registered objects. More... | |
virtual void | RenderObjects () |
Calls the Render method on any registered objects. More... | |
Protected Attributes | |
bool | started |
Is true if Start has already ran. More... | |
std::vector< std::shared_ptr< GameObject > > | objects |
std::vector< std::shared_ptr< GameObject > > | newObjects |
A level of the game.
This is the base level for individual game development. A game level could be a title screen, a traditional level for the game or more. This is where all the objects will live and is what will act as an interface between the GameObjects and the Game
GameLevel::GameLevel | ( | ) |
Creates a new gamelevel.
|
virtual |
Cleans up and removes any memory allocated by GameLevel.
|
virtual |
Adds an object to the level.
|
virtual |
Retrieves a pointer to the object from the level.
|
virtual |
Retrieves an object from the level based on if it has a component or not.
|
pure virtual |
Used for loading assets into memory.
Referenced by dengine::Game::Push().
|
pure virtual |
Pauses the game.
|
pure virtual |
Used for rendering graphics, text and more.
|
protectedvirtual |
Calls the Render method on any registered objects.
|
pure virtual |
Resumes the game.
|
pure virtual |
Called at instantiation.
Referenced by dengine::Game::loop().
|
protected |
Calls the start method on any registered objects.
|
pure virtual |
Used for removing assets from memory.
|
pure virtual |
Used for performing logic updates.
|
protectedvirtual |
Calls the Update method on any registered objects.
|
protected |
Referenced by AddObject(), UpdateObjects(), and ~GameLevel().
|
protected |
Referenced by GetObject(), GetObjectByComponent(), RenderObjects(), StartObjects(), UpdateObjects(), and ~GameLevel().
|
protected |