CRM64Pro GDK v0.11.0
A free cross-platform game development kit built on top of SDL 3.0
|
v1.00 (24 February 2017)
Data definition used by the TileEngine objects as the way of updating and rendering the layers.
TE_MapData is the abstract class that define base components of a layer. TE_MapBase is a derivated class from TE_MapData that implements all required methods for creating a layer.
It could be further derivated to a custom class for representing customized layers.
Classes | |
class | CRM64Pro::TE_MapData |
MapData abstract class definition. More... | |
class | CRM64Pro::TE_MapBase |
MapBase class. Minimum mapdata to be used with the TileEngine. Inherit from it your own custom MapData. More... | |
Functions | |
template<typename T > | |
T ** | CRM64Pro::TE_MapData::create2DArray (Sint32 height, Sint32 width) |
Template: dynamic 2D array of a given data type. | |
template<typename T > | |
Sint32 | CRM64Pro::TE_MapData::delete2DArray (T **Array) |
Template: delete a dynamic 2D array. | |
Sint32 | CRM64Pro::TE_MapData::getMapType (string &sMT) |
Get map type. | |
Sint32 | CRM64Pro::TE_MapData::getCellWidth () |
Get cell width. | |
Sint32 | CRM64Pro::TE_MapData::setCellWidth (Sint32 size) |
Set cell width. | |
Sint32 | CRM64Pro::TE_MapData::getCellHeight () |
Get cell height. | |
Sint32 | CRM64Pro::TE_MapData::setCellHeight (Sint32 size) |
Set tile height. | |
Sint32 | CRM64Pro::TE_MapData::getMapWidth () |
Get map width. | |
Sint32 | CRM64Pro::TE_MapData::getMapHeight () |
Get map height. | |
CRM64Pro::TE_MapBase::TE_MapBase () | |
MapBase default constructor. | |
CRM64Pro::TE_MapBase::TE_MapBase (Sint32 height, Sint32 width) | |
MapBase mandatory constructor. | |
CRM64Pro::TE_MapBase::~TE_MapBase () | |
MapBase destructor. | |
static TE_MapBase * | CRM64Pro::TE_MapBase::createInstance (Sint32 height, Sint32 width) |
Create an instance of this class. | |
Sint32 | CRM64Pro::TE_MapBase::checkMap () |
Map validation. | |
Sint32 | CRM64Pro::TE_MapBase::info (Sint8, eLogMessageLevel eLML) |
Request MapBase object information. | |
Sint32 | CRM64Pro::TE_MapBase::cellUpdate (Sint32, Sint32, void *, void *) |
Update a cell. | |
Sint32 | CRM64Pro::TE_MapBase::cellRender (Sint32, Sint32, Sint32, Sint32, Sint32, Sint32, Sint32, Sint32) |
Render a cell. | |
Sint32 | CRM64Pro::TE_MapBase::saveMapdataNode (Sint32 idXML, Sint32 iOutput) |
Save the mapdata base type to a XML node of a TEL or TMX file. | |
Sint32 | CRM64Pro::TE_MapBase::loadMapdataNode (Sint32 idXML, Sint32 iInput) |
Load the mapdata base type from a node inside a TEL or TMX file. | |
Sint32 | CRM64Pro::TE_MapBase::createMapBase (Sint32 height, Sint32 width, Sint16 value=-1) |
Create the 2D array for the tiles allocation(mapbase). | |
Sint32 | CRM64Pro::TE_MapBase::deleteMapBase () |
Delete the 2D array(mapbase). | |
Sint32 | CRM64Pro::TE_MapBase::setMapBaseValue (Sint32 y, Sint32 x, Sint16 value) |
Set arbitrary values on 2D array(mapbase). | |
Sint32 | CRM64Pro::TE_MapBase::cloneMapBase (TE_MapBase *) |
Copy the current values of the 2D array iTilemap to the given MapBase. | |
Sint32 | CRM64Pro::TE_MapBase::A2DtoCSV (Uint32 **Array2D, Sint32 w, Sint32 h, char *&szOutput) |
Convert a 2D integers array to a CSV formatted string (SerializeOut). | |
Sint32 | CRM64Pro::TE_MapBase::CSVtoA2D (Uint32 **Array2D, Sint32 w, Sint32 h, const string &sInput) |
Convert a CSV formatted string to a 2D integers array (SerializeIn). | |
Sint32 | CRM64Pro::TE_MapBase::stringtoA2D (Uint32 **Array2D, Sint32 w, Sint32 h, const char *szInput) |
Convert a string to a 2D integers array (SerializeIn). | |
T ** CRM64Pro::TE_MapData::create2DArray | ( | Sint32 | height, |
Sint32 | width | ||
) |
Template: dynamic 2D array of a given data type.
height | Selected height of your 2D array |
width | Selected width of your 2D array |
Sint32 CRM64Pro::TE_MapData::delete2DArray | ( | T ** | Array | ) |
Template: delete a dynamic 2D array.
Array | pointer to 2D array. |
Sint32 CRM64Pro::TE_MapData::getMapType | ( | string & | sMT | ) |
Get map type.
sMT | string to be filled in with the map type. |
Sint32 CRM64Pro::TE_MapData::getCellWidth | ( | ) |
Get cell width.
Sint32 CRM64Pro::TE_MapData::setCellWidth | ( | Sint32 | size | ) |
Set cell width.
size | integer with cell width (in pixels). |
Sint32 CRM64Pro::TE_MapData::getCellHeight | ( | ) |
Get cell height.
Sint32 CRM64Pro::TE_MapData::setCellHeight | ( | Sint32 | size | ) |
Set tile height.
size | integer with cell height (in pixels). |
Sint32 CRM64Pro::TE_MapData::getMapWidth | ( | ) |
Get map width.
Sint32 CRM64Pro::TE_MapData::getMapHeight | ( | ) |
Get map height.
CRM64Pro::TE_MapBase::TE_MapBase | ( | Sint32 | height, |
Sint32 | width | ||
) |
MapBase mandatory constructor.
It will create a 2D array for the cells allocation. Each element on this 2D array is a cell.
When you inherit from TE_MapBase to create a custom map you HAVE TO create a constructor to overload
this one but do not forget to call this mandatory constructor from your own constructor.
height | Selected height of your map. 0 avoid the iTilemap creation. |
width | Selected width of your map. 0 avoid the iTilemap creation. |
|
static |
Create an instance of this class.
When you inherit from TE_MapBase to create a custom map you HAVE TO create a method to overload
this one creating an instance of your own derivated class. This is mandatory.
y | Value to be passed to the mandatory constructor. |
x | Value to be passed to the mandatory constructor. |
|
virtual |
Map validation.
It validates the iTilemap 2D array(mapbase):
When you use custom mapdata (inherit from TE_MapBase), you can overload this method to check your custom mapdata but you must call first this method.
Implements CRM64Pro::TE_MapData.
|
virtual |
Request MapBase object information.
For displaying the information, it uses the default log.
When you use custom mapdata (inherit from TE_MapBase), you can overload this method to show your custom information but you should call first this method.
bTilesetReady | -1 do not display anything, 0 it is not ready and 1 it is ready. |
eLML | importance of the message. Check eLogMessageLevel enum for further information. |
Implements CRM64Pro::TE_MapData.
|
inlinevirtual |
Update a cell.
When you inherit from TE_MapBase to create a custom mapdata you could overload this method to execute your own updating code.
This method does not perform any action in the base mapdata level.
x_cell | Cell X coordinate to be updated. |
y_cell | Cell y coordinate to be updated. |
v1 | Pointer to an user defined data value or structure. |
v2 | Pointer to an user defined data value or structure. |
Implements CRM64Pro::TE_MapData.
|
inlinevirtual |
Render a cell.
When you inherit from TE_MapBase to create a custom mapdata you could overload this method to execute your own rendering code. Additionally, you must call this method in order to render the base mapdata
We support rendering tiles with different size to the underlying cells: larger tiles will extend at the top and right.
x_cell | Cell X coordinate to be rendered. |
y_cell | Cell y coordinate to be rendered. |
x_dst | Destination surface X coordinate to start to render in case you wish to. |
y_dst | Destination surface Y coordinate to start to render in case you wish to. |
iAlpha | Alpha modulation for this layer. This value overwrites the own tileset alpha modulation. |
idTileset | tileset id. |
idTile | which tile inside the tileset must be rendered. |
idRes | a valid screen or image handle used as rendering target. |
Implements CRM64Pro::TE_MapData.
|
virtual |
Save the mapdata base type to a XML node of a TEL or TMX file.
When you use custom mapdata (inherit from TE_MapBase), you can overload this method to save your custom mapdata but you must call first this method.
idXML | id of an opened XML with the pointer inside a layer subnode. |
iOutput | integer with 0 for TEL or 1 for TMX files. |
Implements CRM64Pro::TE_MapData.
|
virtual |
Load the mapdata base type from a node inside a TEL or TMX file.
When you use custom mapdata (inherit from TE_MapBase), you can overload this method to load your custom mapdata and you must not call this method.
idXML | id of an opened XML with the pointer inside a mapdata/data subnode. |
iInput | integer with 0 for TEL or 1 for TMX files. |
Implements CRM64Pro::TE_MapData.
Sint32 CRM64Pro::TE_MapBase::createMapBase | ( | Sint32 | height, |
Sint32 | width, | ||
Sint16 | value = -1 |
||
) |
Create the 2D array for the tiles allocation(mapbase).
Each element on this 2D array is a cell.
height | Selected height of your map. |
width | Selected width of your map. |
value | Default value to be assigned on each cell. |
Sint32 CRM64Pro::TE_MapBase::deleteMapBase | ( | ) |
Delete the 2D array(mapbase).
Sint32 CRM64Pro::TE_MapBase::setMapBaseValue | ( | Sint32 | y, |
Sint32 | x, | ||
Sint16 | value | ||
) |
Set arbitrary values on 2D array(mapbase).
It is mainly used creating manual maps
y | Selected Y position. -1 to affect the whole axis. |
x | Selected X position. -1 to affect the whole axis. |
value | The value to be set on the given position. |
Sint32 CRM64Pro::TE_MapBase::cloneMapBase | ( | TE_MapBase * | dest | ) |
Copy the current values of the 2D array iTilemap to the given MapBase.
The destination must have identical attributes (iMapWidth and iMapHeight). If the destination has not an iTilemap we will create one identical to the source
dest | Pointer to destination TE_MapBase or derivated object. |
|
protected |
Convert a 2D integers array to a CSV formatted string (SerializeOut).
Array2D | 2D array to be parsed. |
w | width of the 2D array. |
h | height of the 2D array. |
szOutput | Pointer to the output string with the integers in CSV format. |
|
protected |
Convert a CSV formatted string to a 2D integers array (SerializeIn).
Array2D | destination 2D array of the parsed integers. |
w | width of the 2D array. |
h | height of the 2D array. |
sInput | string with the the integers in CSV format. |
|
protected |
Convert a string to a 2D integers array (SerializeIn).
Array2D | destination 2D array of the parsed integers. |
w | width of the 2D array. |
h | height of the 2D array. |
szInput | Pointer to the input string. |