aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Scene.h
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-02 18:55:13 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-02 18:55:13 +0100
commit47e6d987ced269ec16ea455706513025cb9c50c5 (patch)
tree5cb48ad8565f7c5bd8b03624bc716375b8d2321b /src/crepe/api/Scene.h
parentf23eaa64df8b0ef27f58b1632c5e659fe3737153 (diff)
parent647eb8e318f1ed1e3ec18505ea4df57025e6ffd5 (diff)
Merge branch 'master' into niels/rendering_color
Diffstat (limited to 'src/crepe/api/Scene.h')
-rw-r--r--src/crepe/api/Scene.h34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/crepe/api/Scene.h b/src/crepe/api/Scene.h
index 0e516b6..f6fdb2a 100644
--- a/src/crepe/api/Scene.h
+++ b/src/crepe/api/Scene.h
@@ -2,25 +2,53 @@
#include <string>
+#include "../util/OptionalRef.h"
+
namespace crepe {
class SceneManager;
class ComponentManager;
+/**
+ * \brief Represents a Scene
+ *
+ * This class represents a Scene. The Scene class is only used as an interface for the game
+ * programmer.
+ */
class Scene {
protected:
- Scene(ComponentManager & mgr, const std::string & name);
+ // NOTE: This must be the only constructor on Scene, see "Late references" below
+ Scene() = default;
+ //! SceneManager instances Scene
friend class SceneManager;
public:
virtual ~Scene() = default;
public:
+ //! Load the scene
virtual void load_scene() = 0;
- const std::string name;
+ /**
+ * \brief Get the scene's name
+ * \return The scene's name
+ */
+ virtual std::string get_name() const = 0;
protected:
- ComponentManager & component_manager;
+ /**
+ * \name Late references
+ *
+ * These references are set by SceneManager immediately after calling the constructor of Scene.
+ *
+ * \note Scene must have a constructor without arguments so the game programmer doesn't need to
+ * manually add `using Scene::Scene` to their concrete scene class, if they want to add a
+ * constructor with arguments (e.g. for passing references to their own concrete Scene classes).
+ *
+ * \{
+ */
+ //! Reference to the ComponentManager
+ OptionalRef<ComponentManager> component_manager;
+ //! \}
};
} // namespace crepe