diff options
Diffstat (limited to 'src/crepe/api/Scene.h')
-rw-r--r-- | src/crepe/api/Scene.h | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/src/crepe/api/Scene.h b/src/crepe/api/Scene.h index f6fdb2a..b50a0fc 100644 --- a/src/crepe/api/Scene.h +++ b/src/crepe/api/Scene.h @@ -2,16 +2,23 @@ #include <string> +#include "../manager/ComponentManager.h" +#include "../manager/Mediator.h" +#include "../manager/ResourceManager.h" +#include "../util/Log.h" #include "../util/OptionalRef.h" +#include "GameObject.h" + namespace crepe { class SceneManager; class ComponentManager; +class Asset; /** * \brief Represents a Scene - * + * * This class represents a Scene. The Scene class is only used as an interface for the game * programmer. */ @@ -34,10 +41,13 @@ public: */ virtual std::string get_name() const = 0; -protected: + // TODO: Late references should ALWAYS be private! This is currently kept as-is so unit tests + // keep passing, but this reference should not be directly accessible by the user!!! + +private: /** * \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 @@ -46,9 +56,40 @@ protected: * * \{ */ - //! Reference to the ComponentManager - OptionalRef<ComponentManager> component_manager; + //! Mediator reference + OptionalRef<Mediator> mediator; + //! \} + +public: + /** + * \brief Retrieve the reference to the SaveManager instance + * + * \returns A reference to the SaveManager instance held by the Mediator. + */ + SaveManager & get_save_manager() const; + + //! \copydoc ComponentManager::new_object + GameObject new_object( + const std::string & name, const std::string & tag = "", const vec2 & position = {0, 0}, + double rotation = 0, double scale = 1 + ); + + //! \copydoc ResourceManager::set_persistent + void set_persistent(const Asset & asset, bool persistent); + /** + * \name Logging functions + * \see Log + * \{ + */ + //! \copydoc Log::logf + template <class... Args> + void logf(const Log::Level & level, std::format_string<Args...> fmt, Args &&... args); + //! \copydoc Log::logf + template <class... Args> + void logf(std::format_string<Args...> fmt, Args &&... args); //! \} }; } // namespace crepe + +#include "Scene.hpp" |