Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
AssetManager.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <map>
4 #include <memory>
5 
6 #include "../item/Item.hpp"
7 #include "RehtiReader.hpp"
8 
14 {
15 public:
20  static void loadAssets();
21 
27  static const std::vector<ObjectLocation>& getObjectLocations();
28 
34  static const std::map<int, GameSkill>& getSkills();
35 
41  static const GameObjects& getObjects();
42 
48  static const GameItems& getItems();
49 
55  static const GameCharacters& getGameCharacters();
56 
63  static std::shared_ptr<Item> createItemInstance(int id);
64 
65 private:
66  inline static GameItems itemsM = {};
67  inline static std::map<int, GameSkill> skillsM = {};
68  inline static GameObjects objectsM = {};
69  inline static std::vector<ObjectLocation> objectLocationsM = {};
70  inline static GameCharacters gameCharactersM = {};
71 };
Holds definitions to all the items, objects and skills in the game. This class is used to fetch the d...
Definition: AssetManager.hpp:14
static const GameCharacters & getGameCharacters()
Get the GameCharacters object.
Definition: AssetManager.cpp:80
static std::vector< ObjectLocation > objectLocationsM
Tells where objects instances are located on the map (For example, tree at 1,1, tree at 2,...
Definition: AssetManager.hpp:69
static GameObjects objectsM
Tells what possible objects exists and what attributes they have (For example tree)
Definition: AssetManager.hpp:68
static const GameObjects & getObjects()
Get the GameObjects object.
Definition: AssetManager.cpp:33
static const GameItems & getItems()
Get the GameItems object.
Definition: AssetManager.cpp:38
static std::shared_ptr< Item > createItemInstance(int id)
Creates an instance of an item.
Definition: AssetManager.cpp:43
static void loadAssets()
Loads all the assets into memory.
Definition: AssetManager.cpp:8
static const std::vector< ObjectLocation > & getObjectLocations()
Get the Object Locations object.
Definition: AssetManager.cpp:23
static GameCharacters gameCharactersM
Definition: AssetManager.hpp:70
static std::map< int, GameSkill > skillsM
Definition: AssetManager.hpp:67
static const std::map< int, GameSkill > & getSkills()
Get the Skills object.
Definition: AssetManager.cpp:28
static GameItems itemsM
Definition: AssetManager.hpp:66
Contains all the character data. This is used to load character assets into memory and spawn characte...
Definition: CharacterReader.hpp:62
Contains all the item data in the game. This is used to load item assets into memory and create item ...
Definition: ItemReader.hpp:87
Contains all the objects defined in the objects.json file.
Definition: ObjectReader.hpp:101