From ddadc9bdbc35fccf365c4fb4969b666c3d8a16c8 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sun, 28 Apr 2024 15:10:48 +0200 Subject: [PATCH] settle on content store for now --- src/content/content.hpp | 16 +++++++++++++--- src/main_screen.cpp | 2 ++ src/main_screen.hpp | 4 ++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/content/content.hpp b/src/content/content.hpp index 2c371cf..ed59887 100644 --- a/src/content/content.hpp +++ b/src/content/content.hpp @@ -9,11 +9,21 @@ #include -enum class Content1 : uint32_t {}; -using ContentRegistry = entt::basic_registry; +enum class Content : uint32_t {}; +using ContentRegistry = entt::basic_registry; using ContentHandle = entt::basic_handle; -namespace Content::Components { +struct ContentStore { + static constexpr const char* version {"1"}; + + ContentRegistry _reg; + + ContentRegistry& registry(void); + ContentHandle objectHandle(const Content e); + +}; + +namespace Content1::Components { // TODO: design it as a tree? diff --git a/src/main_screen.cpp b/src/main_screen.cpp index 285f1a4..14b20d9 100644 --- a/src/main_screen.cpp +++ b/src/main_screen.cpp @@ -71,6 +71,8 @@ MainScreen::MainScreen(SimpleConfigModel&& conf_, SDL_Renderer* renderer_, Theme g_provideInstance("RegistryMessageModel", "host", &rmm); g_provideInstance("MessageSerializerNJ", "host", &msnj); + g_provideInstance("ContentStore", "host", &cs); + g_provideInstance("ToxI", "host", &tc); g_provideInstance("ToxPrivateI", "host", &tpi); g_provideInstance("ToxEventProviderI", "host", &tc); diff --git a/src/main_screen.hpp b/src/main_screen.hpp index 1aa5939..7c76417 100644 --- a/src/main_screen.hpp +++ b/src/main_screen.hpp @@ -12,6 +12,8 @@ #include #include "./tox_private_impl.hpp" +#include "./content/content.hpp" + #include #include #include @@ -58,6 +60,8 @@ struct MainScreen final : public Screen { MessageSerializerNJ msnj; MessageTimeSort mts; + ContentStore cs; + ToxEventLogger tel{std::cout}; ToxClient tc; ToxPrivateImpl tpi;