class EE::Scene::SceneManager

Overview

#include <scenemanager.hpp>

class SceneManager {
public:
    // construction

    ~SceneManager();

    // methods

    static bool isActive();
    SceneNode* add(SceneNode* sceneNode);
    bool remove(SceneNode* sceneNode);
    size_t count() const;
    void draw();
    void draw(EE::Window::Window* window);
    void update(const Time& elapsed);
    void update();
    SceneNode* getCurrentSceneNode() const;
    UISceneNode* getUISceneNode();
    UISceneNode* getUISceneNode(EE::Window::Window* window);
    void forEachSceneNode(const std::function<void(SceneNode*)>& callback) const;
    SceneNode* setCurrentSceneNode(SceneNode* sceneNode);
    void destroyScenes(EE::Window::Window* window);
    Time getElapsed() const;
};

Detailed Documentation

Methods

SceneNode* add(SceneNode* sceneNode)

Registers a scene and makes it current if no scene is currently bound.

void draw(EE::Window::Window* window)

Draws only scene nodes associated with window using its graphics context.

SceneNode* getCurrentSceneNode() const

Returns the currently bound scene, or nullptr if none is bound. Scoped contexts temporarily override this persistent binding. Scene binding is restricted to the application thread.

UISceneNode* getUISceneNode()

Returns the current scene if it is a UI scene, otherwise nullptr.

UISceneNode* getUISceneNode(EE::Window::Window* window)

Returns the UI scene associated with window, or nullptr if none is registered.

void forEachSceneNode(const std::function<void(SceneNode*)>& callback) const

Enumerates registered top-level scenes on the UI thread.

SceneNode* setCurrentSceneNode(SceneNode* sceneNode)

Sets the persistent scene binding and returns the previous scene. Does not switch native windows; use SceneNode::makeCurrent() for scoped scene and graphics-context binding.

void destroyScenes(EE::Window::Window* window)

Removes and destroys all registered scene nodes associated with window.