ScummVM API documentation
TMXTileSet.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * This code is based on the CRAB engine
24 *
25 * Copyright (c) Arvind Raja Yadav
26 *
27 * Licensed under MIT
28 *
29 */
30
31#ifndef CRAB_TMXTILESET_H
32#define CRAB_TMXTILESET_H
33
34#include "crab/image/Image.h"
35#include "crab/TMX/TMXLayer.h"
36
37namespace Crab {
38
39namespace TMX {
40struct TileSet {
41 // The name of the tileset
42 Common::String _name;
43
44 // The location of the tileset image on the disk
45 Common::Path _loc;
46
47 // The first gid of the tileset
48 GidFormat _firstGid;
49
50 // Dimensions of tiles
51 int _tileW, _tileH;
52
53 // Number of rows and columns of tiles
54 int _totalRows, _totalCols;
55
56 // The image used by the tileset
58
59 // Stuff used to store temporary data
60
61 // The rectangle used to store clip info
62 Rect _clip;
63
64 void init() {
65 _firstGid = 1;
66 _tileW = 1;
67 _tileH = 1;
68 _totalRows = 1;
69 _totalCols = 1;
70 }
71
72 TileSet() {
73 init();
74 }
75
76 TileSet(const Common::Path &path, rapidxml::xml_node<char> *node) {
77 init();
78 load(path, node);
79 }
80
81 void load(const Common::Path &path, rapidxml::xml_node<char> *node);
82 void draw(const Vector2i &pos, const TileInfo &tile);
83 void preDraw(const Vector2i &pos, const TileInfo &tile, Graphics::ManagedSurface *surf);
84};
85
88
89 // The latest tile position
90 Vector2i _v;
91
92 // The area that we have to draw
93 Vector2i _start, _finish;
94
95public:
96 TileSetGroup() {}
97
98 void reset();
99
100 void load(const Common::Path &path, rapidxml::xml_node<char> *node);
101 void draw(MapLayer &layer, const Rect &camera, const Vector2i &tileSize, const Rect &playerPos, pyrodactyl::image::Image &img);
102 void preDraw(MapLayer &layer, const Vector2i &tileSize, Graphics::ManagedSurface *surf);
103 void forceDraw(MapLayer &layer, const Rect &camera, const Vector2i &tileSize, const Rect &playerPos);
104};
105} // End of namespace TMX
106
107} // End of namespace Crab
108
109#endif // CRAB_TMXTILESET_H
Definition: array.h:52
Definition: path.h:52
Definition: str.h:59
Definition: TMXLayer.h:82
Definition: TMXTileSet.h:86
Definition: Image.h:51
Definition: managed_surface.h:51
Definition: Rectangle.h:42
Definition: TileInfo.h:46
Definition: TMXTileSet.h:40