![]() |
CRM64Pro GDK
v0.94
A free cross-platform game development kit built on top of SDL 2.0
|
Classes | |
class | CRM64Pro::TileObj |
class | CRM64Pro::TileMgr |
Functions | |
Sint32 | CRM64Pro::TileObj::info (Sint32 iMode=0) |
Sint32 | CRM64Pro::TileObj::getName (string &sName) |
Uint32 | CRM64Pro::TileObj::getID () |
Sint32 | CRM64Pro::TileObj::assignImage (Sint32 idImage, Sint32 iOwnership=0) |
Sint32 | CRM64Pro::TileObj::getImage () |
Sint32 | CRM64Pro::TileObj::setOffset (Sint32 iTSMode, Sint32 iX, Sint32 iY) |
Sint32 | CRM64Pro::TileObj::getOffset (Sint32 *iX, Sint32 *iY) |
Sint32 | CRM64Pro::TileObj::setPosition (Sint32 iX, Sint32 iY) |
Sint32 | CRM64Pro::TileObj::getPosition (Sint32 *iX, Sint32 *iY) |
Sint32 | CRM64Pro::TileObj::getNumTiles (Sint32 *iX, Sint32 *iY) |
Sint32 | CRM64Pro::TileObj::render (Sint32 iTS=1, Sint32 idRes=0) |
Sint32 | CRM64Pro::TileObj::save (const string &sFileCDC) |
Sint32 | CRM64Pro::TileObj::save (Sint32 idCDC) |
Sint32 | CRM64Pro::TileMgr::info (Sint32 iMode=0) |
Sint32 | CRM64Pro::TileMgr::create (const string &sName, Uint32 iVersion=10) |
Sint32 | CRM64Pro::TileMgr::close (Sint32 idTile) |
Sint32 | CRM64Pro::TileMgr::getNum () |
Sint32 | CRM64Pro::TileMgr::setName (Sint32 idTile, const string &sName) |
TileObj * | CRM64Pro::TileMgr::get (Sint32 idTile) |
Sint32 | CRM64Pro::TileMgr::child (Sint32 idTile) |
Sint32 | CRM64Pro::TileMgr::load (const string &sFileCDC, const string &sName) |
Sint32 | CRM64Pro::TileMgr::load (const Sint32 idCDC, const string &sName) |
Sint32 | CRM64Pro::TileMgr::remove (const Sint32 idCDC, const string &sName) |
Tiles are smaller images of uniform and rectangular size which can be combined into a larger "image map" allowing the creation of huge game maps and saving a lot of memory.
A collection of these tiles is called tileset. The tiles size are set by the offsets X and Y.
With this manager, you can manage all common operations done in a tile set.
There is a method for getting the Image id in order to get access to the Image object, for example, you can export the tile image to an external file or modify the alpha modulation.
The storage layer(load() and save() methods) are using the CDC v1.x specification.
This is an advance "cloning" manager: when loading from a CDC file a tile which is already loaded/created (using the name as the key), it will create a new child tile.
Only a single instance of the Tile Manager exists which is created once Main is instantiated.
You can get a reference to this manager using Main::ITileMgr() method.
Sint32 CRM64Pro::TileObj::info | ( | Sint32 | iMode = 0 | ) |
Request Tile object information.
For displaying the information, it uses the default log.
iMode | unused for the time being. |
Sint32 CRM64Pro::TileObj::getName | ( | string & | sName | ) |
Get the name.
sName | a string containing the tile name. |
Uint32 CRM64Pro::TileObj::getID | ( | ) |
Get the ID.
Sint32 CRM64Pro::TileObj::assignImage | ( | Sint32 | idImage, |
Sint32 | iOwnership = 0 |
||
) |
Assign an Image to this tile.
It is used for loading an Image when the tile is created with TileMgr::create().
idImage | Image id. |
iOwnership | 0 for creating our own copy of the image or any other integer for taking the ownership of the image, in this case, the image can not be already owned by other item. By default it is set to 0. |
Sint32 CRM64Pro::TileObj::getImage | ( | ) |
Get the assigned Image of this tile.
Sint32 CRM64Pro::TileObj::setOffset | ( | Sint32 | iTSMode, |
Sint32 | iX, | ||
Sint32 | iY | ||
) |
Set the tile offsets for creating a tileset (also enable/disable tileset mode).
When enabling the tileset mode, the image will be divided by iX on the X axis and by iY on the Y axis.
The conversion allows to have non-exact offset division, the remainder parts of the image will not be used.
iTSMode | 0 for disabling the tileset mode or any other value for enabling it. |
iX | an integer with the tileset offset X. |
iY | an integer with the tileset offset Y. |
Sint32 CRM64Pro::TileObj::getOffset | ( | Sint32 * | iX, |
Sint32 * | iY | ||
) |
Get the tile offsets (tileset attributes).
iX | an integer pointer filled in with tileset offset X. If nullptr is passed, the method ignores the retrieving of this value. |
iY | an integer pointer filled in with tileset offset Y. If nullptr is passed, the method ignores the retrieving of this value. |
Sint32 CRM64Pro::TileObj::setPosition | ( | Sint32 | iX, |
Sint32 | iY | ||
) |
Set the tile position.
iX | an integer with the tile X position. |
iY | an integer with the tile Y position. |
Sint32 CRM64Pro::TileObj::getPosition | ( | Sint32 * | iX, |
Sint32 * | iY | ||
) |
Get the tile position.
iX | an integer pointer filled in with X tile position. If nullptr is passed, the method ignores the retrieving of this value. |
iY | an integer pointer filled in with Y tile position. If nullptr is passed, the method ignores the retrieving of this value. |
Sint32 CRM64Pro::TileObj::getNumTiles | ( | Sint32 * | iX, |
Sint32 * | iY | ||
) |
Get the number of tiles.
iX | an integer pointer filled in with the tiles on the X axis. If nullptr is passed, the method ignores the retrieving of this value. |
iY | an integer pointer filled in with the tiles on the Y axis. If nullptr is passed, the method ignores the retrieving of this value. |
Sint32 CRM64Pro::TileObj::render | ( | Sint32 | iTile = 1 , |
Sint32 | idRes = 0 |
||
) |
Render the tile.
iTile | tile id from the current tileset. From 1 to number of tiles. |
idRes | a valid screen or image handle. By default it tries to use the default screen. |
Sint32 CRM64Pro::TileObj::save | ( | const string & | sFileCDC | ) |
Save the tile to a CDC file.
The associated image will also be saved in to the same CDC file.
sFileCDC | string containing the [directory]+filename+[extension]. Directory separators '\' and '/' are supported. |
Sint32 CRM64Pro::TileObj::save | ( | Sint32 | idCDC | ) |
Save the tile to a CDC file.
The associated image will also be saved in to the same CDC file.
idCDC | CDC id. |
Sint32 CRM64Pro::TileMgr::info | ( | Sint32 | iMode = 0 | ) |
Request Tile Manager information.
For displaying the information, it uses the default log.
iMode | -1 for displaying only Manager information. 0 for displaying Manager and all Objects information. This is the default value. idTile for displaying Manager and given Tile id information. |
Sint32 CRM64Pro::TileMgr::create | ( | const string & | sName, |
Uint32 | iVersion = 10 |
||
) |
Create a new tile.
This method will create an empty tile (no image assigned), use TileObj::assignImage() method for assigning the image.
sName | The name to give to the tile e.g. 'myTile'. The object name must be unique and with a maximum size of 64 characters or will be truncated. |
iVersion | Tile version. 10 means 1.0 which is the only version supported (as of now). v1.0 is set by default. |
Sint32 CRM64Pro::TileMgr::close | ( | Sint32 | idCur | ) |
Close and destroy a tile.
idCur | 0 for closing all tiles or the Tile id. Stand-alone and child tiles can be closed but parent ones, can not as they have at least one dependency(a child). |
Sint32 CRM64Pro::TileMgr::getNum | ( | ) |
Get number of loaded objects.
Sint32 CRM64Pro::TileMgr::setName | ( | Sint32 | idTile, |
const string & | sName | ||
) |
Change the object name.
idTile | Tile id. |
sName | The name to give to the tile e.g. 'myTile'. The object name must be unique and with a maximum size of 64 characters or will be truncated. |
TileObj * CRM64Pro::TileMgr::get | ( | Sint32 | idTile | ) |
Get a pointer to the tile using its handler.
idTile | Tile id. |
Sint32 CRM64Pro::TileMgr::child | ( | Sint32 | idTile | ) |
Create a child tile dependant on the provided one(the parent).
A child tile uses the attributes of the parent and creates also a parent child image for having different attributes.
idTile | parent Tile id. If the provided tile is a child, internally it will redirect this request to the parent in order to create the new child. |
Sint32 CRM64Pro::TileMgr::load | ( | const string & | sFileCDC, |
const string & | sName | ||
) |
Load a tile stored in a CDC file.
sFileCDC | string containing the [directory]+filename. Directory separators '\' and '/' are supported. |
sName | string with the tile name (maximum size of 64 characters). If the tile is already created, this method will call child() for creating a child. |
Sint32 CRM64Pro::TileMgr::load | ( | const Sint32 | idCDC, |
const string & | sName | ||
) |
Load a tile stored in a CDC file.
idCDC | CDC id. |
sName | string with the tile name (maximum size of 64 characters). If the tile is already created, this method will call child() for creating a child. |
Sint32 CRM64Pro::TileMgr::remove | ( | const Sint32 | idCDC, |
const string & | sName | ||
) |
Remove a tile stored in a CDC file.
idCDC | CDC id. |
sName | string with the tile name (maximum size of 64 characters). |