#include <tb_game_scene.hpp>
Public Member Functions | |
GameScene (void) | |
virtual | ~GameScene (void)=0 |
Public Member Functions inherited from TurtleBrains::Game::EntityManager | |
EntityManager (void) | |
virtual | ~EntityManager (void)=0 |
void | ClearEntities (void) |
void | AddEntity (Entity *entity) |
void | AddEntity (Entity &entity) |
void | RemoveEntity (Entity *entity) |
void | RemoveEntities (const EntityType &byType=Entity::kInvalidType) |
void | EntityTypeChanged (Entity &entity, const EntityTypeContainer &oldTypes) |
EntityList | GetAllEntities (void) |
EntityList | GetEntitiesByType (const EntityType &byType) |
EntityList | GetEntitiesAt (const tbMath::Vector2 &point, const EntityType &byType=Entity::kInvalidType, bool onlyCollidableEntities=false) |
EntityList | GetEntitiesWithin (const tbMath::Vector2 ¢er, const float radius, const EntityType &byType=Entity::kInvalidType, bool onlyCollidableEntities=false) |
EntityList | GetEntitiesWithin (const tbMath::Vector2 ¢er, const float width, const float height, const EntityType &byType=Entity::kInvalidType, bool onlyCollidableEntities=false) |
void | Simulate (void) |
Public Member Functions inherited from TurtleBrains::Graphics::GraphicList | |
GraphicList (void) | |
virtual | ~GraphicList (void) |
void | ClearGraphics (void) |
void | AddGraphic (Graphic *graphic) |
void | AddGraphic (Graphic &graphic) |
void | RemoveGraphic (Graphic *graphic) |
virtual void | SetColor (const tbGraphics::Color &newColor) override |
virtual PixelSpace | GetPixelWidth (void) const |
virtual PixelSpace | GetPixelHeight (void) const |
void | RecalculateWidthAndHeight (void) |
Public Member Functions inherited from TurtleBrains::Graphics::Graphic | |
Graphic (void) | |
Graphic (const Graphic &other) | |
virtual | ~Graphic (void) |
bool | IsActive (void) const |
void | SetActive (const bool isActive) |
void | Update (const float deltaTime) |
bool | IsVisible (void) const |
void | SetVisible (const bool isVisible) |
void | Render (void) const |
const tbMath::Vector2 & | GetPosition (void) const |
void | SetPosition (const float x, const float y) |
void | SetPosition (const tbMath::Vector2 &position) |
const tbMath::Vector2 & | GetOrigin (void) const |
void | SetOrigin (const AnchorLocation &anchor, const tbMath::Vector2 &offset=tbMath::Vector2::Zero()) |
void | SetOrigin (const float originX, const float originY) |
void | SetOrigin (const tbMath::Vector2 &origin) |
float | GetDepth (void) const |
void | SetDepth (const float newDepth) |
const tbMath::Vector2 & | GetScale (void) const |
void | SetScale (const float scale) |
void | SetScale (const tbMath::Vector2 &scale) |
void | SetScale (const float scaleX, const float scaleY) |
float | GetRotation (void) const |
void | SetRotation (const float rotation) |
void | SetScroll (const float scroll) |
void | SetScroll (const float scrollX, const float scrollY) |
bool | IsRelative (void) const |
const Color & | GetColor (void) const |
float | GetWidth (void) const |
float | GetHeight (void) const |
float | GetScaledWidth (void) const |
float | GetScaledHeight (void) const |
bool | UnstableIsPointContained (const tbMath::Vector2 &point) const |
Static Public Member Functions | |
static void | ChangeToScene (GameScene &gameScene) |
static void | PerformFrame (const float deltaTime) |
static void | PerformFrame (GameScene &gameScene, const float deltaTime) |
Protected Member Functions | |
virtual void | OnSimulate (void) |
virtual void | OnUpdate (const float deltaTime) |
virtual void | OnRender (void) const |
virtual void | OnOpen (void) |
virtual void | OnClose (void) |
virtual void | OnRuntimeReload (void) |
Protected Member Functions inherited from TurtleBrains::Graphics::Graphic | |
virtual void | ApplyTransform (void) const |
virtual void | PopTransform (void) const |
Additional Inherited Members | |
Public Types inherited from TurtleBrains::Game::EntityManager | |
typedef std::list< Entity * > | EntityList |
The GameScene object can also be considered a game state, or screen which contains the logic of a small part of the game. Typically many GameScene will build the game, perhaps a TitleScene, OptionsScene, GameplayScene and CreditsScene. The GameScene provides an interface to override the behaviors as desired.
TurtleBrains::Game::GameScene::GameScene | ( | void | ) |
|
pure virtual |
If the active GameScene is the scene being destructed the active scene will be changed to a blank scene, otherwise does nothing as the object is destructed.
|
static |
Changes the active scene to the gameScene provided, immediately at the end of the current frame without any transition or effects. The current active scene, if one exists, will be closed and OnClose() will be invoked before the new gameScene is opened with OnOpen() and set as the active scene.
gameScene | The new scene that will be updated and displayed as the active scene. The scene must remain in scope for the entire duration while it is active. TODO: TurtleBrains: Documentation: Add a sample about creating a SceneManager and provide a template. |
|
protectedvirtual |
This will be called when the scene has ended and is no longer active in any manner, all resources should be cleaned up until the scene is opened again.
|
protectedvirtual |
This will be called just before the scene is actually activated so that any resources can be created or acquired for the scene to display correctly. This OnOpen() should be called to reset the accumulated simulation time just in case there had been some time remaining from a previous activation.
|
protectedvirtual |
This will be called once per frame every frame to display the current frame of the scene.
Reimplemented from TurtleBrains::Graphics::GraphicList.
|
protectedvirtual |
This will be called IF runtime reloading is enabled and the amount time has passed
|
protectedvirtual |
Called zero to N times per frame as simulated time accumulates. This is where game logic should live as OnSimulate() is called at a fixed rate. By default will be called at 100hz, 100 times per second with a fixed time step of 10ms or 0.01f seconds. This rate can be changed with the SetSimulateStepsPerSecond() function.
Reimplemented from TurtleBrains::Game::EntityManager.
|
protectedvirtual |
Called once per frame every frame to check for any Input events or update things that are dependent on the frame / wall timer. Game logic does not generally belong in the Update function as OnSimulate() is the fixed time step for more deterministic gameplay.
deltaTime | The number of seconds that has passed on the wall clock since the last frame called OnUpdate(). This value will be capped, so if the frame-rate is really bad deltaTime could be lower than the actual wall-time. |
Reimplemented from TurtleBrains::Game::EntityManager.
|
static |
If there has been a scene change this will actually call the OnClose() of the current scene and OnOpen() of the pending new scene. It will then continue to perform a single frame for the scene by first calling OnSimulate() zero to N times, then calling OnUpdate and OnRender() exactly once for the active scene.
deltaTime | The amount of time since the last call to PerformFrame(), should already be capped if frame-rate is too low and deltaTime gets too large. |
|
static |
Perform a single frame for the provided gameScene by first calling OnSimulate() zero to N times, then calling OnUpdate and OnRender() exactly once for the provided scene.
gameScene | The gameScene to simulate, update and render for a single frame. |
deltaTime | The amount of time since the last call to PerformFrame(), should already be capped if frame-rate is too low and deltaTime gets too large. |