From b8132afabb31a1b6397bdab9ff652d22a24de66f 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 2c371cf2..ed598875 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 798d239b..3446f886 100644 --- a/src/main_screen.cpp +++ b/src/main_screen.cpp @@ -65,6 +65,8 @@ MainScreen::MainScreen(SDL_Renderer* renderer_, Theme& theme_, std::string save_ 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 2b7bb763..8f59dc48 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 @@ -53,6 +55,8 @@ struct MainScreen final : public Screen { MessageSerializerNJ msnj; MessageTimeSort mts; + ContentStore cs; + ToxEventLogger tel{std::cout}; ToxClient tc; ToxPrivateImpl tpi;