25 std::shared_ptr<Scene>
World::add(
const std::string& name)
31 m_scenes[hash] = std::make_shared<Scene>(name);
41 std::shared_ptr<Scene>
World::get(
const std::string& name)
noexcept
45 if (m_scenes.contains(hash))
47 return m_scenes[hash];
65 return m_scenes.contains(hash);
70 if (
auto scene = get(name))
72 m_scene_stack.push_back(scene);
73 m_scene_stack.back()->load();
#define GALAXY_LOG(level, msg,...)
void remove(const std::string &name)
Remove a specific scene.
void clear()
Removes all data.
~World() noexcept
Destructor.
std::shared_ptr< Scene > add(const std::string &name)
Add a new scene.
SceneMap & get_scenes() noexcept
Get Scene storage.
SceneMap m_scenes
Scene storage.
SceneStack & get_scene_stack() noexcept
Get Scene stack.
bool has(const std::string &name) noexcept
Does a scene exist.
void pop_all() noexcept
Remove all scenes in stack.
World() noexcept
Constructor.
void update()
Process events and updates.
void render()
Render scenes.
std::shared_ptr< Scene > top() const noexcept
Get top scene in stack.
void pop() noexcept
Remove scene on top of stack.
std::vector< std::shared_ptr< Scene > > SceneStack
void push(const std::string &name) noexcept
Push a scene onto the top of stack.
std::shared_ptr< Scene > get(const std::string &name) noexcept
Get a specific scene.
Registry m_registry
Entity data.
ankerl::unordered_dense::map< std::uint64_t, std::shared_ptr< Scene > > SceneMap
SceneStack m_scene_stack
Active scenes.
constexpr bits fnv1a(const char *const str, const bits value=fnv_1a_params< bits >::offset) noexcept
Convert string to hash.