forked from mapeditor/tiled
/
replicaislandplugin.h
89 lines (72 loc) · 2.65 KB
/
replicaislandplugin.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
79
80
81
82
83
84
85
86
87
88
89
/*
* Replica Island Tiled Plugin
* Copyright 2011, Eric Kidd <eric@kiddsoftware.com>
* Copyright 2011, seeseekey <seeseekey@googlemail.com>
*
* This file is part of Tiled.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef REPLICAISLANDPLUGIN_H
#define REPLICAISLANDPLUGIN_H
#include "replicaisland_global.h"
#include "map.h"
#include "mapwriterinterface.h"
#include "mapreaderinterface.h"
#include <QObject>
namespace Tiled {
class TileLayer;
};
namespace ReplicaIsland {
/**
* Read and write maps in Replica Island format. Replica Island is an
* open source side-scrolling video game for Android.
*/
class REPLICAISLANDSHARED_EXPORT ReplicaIslandPlugin :
public QObject,
public Tiled::MapWriterInterface,
public Tiled::MapReaderInterface
{
Q_OBJECT
Q_INTERFACES(Tiled::MapReaderInterface)
Q_INTERFACES(Tiled::MapWriterInterface)
public:
/**
* Create an instance of the plugin.
*/
ReplicaIslandPlugin();
// MapReaderInterface
Tiled::Map *read(const QString &fileName);
QString nameFilter() const;
bool supportsFile(const QString &fileName) const;
QString errorString() const;
// MapWriterInterface
bool write(const Tiled::Map *map, const QString &fileName);
private:
QString mError;
// MapReaderInterface support.
void loadTilesetsFromResources(Tiled::Map *map,
QList<Tiled::Tileset *> &typeTilesets,
QList<Tiled::Tileset *> &tileIndexTilesets);
Tiled::Tileset *loadTilesetFromResource(const QString &name);
void addTilesetsToMap(Tiled::Map *map, QList<Tiled::Tileset *> tilesets);
Tiled::Tileset *tilesetForLayer(char type, char tileIndex,
QList<Tiled::Tileset *> typeTilesets,
QList<Tiled::Tileset *> tileIndexTilesets);
QString layerTypeToName(char type);
// MapWriterInterface support.
bool writeLayer(QDataStream &out, Tiled::TileLayer *layer);
};
} // namespace ReplicaIsland
#endif // REPLICAISLANDPLUGIN_H