|
| | Scene (const std::string &name) |
| | ~Scene () override=default |
| void | Begin () override |
| | Activates every owned object; runs once per Load().
|
| void | FixedUpdate (float fixedDeltaTime) override |
| | Advances all active, root-level objects on the fixed timestep.
|
| bool | Initialize () override |
| | Runs once before the scene's first Begin()/Update().
|
| bool | IsFixedUpdateEnabled () const |
| void | LateUpdate (float deltaTime) override |
| | Advances all active, root-level objects after the main Update pass.
|
| void | OnActivate () override |
| | Override for logic that should run when the scene becomes active.
|
| void | OnDeactivate () override |
| | Override for logic that should run when the scene stops being active.
|
| void | OnLoad () override |
| | Override to load scene-specific assets; called once from Load().
|
| void | OnUnload () override |
| | Override to release scene-specific assets; called from Unload().
|
| void | SetFixedUpdateEnabled (bool enabled) |
| void | Update (float deltaTime) override |
| | Advances all active, root-level objects by deltaTime, then steps lighting and physics.
|
| | SceneBase (const std::string &name) |
| virtual | ~SceneBase () |
| void | Activate () |
| | Marks the scene active, calls OnActivate(), then Begin() once.
|
| virtual void | AddObject (GameObject *object) |
| | Takes ownership of object, registering it with lighting and physics as needed.
|
| void | Deactivate () |
| | Marks the scene inactive and calls OnDeactivate().
|
| void | DestroyObject (GameObject *object) |
| | Queues an object for destruction; actually freed on the next ProcessPendingDestroy().
|
| GameObject * | FindObjectByID (uint64_t id) |
| | Object with a matching unique ID, children included.
|
| GameObject * | FindObjectByName (const std::string &name) |
| | First object with a matching name, children included.
|
| List< GameObject * > | FindObjectsByTag (const std::string &tag) |
| | Collects every object whose tag matches, children included.
|
| Camera * | GetActiveCamera () const |
| LightManager * | GetLightManager () const |
| const std::string & | GetName () const |
| size_t | GetObjectCount () const |
| const List< GameObject * > & | GetObjects () const |
| Physics::PhysicsWorld * | GetPhysicsWorld () const |
| Skybox * | GetSkybox () const |
| SceneState | GetState () const |
| bool | IsActive () const |
| bool | IsLoaded () const |
| void | Load () |
| | Moves Unloaded -> Loading -> Active, calling OnLoad() and Initialize().
|
| void | Pause () |
| | Freezes the scene without tearing it down; leaves it in the Paused state.
|
| virtual void | RemoveObject (GameObject *object) |
| void | Resume () |
| | Reactivates a paused scene without re-running OnActivate().
|
| void | SetActiveCamera (Camera *cam) |
| void | SetSkybox (Skybox *skybox) |
| | Replaces the scene's skybox, deleting the previous one.
|
| void | Unload () |
| | Deactivates if active, calls OnUnload(), and destroys all owned objects.
|
Concrete scene type games subclass. Adds an opt-out switch for the fixed-timestep update on top of SceneBase's lifecycle.
This is the class your levels, menus, and screens derive from. Override the hooks you need and call the base implementation from each one: OnLoad() and OnUnload() for assets, OnActivate() and OnDeactivate() for entering and leaving, Begin() to build the object graph, and Update() / FixedUpdate() / LateUpdate() for per-frame work.
The scene owns every object handed to AddObject(), including lights and cameras, and destroys all of them on unload. It also owns a LightManager and a Physics::PhysicsWorld, reachable through GetLightManager() and GetPhysicsWorld(), and registers added objects with both automatically.
Call SetFixedUpdateEnabled(false) on scenes that do not simulate anything, such as menus, to skip the fixed-timestep pass entirely.
public:
sun->SetIntensity(4.0f);
}
void Update(
float deltaTime)
override {
}
};
static GameObject * CreateCube(Math::Vector3D position)
void SetActiveCamera(Camera *cam)
virtual void AddObject(GameObject *object)
Takes ownership of object, registering it with lighting and physics as needed.
void Begin() override
Activates every owned object; runs once per Load().
Scene(const std::string &name)
void Update(float deltaTime) override
Advances all active, root-level objects by deltaTime, then steps lighting and physics.
Root namespace for everything the engine exposes.
- See also
- SceneBase, GameBase, GameObject, LightManager
Definition at line 56 of file Scene.hpp.