|
template<typename T > |
T ** | CRM64Pro::TE_MapData::create2DArray (Sint32 height, Sint32 width) |
|
Sint32 | CRM64Pro::TE_MapData::getMapType (string &sMT) |
|
Sint32 | CRM64Pro::TE_MapData::getCellWidth () |
|
Sint32 | CRM64Pro::TE_MapData::setCellWidth (Sint32 size) |
|
Sint32 | CRM64Pro::TE_MapData::getCellHeight () |
|
Sint32 | CRM64Pro::TE_MapData::setCellHeight (Sint32 size) |
|
Sint32 | CRM64Pro::TE_MapData::getMapWidth () |
|
Sint32 | CRM64Pro::TE_MapData::getMapHeight () |
|
| CRM64Pro::TE_MapBase::TE_MapBase (Sint32 height, Sint32 width) |
|
static TE_MapBase * | CRM64Pro::TE_MapBase::createInstance (Sint32 height, Sint32 width) |
|
Sint32 | CRM64Pro::TE_MapBase::checkMap () |
|
Sint32 | CRM64Pro::TE_MapBase::info (Sint8, eLogMessageLevel eLML) |
|
Sint32 | CRM64Pro::TE_MapBase::cellUpdate (Sint32, Sint32, void *, void *) |
|
Sint32 | CRM64Pro::TE_MapBase::cellRender (Sint32, Sint32, Sint32, Sint32, Sint32, Sint32, Sint32, Sint32) |
|
Sint32 | CRM64Pro::TE_MapBase::saveMapdataNode (Sint32 idXML, Sint32 iOutput) |
|
Sint32 | CRM64Pro::TE_MapBase::loadMapdataNode (Sint32 idXML, Sint32 iInput) |
|
Sint32 | CRM64Pro::TE_MapBase::createMapBase (Sint32 height, Sint32 width, Sint16 value=-1) |
|
Sint32 | CRM64Pro::TE_MapBase::deleteMapBase () |
|
Sint32 | CRM64Pro::TE_MapBase::setMapBaseValue (Sint32 y, Sint32 x, Sint16 value) |
|
Sint32 | CRM64Pro::TE_MapBase::cloneMapBase (TE_MapBase *) |
|
Sint32 | CRM64Pro::TE_MapBase::A2DtoCSV (Uint32 **Array2D, Sint32 w, Sint32 h, char *&szOutput) |
|
Sint32 | CRM64Pro::TE_MapBase::CSVtoA2D (Uint32 **Array2D, Sint32 w, Sint32 h, const string &sInput) |
|
Sint32 | CRM64Pro::TE_MapBase::stringtoA2D (Uint32 **Array2D, Sint32 w, Sint32 h, const char *szInput) |
|
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. TODO dibujo
◆ create2DArray()
template<typename T >
T ** CRM64Pro::TE_MapData::create2DArray |
( |
Sint32 |
height, |
|
|
Sint32 |
width |
|
) |
| |
Template: dynamic 2D array of a given data type.
- Parameters
-
height | Selected height of your 2D array |
width | Selected width of your 2D array |
- Returns
- A Pointer to the dynamic 2D array
◆ getMapType()
Sint32 CRM64Pro::TE_MapData::getMapType |
( |
string & |
sMT | ) |
|
Get map type.
- Parameters
-
sMT | string to be filled in with the map type. |
- Returns
- 0 on success or a negative error code on failure.
◆ getCellWidth()
Sint32 CRM64Pro::TE_MapData::getCellWidth |
( |
| ) |
|
Get cell width.
- Returns
- integer with the cell width (in pixels).
◆ setCellWidth()
Sint32 CRM64Pro::TE_MapData::setCellWidth |
( |
Sint32 |
size | ) |
|
Set cell width.
- Parameters
-
size | integer with cell width (in pixels). |
- Returns
- 0 on success or a negative error code on failure.
◆ getCellHeight()
Sint32 CRM64Pro::TE_MapData::getCellHeight |
( |
| ) |
|
Get cell height.
- Returns
- integer with the cell height (in pixels).
◆ setCellHeight()
Sint32 CRM64Pro::TE_MapData::setCellHeight |
( |
Sint32 |
size | ) |
|
Set tile height.
- Parameters
-
size | integer with cell height (in pixels). |
- Returns
- 0 on success or a negative error code on failure.
◆ getMapWidth()
Sint32 CRM64Pro::TE_MapData::getMapWidth |
( |
| ) |
|
Get map width.
- Returns
- width of this map(in number of tiles).
◆ getMapHeight()
Sint32 CRM64Pro::TE_MapData::getMapHeight |
( |
| ) |
|
Get map height.
- Returns
- height of this map(in number of tiles).
◆ TE_MapBase()
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.
- Parameters
-
height | Selected height of your map. 0 avoid the iTilemap creation. |
width | Selected width of your map. 0 avoid the iTilemap creation. |
◆ createInstance()
TE_MapBase * CRM64Pro::TE_MapBase::createInstance |
( |
Sint32 |
y, |
|
|
Sint32 |
x |
|
) |
| |
|
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.
- Parameters
-
y | Value to be passed to the mandatory constructor. |
x | Value to be passed to the mandatory constructor. |
- Returns
- A TE_MapBase pointer to the created instance.
◆ checkMap()
Sint32 CRM64Pro::TE_MapBase::checkMap |
( |
| ) |
|
|
virtual |
Map validation.
It validates the iTilemap 2D array(mapbase):
-
If there is any <0, it will print info with the error
-
Check the mapbase width and height
-
Check the mapbase cell width and height
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.
- Returns
- 0 on success or a negative error code on failure.
Implements CRM64Pro::TE_MapData.
◆ info()
Sint32 CRM64Pro::TE_MapBase::info |
( |
Sint8 |
bTilesetReady, |
|
|
eLogMessageLevel |
eLML |
|
) |
| |
|
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.
- Parameters
-
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. |
- Returns
- 0 on success or a negative error code on failure.
Implements CRM64Pro::TE_MapData.
◆ cellUpdate()
Sint32 CRM64Pro::TE_MapBase::cellUpdate |
( |
Sint32 |
x_cell, |
|
|
Sint32 |
y_cell, |
|
|
void * |
v1, |
|
|
void * |
v2 |
|
) |
| |
|
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.
- Parameters
-
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. |
- Returns
- 0 on success or a negative error code on failure.
Implements CRM64Pro::TE_MapData.
◆ cellRender()
Sint32 CRM64Pro::TE_MapBase::cellRender |
( |
Sint32 |
x_cell, |
|
|
Sint32 |
y_cell, |
|
|
Sint32 |
x_dst, |
|
|
Sint32 |
y_dst, |
|
|
Sint32 |
iAlpha, |
|
|
Sint32 |
idTileset, |
|
|
Sint32 |
idTile, |
|
|
Sint32 |
idRes |
|
) |
| |
|
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.
- Parameters
-
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. |
- Returns
- 0 on success or a negative error code on failure.
Implements CRM64Pro::TE_MapData.
◆ saveMapdataNode()
Sint32 CRM64Pro::TE_MapBase::saveMapdataNode |
( |
Sint32 |
idXML, |
|
|
Sint32 |
iOutput |
|
) |
| |
|
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.
- Parameters
-
idXML | id of an opened XML with the pointer inside a layer subnode. |
iOutput | integer with 0 for TEL or 1 for TMX files. |
- Returns
- 0 on success or a negative error code on failure.
Implements CRM64Pro::TE_MapData.
◆ loadMapdataNode()
Sint32 CRM64Pro::TE_MapBase::loadMapdataNode |
( |
Sint32 |
idXML, |
|
|
Sint32 |
iInput |
|
) |
| |
|
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.
- Parameters
-
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. |
- Returns
- 0 on success or a negative error code on failure.
Implements CRM64Pro::TE_MapData.
◆ createMapBase()
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.
- Parameters
-
height | Selected height of your map. |
width | Selected width of your map. |
value | Default value to be assigned on each cell. |
- Returns
- 0 on success or a negative error code on failure.
◆ deleteMapBase()
Sint32 CRM64Pro::TE_MapBase::deleteMapBase |
( |
| ) |
|
Delete the 2D array(mapbase).
- Returns
- 0 on success or a negative error code on failure.
◆ setMapBaseValue()
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
- Parameters
-
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. |
- Returns
- 0 on success or a negative error code on failure.
◆ cloneMapBase()
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
- Parameters
-
dest | Pointer to destination TE_MapBase or derivated object. |
- Returns
- 0 on success or a negative error code on failure.
◆ A2DtoCSV()
Sint32 CRM64Pro::TE_MapBase::A2DtoCSV |
( |
Uint32 ** |
Array2D, |
|
|
Sint32 |
w, |
|
|
Sint32 |
h, |
|
|
char *& |
szOutput |
|
) |
| |
|
protected |
Convert a 2D integers array to a CSV formatted string (SerializeOut).
- Parameters
-
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. |
- Returns
- 0 on success or a negative error code on failure.
- Note
- On successfully calls to this method, a memory allocation for szOutput is done, so once you finish, please remove it using _C64_FREE macro.
◆ CSVtoA2D()
Sint32 CRM64Pro::TE_MapBase::CSVtoA2D |
( |
Uint32 ** |
Array2D, |
|
|
Sint32 |
w, |
|
|
Sint32 |
h, |
|
|
const string & |
sInput |
|
) |
| |
|
protected |
Convert a CSV formatted string to a 2D integers array (SerializeIn).
- Parameters
-
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. |
- Returns
- 0 on success or a negative error code on failure.
◆ stringtoA2D()
Sint32 CRM64Pro::TE_MapBase::stringtoA2D |
( |
Uint32 ** |
Array2D, |
|
|
Sint32 |
w, |
|
|
Sint32 |
h, |
|
|
const char * |
szInput |
|
) |
| |
|
protected |
Convert a string to a 2D integers array (SerializeIn).
- Parameters
-
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. |
- Returns
- 0 on success or a negative error code on failure.