-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTMXTiledMapEx.h
executable file
·68 lines (49 loc) · 1.69 KB
/
TMXTiledMapEx.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
#pragma once
#include "cocos2d.h"
#include "TMXLayerEx.h"
#include "TMXTilesetInfoEx.h"
USING_NS_CC;
namespace pm
{
class TMXLayerEx;
class TMXLayerInfoEx;
class TMXMapInfoEx : public TMXMapInfo
{
public:
static TMXMapInfoEx * create(const std::string& tmxFile);
/// Layers
const Vector<TMXLayerInfoEx*>& getLayers() const;
Vector<TMXLayerInfoEx*>& getLayers();
void setLayers(const Vector<TMXLayerInfoEx*>& layers);
/// tilesets
const Vector<TMXTilesetInfoEx*>& getTilesets() const;
Vector<TMXTilesetInfoEx*>& getTilesets();
void setTilesets(const Vector<TMXTilesetInfoEx*>& tilesets);
/** initializes a TMX format with a tmx file */
bool initWithTMXFileEx(const std::string& tmxFile);
private:
void startElement(void* /*ctx*/, const char *name, const char **atts) override;
void endElement(void *ctx, const char *name) override;
protected:
/// Layers
Vector<TMXLayerInfoEx*> _layers;
/// tilesets
Vector<TMXTilesetInfoEx*> _tilesets;
};
class TMXTiledMapEx : public TMXTiledMap
{
public:
static TMXTiledMapEx* create(const std::string& tmxFile);
TMXTiledMapEx();
~TMXTiledMapEx();
bool initWithTMXFileEx(const std::string& tmxFile);
//void runTileAnimations();
void onEnter() override;
void update(float dt) override;
//Vector<Sprite*> animation_tiles_;
protected:
TMXTilesetInfoEx * tilesetForLayer(TMXLayerInfoEx *layerInfo, TMXMapInfoEx *mapInfo);
TMXLayerEx * parseLayer(TMXLayerInfoEx *layerInfo, TMXMapInfoEx *mapInfo);
void buildWithMapInfoEx(TMXMapInfoEx* mapInfo);
};
}