MapBase derivated class.
More...
|
int | CellRender (int, int, int, int, cMSTE *TE, int) |
| Render a cell. More...
|
|
int | CellUpdate (int, int, cMSTE *TE, void *, void *) |
| Update a cell. More...
|
|
int | CheckMap () |
| Map validation. More...
|
|
int | CloneMapBase (cMSTE_MapBase *) |
| Copy the current values of the 2D array iTilemap to the given MapBase. More...
|
|
| cMSTE_MapBase () |
| MapBase default constructor.
|
|
| cMSTE_MapBase (int height, int width) |
| MapBase mandatory constructor. More...
|
|
int | CreateMapBase (int height, int width, short int value=-1) |
| Create the 2D array for the tiles allocation(mapbase). More...
|
|
int | DeleteMapBase () |
| Delete the 2D array(mapbase) More...
|
|
int | LoadMapdataNode (int i, int iInput) |
| Load the mapdata base type from a node inside a MSM or TMX file. More...
|
|
int | PrintInfo (char, int) |
| Print using ILogSystem some details of this mapdata. More...
|
|
int | SaveMapdataNode (int i, int iOutput) |
| Save the mapdata base type to a XML node of a MSM or TMX file. More...
|
|
int | SetMapBaseValue (int y, int x, short int value) |
| Set arbitrary values on 2D array(mapbase) More...
|
|
| ~cMSTE_MapBase () |
| MapBase destructor.
|
|
| cMSTE_MapData () |
| MapData constructor.
|
|
template<typename T > |
T ** | Create2DArray (int height, int width) |
| Create a dynamic 2D array of a given data type. More...
|
|
template<typename T > |
void | Delete2DArray (T **Array) |
| Delete a dynamic 2D array.
|
|
int | GetCellHeight () |
| Get cell height. More...
|
|
int | GetCellWidth () |
| Get cell width. More...
|
|
int | GetMapHeight () |
| Get map height. More...
|
|
char * | GetMapType () |
| Get map type. More...
|
|
int | GetMapWidth () |
| Get map width. More...
|
|
void | SetCellHeight (int size) |
| Set tile height. More...
|
|
void | SetCellWidth (int size) |
| Set cell width. More...
|
|
virtual | ~cMSTE_MapData () |
| MapData destructor.
|
|
|
int | A2DtoCSV (unsigned int **Array2D, int w, int h, char *&szOutput) |
| Convert a 2D integers array to a CSV formatted string (SerializeOut) More...
|
|
int | CSVtoA2D (unsigned int **Array2D, int w, int h, char *&szInput) |
| Convert a CSV formatted string to a 2D integers array (SerializeIn) More...
|
|
int | StringtoA2D (unsigned int **Array2D, int w, int h, char *&szInput) |
| Convert a string to a 2D integers array (SerializeIn) More...
|
|
MapBase derivated class.
This is a valid mapdata to be used with MSTE.
Inherit from it your own custom MapData class definition.
- Examples:
- Example01_Init.cpp, and Example04_Custom.cpp.
cMSTE_MapBase::cMSTE_MapBase |
( |
int |
height, |
|
|
int |
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 cMSTE_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. |
int cMSTE_MapBase::A2DtoCSV |
( |
unsigned int ** |
Array2D, |
|
|
int |
w, |
|
|
int |
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 Failed
-
1 Succeed
int cMSTE_MapBase::CellRender |
( |
int |
x_cell, |
|
|
int |
y_cell, |
|
|
int |
x_dst, |
|
|
int |
y_dst, |
|
|
cMSTE * |
TE, |
|
|
int |
iAlpha |
|
) |
| |
|
virtual |
Render a cell.
When you inherit from cMSTE_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 |
TE | Pointer to the TileEngine instance |
iAlpha | Alpha per-surface value for this layer. With 255, it will use the alpha per-surface of the used tilesets. |
- Returns
- 0 Failed
-
1 Succeed
Implements cMSTE_MapData.
- Examples:
- Example04_Custom.cpp.
int cMSTE_MapBase::CellUpdate |
( |
int |
x_cell, |
|
|
int |
y_cell, |
|
|
cMSTE * |
TE, |
|
|
void * |
v1, |
|
|
void * |
v2 |
|
) |
| |
|
virtual |
Update a cell.
When you inherit from cMSTE_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 |
TE | Pointer to the TileEngine instance |
v1 | Pointer to an user defined data value or structure |
v2 | Pointer to an user defined data value or structure |
- Returns
- 0 Failed
-
1 Succeed
Implements cMSTE_MapData.
int cMSTE_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 cMSTE_MapBase), you can overload this method to check your custom mapdata but you must call first this method.
- Returns
- 0 Failed
-
1 Succeed
Implements cMSTE_MapData.
- Examples:
- Example01_Init.cpp, and Example04_Custom.cpp.
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
-
- Returns
- 0 Failed
-
1 Succeed
Create an instance of this class.
When you inherit from cMSTE_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 cMSTE_MapBase pointer to the created instance
- Examples:
- Example04_Custom.cpp.
int cMSTE_MapBase::CreateMapBase |
( |
int |
height, |
|
|
int |
width, |
|
|
short int |
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 Failed
-
1 Succeed
int cMSTE_MapBase::CSVtoA2D |
( |
unsigned int ** |
Array2D, |
|
|
int |
w, |
|
|
int |
h, |
|
|
char *& |
szInput |
|
) |
| |
|
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 |
szInput | Pointer to the input string with the integers in CSV format. |
- Returns
- 0 Failed
-
1 Succeed
int cMSTE_MapBase::DeleteMapBase |
( |
| ) |
|
Delete the 2D array(mapbase)
- Returns
- 0 Failed
-
1 Succeed
int cMSTE_MapBase::LoadMapdataNode |
( |
int |
idXML, |
|
|
int |
iInput |
|
) |
| |
|
virtual |
Load the mapdata base type from a node inside a MSM or TMX file.
When you use custom mapdata (inherit from cMSTE_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 file with the pointer inside a mapdata/data subnode |
iInput | integer with 0 for MSM or 1 for TMX files. |
- Returns
- 0 Failed
-
1 Succeed
Implements cMSTE_MapData.
- Examples:
- Example04_Custom.cpp.
int cMSTE_MapBase::PrintInfo |
( |
char |
bTilesetReady, |
|
|
int |
iLogLevel |
|
) |
| |
|
virtual |
Print using ILogSystem some details of this mapdata.
When you use custom mapdata (inherit from cMSTE_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 |
iLogLevel | MSTE verbosity level |
- Returns
- 0 Failed
-
1 Succeed
Implements cMSTE_MapData.
- Examples:
- Example04_Custom.cpp.
int cMSTE_MapBase::SaveMapdataNode |
( |
int |
idXML, |
|
|
int |
iOutput |
|
) |
| |
|
virtual |
Save the mapdata base type to a XML node of a MSM or TMX file.
When you use custom mapdata (inherit from cMSTE_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 file with the pointer inside a layer subnode |
iOutput | integer with 0 for MSM or 1 for TMX files. |
- Returns
- 0 Failed
-
1 Succeed
Implements cMSTE_MapData.
- Examples:
- Example04_Custom.cpp.
int cMSTE_MapBase::SetMapBaseValue |
( |
int |
y, |
|
|
int |
x, |
|
|
short int |
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 Failed
-
1 Succeed
- Examples:
- Example01_Init.cpp.
int cMSTE_MapBase::StringtoA2D |
( |
unsigned int ** |
Array2D, |
|
|
int |
w, |
|
|
int |
h, |
|
|
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 Failed
-
1 Succeed
The documentation for this class was generated from the following files:
- MSTE_MapData.h
- MSTE_MapData.cpp