From 128e7975eb6417438fcf6f51224b6067554a2004 Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Fri, 13 Dec 2024 18:43:12 +0100 Subject: added feedback --- src/crepe/api/Scene.cpp | 5 +++++ src/crepe/api/Scene.h | 38 +++++++++++++++----------------------- src/crepe/api/Scene.hpp | 11 ++++++++--- 3 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 src/crepe/api/Scene.cpp (limited to 'src/crepe/api') diff --git a/src/crepe/api/Scene.cpp b/src/crepe/api/Scene.cpp new file mode 100644 index 0000000..5117766 --- /dev/null +++ b/src/crepe/api/Scene.cpp @@ -0,0 +1,5 @@ +#include "Scene.h" + +using namespace crepe; + +SaveManager & Scene::get_save_manager() const { return mediator->save_manager; } diff --git a/src/crepe/api/Scene.h b/src/crepe/api/Scene.h index 1203612..cba4e10 100644 --- a/src/crepe/api/Scene.h +++ b/src/crepe/api/Scene.h @@ -6,6 +6,7 @@ #include "../manager/Mediator.h" #include "../manager/ResourceManager.h" #include "../util/OptionalRef.h" +#include "../util/Log.h" #include "GameObject.h" @@ -65,20 +66,10 @@ protected: * * \returns A reference to the SaveManager instance held by the Mediator. */ - SaveManager & get_save_manager() const { return mediator->save_manager; } + SaveManager & get_save_manager() const; /** - * \brief Create a new game object using the component manager - * - * \param name Metadata::name (required) - * \param tag Metadata::tag (optional, empty by default) - * \param position Transform::position (optional, origin by default) - * \param rotation Transform::rotation (optional, 0 by default) - * \param scale Transform::scale (optional, 1 by default) - * - * \returns GameObject interface - * - * \note This method automatically assigns a new entity ID + * \copydoc ComponentManager::new_object */ GameObject new_object(const std::string & name, const std::string & tag = "", const vec2 & position = {0, 0}, double rotation = 0, @@ -88,23 +79,24 @@ protected: } /** - * \brief Mark a resource as persistent (i.e. used across multiple scenes) - * - * \param asset Asset the concrete resource is instantiated from - * \param persistent Whether this resource is persistent (true=keep, false=destroy) + * \copydoc ResourceManager::set_persistent */ void set_persistent(const Asset & asset, bool persistent) { mediator->resource_manager->set_persistent(asset, persistent); } /** - * \brief Log a message using Log::logf - * - * \tparam Args Log::logf parameters - * \param args Log::logf parameters - */ - template - void logf(Args &&... args); + * \name Logging functions + * \see Log + * \{ + */ + //! \copydoc Log::logf + template + void logf(const Log::Level & level, std::format_string fmt, Args &&... args); + //! \copydoc Log::logf + template + void logf(std::format_string fmt, Args &&... args); + //! \} }; } // namespace crepe diff --git a/src/crepe/api/Scene.hpp b/src/crepe/api/Scene.hpp index ecb21ed..14635df 100644 --- a/src/crepe/api/Scene.hpp +++ b/src/crepe/api/Scene.hpp @@ -6,9 +6,14 @@ namespace crepe { -template -void Scene::logf(Args &&... args) { - Log::logf(std::forward(args)...); +template +void Scene::logf(const Log::Level & level, std::format_string fmt, Args &&... args) { + Log::logf(level, fmt, std::forward(args)...); +} + +template +void Scene::logf(std::format_string fmt, Args &&... args) { + Log::logf(fmt, std::forward(args)...); } } // namespace crepe -- cgit v1.2.3