galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
World.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_MAP_WORLD_HPP_
9#define GALAXY_MAP_WORLD_HPP_
10
11#include <ankerl/unordered_dense.h>
12#include <LDtkLoader/Project.hpp>
13
14#include "galaxy/map/Map.hpp"
15
16namespace galaxy
17{
18 namespace map
19 {
23 class World final
24 {
25 public:
29 World();
30
36 World(const std::string& file);
37
41 ~World();
42
48 [[nodiscard]]
49 bool load(const std::string& file);
50
54 void parse();
55
59 void clear();
60
66 void set_active(const std::string& map);
67
73 [[nodiscard]]
74 map::Map* get_active() const;
75
81 [[nodiscard]]
82 const std::string& name() const;
83
89 [[nodiscard]]
90 const std::string& file() const;
91
97 [[nodiscard]]
98 bool loaded() const;
99
105 [[nodiscard]]
106 ankerl::unordered_dense::map<std::string, map::Map>& maps();
107
108 private:
112 std::string m_file;
113
117 ldtk::Project m_project;
118
122 ankerl::unordered_dense::map<std::string, map::Map> m_maps;
123
128
133 };
134 } // namespace map
135} // namespace galaxy
136
137#endif
An LDTK level.
Definition Map.hpp:26
An LDTK level.
Definition World.hpp:24
bool load(const std::string &file)
Load a world.
Definition World.cpp:37
ldtk::Project m_project
LDTK project data.
Definition World.hpp:117
const std::string & name() const
Get world name.
Definition World.cpp:102
World()
Constructor.
Definition World.cpp:17
map::Map * m_current
Current map.
Definition World.hpp:127
ankerl::unordered_dense::map< std::string, map::Map > & maps()
Get maps.
Definition World.cpp:117
~World()
Destructor.
Definition World.cpp:33
void set_active(const std::string &map)
Set currently active map.
Definition World.cpp:85
ankerl::unordered_dense::map< std::string, map::Map > m_maps
List of ldtk levels.
Definition World.hpp:122
bool loaded() const
Check if load() was called.
Definition World.cpp:112
std::string m_file
File.
Definition World.hpp:112
map::Map * get_active() const
Get currently active map.
Definition World.cpp:97
void parse()
Parse world and create entities.
Definition World.cpp:63
const std::string & file() const
Get file.
Definition World.cpp:107
bool m_loaded
Loaded flag.
Definition World.hpp:132
void clear()
Clear all map and world data.
Definition World.cpp:77
Timer.hpp galaxy.
Definition Async.hpp:17