Tileson 1.4.0
A helpful json parser for Tiled maps
Loading...
Searching...
No Matches
Public Member Functions | List of all members
tson::Chunk Class Reference

#include <Chunk.hpp>

Public Member Functions

 Chunk ()=default
 
 Chunk (IJson &json)
 
bool parse (IJson &json)
 
const std::vector< int > & getData () const
 
const std::string & getBase64Data () const
 
const Vector2igetSize () const
 
const Vector2igetPosition () const
 

Constructor & Destructor Documentation

◆ Chunk() [1/2]

tson::Chunk::Chunk ( )
inlinedefault

◆ Chunk() [2/2]

tson::Chunk::Chunk ( IJson json)
inlineexplicit

Parses 'chunk' data from Tiled json and stores the values in this class

Parameters
jsonjson-data

Member Function Documentation

◆ getBase64Data()

const std::string & tson::Chunk::getBase64Data ( ) const
inline

'data' (when string): Array of unsigned int (GIDs) or base64-encoded data.

Returns
base64 string

◆ getData()

const std::vector< int > & tson::Chunk::getData ( ) const
inline

'data' (when uint array): Array of unsigned int (GIDs) or base64-encoded data. tilelayer only.

Returns
list of tile ids

◆ getPosition()

const tson::Vector2i & tson::Chunk::getPosition ( ) const
inline

'x' and 'y' position in tiles

Returns
Position in int

◆ getSize()

const tson::Vector2i & tson::Chunk::getSize ( ) const
inline

x='width' (in tiles) and y='height' (in tiles).

Returns
Size (x and y), containing the values from the fields 'width' and 'height' in Tiled

◆ parse()

bool tson::Chunk::parse ( IJson json)
inline

Parses 'chunk' data from Tiled json and stores the values in this class

Parameters
jsonjson-data
Returns
true if all mandatory fields was found. false otherwise.

The documentation for this class was generated from the following file: