f8/cpp/tiledmap.h
2018-08-21 03:12:23 -04:00

43 lines
1.0 KiB
C++

#pragma once
class TiledObject
{
public:
a8::XValue GetProperty(const std::string& prop_name);
bool HasProperty(const std::string& prop_name);
public:
std::map<std::string, a8::XValue> prop_hash;
};
class TiledLayer
{
public:
a8::XValue GetProperty(const std::string& prop_name);
bool HasProperty(const std::string& prop_name);
public:
std::map<std::string, a8::XValue> prop_hash;
a8::XValue data;
};
class TiledMap
{
public:
TiledLayer* ground_layer = nullptr;
std::list<TiledLayer> speed_layers;
int tile_count = 0; //瓦片地图的尺寸。(以瓦片数量为单位)
int tile_width = 0; //瓦片的宽。(以像素点为单位)
int tile_height = 0; //瓦片的高。(以像素点为单位)
bool LoadTmxFile(const std::string& filename);
std::list<TiledObject>* GetObjectGroup(const std::string& object_class_name);
void Dump();
private:
std::map<std::string, std::list<TiledLayer>> layer_hash;
std::map<std::string, std::list<TiledObject>> object_group_hash;
};