TheAtlasEngine
 
Loading...
Searching...
No Matches
world.hpp
1#pragma once
2#include <map>
3#include <string>
4#include <core/core.hpp>
5#include <flecs.h>
6#include <core/scene/scene.hpp>
7
8namespace atlas {
9
27 class world {
28 public:
29 world() = delete;
30
35 world(const std::string& p_name);
36
37 virtual ~world() = default;
38
40 [[nodiscard]] std::string name() const { return m_name; }
41
49 void add_scene(const ref<scene>& p_scene_context);
50
59 ref<scene> get_scene(const std::string& p_tag) {
60 if (!m_scene_container.contains(p_tag)) {
61 throw std::runtime_error(
62 "Could not access ref<scene> from "
63 "world::get_scene(const string& p_tag)!!!");
64 }
65 return m_scene_container[p_tag];
66 }
67
68 private:
69 std::map<std::string, ref<scene>> m_scene_container;
70 ref<world> m_world_shared_instance;
71 std::string m_name = "Undefined Tag";
72 };
73}; // namespace atlas
world represents a larger scope of areas that manages the scene contexts
Definition world.hpp:27
std::string name() const
Definition world.hpp:40
void add_scene(const ref< scene > &p_scene_context)
Creating a scene, then we add that scene onto this world.
ref< scene > get_scene(const std::string &p_tag)
get_scene allows for specifically querying for current scenes
Definition world.hpp:59
world(const std::string &p_name)
construct a new world with a specified name associated with it