forked from FranciscoBiaso/TileMapEditorRealmz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMapResources.h
79 lines (63 loc) · 1.85 KB
/
MapResources.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#pragma once
#include <map>
#include <string>
#include <fstream>
#include <json/json.h>
#include <iostream>
#include "Thing.h"
#include "ImgPack.h"
namespace data {
/*!
MAP EDITOR RESOURCES
====================
This class contains the resources that will be used by the software.
*/
class MapResources{
private:
std::map<std::string, std::map<std::string, data::Thing>> stuffBook; // dicionary of dicionary (things) //
Json::Value thingTypesJson; // used to manipulate json files //
ImgPack imgPack;
std::map<std::string, int> layerOrder; // dicionary of layers loading json //
/**
* @brief This method fills stuffBook data loading from json file.
*/
void createStuffBookFromJson();
public:
/**
* constructor
*/
MapResources();
/**
* @brief This method adds a Thing object to the stuffBook.
* @param Thing Object to be added.
*/
void addThing(data::Thing thingObj);
/**
* @brief This method deletes a Thing object from the stuffBook.
* @param thingName object to be deleted.
* @param thingType class of this object.
*/
void delThing(std::string thingName, std::string thingType);
/**
* @brief This method deletes a Thing object from the stuffBook.
* @param thingName object to be deleted.
*/
void delThing(std::string thingName);
/**
* @brief This method gets the stuffBook.
*/
std::map<std::string, std::map<std::string, data::Thing>>& getStuffBook() { return stuffBook; }
/**
* @brief This method gets the a json object.
*/
const Json::Value getThingTypesJson() { return thingTypesJson; }
ImgPack& getImgPack() { return imgPack; }
/**
* @brief This method gets layer as integer.
*/
int getLayerAsInt(const std::string name);
void saveStuffBook();
void loadStuffBookFromJson();
int getItemFromStuffBook(std::string itemName, data::Thing &);
};
}