29#include <utility/logging/loggable.hpp>
30#include <utility/logging/default_logger.hpp>
32#include <utility/ressource_provider.hpp>
34#include <utility/graphic/view.hpp>
36#include "guillaume/ecs/component_registry.hpp"
37#include "guillaume/ecs/entity_registry.hpp"
38#include "guillaume/ecs/entity_builder_manager_filler.hpp"
39#include "guillaume/ecs/entity_registry_container.hpp"
41#include "guillaume/local_storage.hpp"
42#include "guillaume/session_storage.hpp"
115 public utility::logging::Loggable<Scene,
116 utility::logging::DefaultLogger>
161 Scene(std::shared_ptr<utility::RessourceProvider> ressourceProvider,
261 std::shared_ptr<ecs::Entity> entity);
271 template<ecs::InheritFromEntity EntityType>
275 std::shared_ptr<utility::RessourceProvider>
283 std::unique_ptr<ecs::EntityBuilderManager>
284 _entityBuilderManager;
285 std::type_index _nextSceneType;
287 std::map<std::string, std::shared_ptr<ecs::Entity>>
295 template<
typename Type>
305 template<
typename... Types>
inline constexpr bool areDistinct =
true;
313 template<
typename First,
typename... Rest>
315 (!std::is_same_v<First, Rest> && ...) &&
areDistinct<Rest...>;
324 template<
typename... Types>
330#include "guillaume/scene.tpp"
Key-value storage kept in a file: the place for data that must be found again at the next start (pref...
ecs::ComponentRegistry & getComponentRegistry(void)
Get the registry holding the components of every entity of this scene.
std::shared_ptr< EntityType > getRootEntity(const std::string &name)
Find an entity by the name given to addRootEntity().
bool wantsToSwitch(void) const noexcept
Tell whether goToScene() was called and the switch has not happened yet.
virtual void onExit(void)
Called each time the scene stops being the active one, before onEnter() of the next scene.
std::type_index getNextSceneType(void) const noexcept
Get the scene type asked for by goToScene().
ecs::EntityBuilderManager & getBuilderManager(void)
Get the builders of this scene, one per widget of the library.
void placeEntitiesInFrontOfView(const utility::graphic::ViewF &view)
Line up the scene's entities in front of a view.
void goToScene(void)
Ask to leave this scene for another one.
ecs::EntityRegistry & getEntityRegistry(void)
Get the scene as the registry that owns its entities.
std::shared_ptr< utility::RessourceProvider > getRessourceProvider(void)
Get the resource provider given to the constructor.
virtual ~Scene(void)
Destroy the scene with its entities and components.
void clearNextScene(void) noexcept
Forget the pending switch request, if any.
Scene(std::shared_ptr< utility::RessourceProvider > ressourceProvider, LocalStorage &localStorage, SessionStorage &sessionStorage)
Create an empty scene with its registries and its builders.
void addRootEntity(const std::string &name, std::shared_ptr< ecs::Entity > entity)
Give an entity a name, to find it again with getRootEntity().
virtual void onEnter(void)
Called each time the scene becomes the active one: at start-up for the default scene,...
Key-value storage that lasts as long as the process: the place for data shared between scenes that ne...
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
Holds one builder per builder type and hands them out by type.
An EntityRegistry that is not itself an entity: the top of an ownership tree.
Owns entities and gives the systems the list of entities to visit.
Constrains a parameter pack to types that are all different.
Constrains a template parameter to a type derived from Scene.
A C++20 UI framework for desktop and XR, built as an entity-component-system.
constexpr bool areDistinct
True when no type appears twice in a parameter pack.