![]() |
CRM64Pro GDK v0.13.0
A free cross-platform game development kit built on top of SDL 3.0
|
TileEngine Manager and TileEngine objects for 2D tile-based game development [v25.12.0].
|
The TileEngine Core module is a 2D graphics engine that enables you to create tile-based games in a very easy and powerful way. With full support for Tiled map editor (TMX format), you can design your levels using industry-standard tools. Developed from scratch but based on the old MSTE for CRM32Pro, it provides comprehensive support for levels, layers, tilesets and multiple file formats.
The level is the top-level entity created by one or more layers:
| View type | Orthogonal view |
|---|---|
| Layer count | Any number of layers, modifiable at runtime |
| Viewport | Viewport and render screen modifiable at runtime |
| Layer grouping | Independent or grouped layers supporting standard or parallax scroll |
| Auto-scroll | Built-in auto-scrolling capabilities |
Layers contain the tile-based data and rendering properties:
| Dimensions | Any width and height (number of cells) |
|---|---|
| Cell size | Any cell size supported |
| Tilesets | Any number of tilesets per layer; larger tiles extend at top and right |
| Alpha modulation | 0 (fully transparent) to 255 (fully opaque) |
| Events | onUpdateEnd and onRenderEnd events for custom logic |
| Smooth scroll | Optional smooth scroll rendering for fluid movement |
| Custom maps | Add custom map data via C++ class inheritance |
| Debug mode | Render cell grid for debugging purposes |
| Type | CRM64Pro::Tile objects |
|---|---|
| Storage | External files or CDC archives |
| TMX | Full support for Tiled 0.18+ map files (see TMX compatibility below) |
|---|---|
| BMP/PNG | Import image into layer or export layer to external image |
Support for Tiled map files with the following specifications:
| TMX version | v1.0 to v1.10 |
|---|---|
| Orientation | Orthogonal only |
| Render order | right-down only (if set) |
| Layer ID | Starts with 1 |
| Ignored properties | infinite, backgroundcolor |
| C64TE map | Embedded inside TMX (current version 3.0) |
This is a standard manager: objects are not shared and must be unique using its name as the key. You cannot create an object with the same name as another one already created.
Classes | |
| class | CRM64Pro::TileEngine |
| TileEngine Object class. More... | |
| class | CRM64Pro::TileEngineMgr |
| TileEngine Manager class. More... | |
Functions | |
| Sint32 | CRM64Pro::TileEngine::info (Sint32 iMode=-1) |
| Request TileEngine object information. | |
| Sint32 | CRM64Pro::TileEngine::getName (string &sName) |
| Get the name. | |
| Uint32 | CRM64Pro::TileEngine::getID () |
| Get the ID. | |
| Sint32 | CRM64Pro::TileEngine::allocateLayers (Sint32 iN=-1) |
| Set or get the number of layers. | |
| Sint32 | CRM64Pro::TileEngine::freeLayer (Sint32 layer) |
| Free a layer. | |
| Sint32 | CRM64Pro::TileEngine::freeLevel () |
| Free all resources of current level (layer maps and tilesets). | |
| Sint32 | CRM64Pro::TileEngine::logVerbosity (Sint32) |
| Log verbosity control. | |
| Sint32 | CRM64Pro::TileEngine::setViewport (SDL_Rect *rect) |
| Set the desired viewport. | |
| SDL_Rect * | CRM64Pro::TileEngine::getViewport () |
| Get the current viewport. | |
| Sint32 | CRM64Pro::TileEngine::setBackgroundColor (Uint32 iRGBA) |
| Set background color. | |
| Uint32 | CRM64Pro::TileEngine::getBackgroundColor () |
| Get background color. | |
| Sint32 | CRM64Pro::TileEngine::getModificationDate (string &sDate) |
| Get the level modification date (last save level date). | |
| Sint32 | CRM64Pro::TileEngine::getCreationDate (string &sDate) |
| Get the level creation date (first save level date). | |
| Sint32 | CRM64Pro::TileEngine::loadTileset (Sint32 idRes, Sint32 globalID=-1, Sint32 idTileImg=0) |
| Load a tileset. | |
| Sint32 | CRM64Pro::TileEngine::loadTileset (const string &sCDCfile, const string &sTileName, Sint32 iID=-1) |
| Load a tileset. | |
| Sint32 | CRM64Pro::TileEngine::loadTileset (const string &sIMGfile, const string &sTileName, Sint32 iTileWidth, Sint32 iTileHeight, Sint32 iID=-1) |
| Load a tileset. | |
| Sint32 | CRM64Pro::TileEngine::unloadTileset (Sint32 iTN) |
| Unload a given tileset. | |
| Sint32 | CRM64Pro::TileEngine::getTileset (Sint32 iTN) |
| Get the tileset id. | |
| eTileEngineTilesetType | CRM64Pro::TileEngine::getTilesetType (Sint32 iTN) |
| Get the tileset type. | |
| Sint32 | CRM64Pro::TileEngine::getTilesetSource (Sint32 iTN, string &sName) |
| Get tileset source. | |
| Sint32 | CRM64Pro::TileEngine::setTilesetSource (Sint32 iTN, const string &sSource) |
| Set tileset source. | |
| Sint32 | CRM64Pro::TileEngine::setLayerFlags (Sint32 layer, Sint32 iFlags, char iState) |
| Set the layer flags. | |
| Sint32 | CRM64Pro::TileEngine::getLayerFlags (Sint32 layer) |
| Get the layer flags. | |
| Sint32 | CRM64Pro::TileEngine::setLayerAlphaMod (Sint32 layer, Sint32 alpha) |
| Set layer alpha modulation used for rendering this layer. | |
| Sint32 | CRM64Pro::TileEngine::getLayerAlphaMod (Sint32 layer) |
| Get layer alpha modulation. | |
| Sint32 | CRM64Pro::TileEngine::setLayerParallaxRatio (Sint32 layer, float fPRX, float fPRY) |
| Set the layer parallax ratio. | |
| Sint32 | CRM64Pro::TileEngine::getLayerParallaxRatio (Sint32 layer, float *fPRX, float *fPRY) |
| Get current layer parallax ratio. | |
| Sint32 | CRM64Pro::TileEngine::setLayerPosition (Sint32 layer, float xpos=TE_KEEP_VALUE, float ypos=TE_KEEP_VALUE) |
| Set the layer absolute position (in pixels). | |
| Sint32 | CRM64Pro::TileEngine::getLayerPosition (Sint32 layer, float *xpos, float *ypos) |
| Get the current layer position (in pixels). | |
| Sint32 | CRM64Pro::TileEngine::setLayerAutoScroll (Sint32 layer, float xspeed=TE_KEEP_VALUE, float yspeed=TE_KEEP_VALUE) |
| Set the layer AutoScroll speed (in pixels per second). | |
| Sint32 | CRM64Pro::TileEngine::getLayerAutoScroll (Sint32 layer, float *xspeed, float *yspeed) |
| Get the layer AutoScroll speed (in pixels per seconds). | |
| Sint32 | CRM64Pro::TileEngine::setLayerMapData (Sint32 layer, TE_MapData *map) |
| Assign a mapdata to the given layer. | |
| TE_MapData * | CRM64Pro::TileEngine::getLayerMapData (Sint32 layer) |
| Get current mapdata on the layer. | |
| Sint32 | CRM64Pro::TileEngine::setLayerOnUpdateEnd (Sint32 layer, TE_OnLayerEnd myfunc) |
| Set an event function (onUpdateEnd) to be called when the engine finishes updating the layer. | |
| TE_OnLayerEnd * | CRM64Pro::TileEngine::getLayerOnUpdateEnd (Sint32 layer) |
| Get current onUpdateEnd event function if any. | |
| Sint32 | CRM64Pro::TileEngine::setLayerOnRenderEnd (Sint32 layer, TE_OnLayerEnd myfunc) |
| Set an event function (onRenderEnd) to be called when the engine finishes rendering the layer. | |
| TE_OnLayerEnd * | CRM64Pro::TileEngine::getLayerOnRenderEnd (Sint32 layer) |
| Get current onRenderEnd event function if any. | |
| Sint32 | CRM64Pro::TileEngine::getLayerName (Sint32 layer, string &sName) |
| Get the layer name. | |
| Sint32 | CRM64Pro::TileEngine::setLayerName (Sint32 layer, const string &sName) |
| Set a new layer name. | |
| Sint32 | CRM64Pro::TileEngine::setLayerGridColor (Sint32 layer, Uint32 iColor) |
| Set the grid color for the base mapdata. | |
| Sint32 | CRM64Pro::TileEngine::screen2LayerCell (Sint32 layer, Sint32 sx, Sint32 sy, Sint32 *cx, Sint32 *cy) |
| Convert screen coordinates in to layer cell values. | |
| Sint32 | CRM64Pro::TileEngine::screen2LayerAbsolute (Sint32 layer, Sint32 sx, Sint32 sy, Sint32 *px, Sint32 *py) |
| Convert screen coordinates to layer absolute values. | |
| Sint32 | CRM64Pro::TileEngine::moveLayer (Sint32 layer, float x, float y) |
| Move the layer by adding or subtracting the given X/Y values. | |
| Sint32 | CRM64Pro::TileEngine::update (Sint32 layer=0) |
| Update status of TileEngine. | |
| Sint32 | CRM64Pro::TileEngine::render (Sint32 layer=0, Sint32 idRes=0) |
| Render of visible layers. | |
| Sint32 | CRM64Pro::TileEngineMgr::info (Sint32 iMode=0) |
| Request TileEngine Manager information. | |
| Sint32 | CRM64Pro::TileEngineMgr::create (const string &sName, Uint32 iNumLayers=3) |
| Create a new TileEngine. | |
| Sint32 | CRM64Pro::TileEngineMgr::close (Sint32 idTE) |
| Close and destroy a TileEngine. | |
| Sint32 | CRM64Pro::TileEngineMgr::getNum () const |
| Get number of loaded objects. | |
| Sint32 | CRM64Pro::TileEngineMgr::setName (Sint32 idTE, const string &sName) |
| Change the object name. | |
| TileEngine * | CRM64Pro::TileEngineMgr::get (Sint32 idTE=0) |
| Get a pointer to the TileEngine using its handler. | |
| Sint32 CRM64Pro::TileEngine::info | ( | Sint32 | iMode = -1 | ) |
Request TileEngine object information.
Writes information to the default log.
| iMode | -1 for displaying information of all layers or greater than 0 for displaying only information of the give layer id. |
| Sint32 CRM64Pro::TileEngine::getName | ( | string & | sName | ) |
Get the name.
| sName | a string containing the TileEngine name. |
| Uint32 CRM64Pro::TileEngine::getID | ( | ) |
Get the ID.
| Sint32 CRM64Pro::TileEngine::allocateLayers | ( | Sint32 | iN = -1 | ) |
Set or get the number of layers.
| iN | number of layers to allocate. With -1, returns the current number of allocated layers. If current layers are less than iN, allocates empty new layers. Otherwise removes layers using freeLayer(). |
| Sint32 CRM64Pro::TileEngine::freeLayer | ( | Sint32 | layer | ) |
Free a layer.
Releases the mapdata and resets all layer settings, leaving the slot empty and ready for reuse.
| layer | Selected layer to free (from 1 to number of allocated layers). |
| Sint32 CRM64Pro::TileEngine::freeLevel | ( | ) |
Free all resources of current level (layer maps and tilesets).
Resets the current level. All layers are reset but layer slots are kept. Preserves viewport, level name and number of allocated layers.
| Sint32 CRM64Pro::TileEngine::logVerbosity | ( | Sint32 | iLevel | ) |
Log verbosity control.
| iLevel | 0 for disabling the log output, 1 for displaying only LML_CRITICAL, 2 for displaying LML_CRITICAL and LML_NORMAL, 3 for displaying all levels. |
| Sint32 CRM64Pro::TileEngine::setViewport | ( | SDL_Rect * | rect | ) |
Set the desired viewport.
You can change the viewport at any time even while you are rendering your application. The width and height of the viewport can not be greater than values of the smallest layer (excluding the ones with looping flags), otherwise, it will be automatically adjusted.
| rect | Pointer to SDL_Rect with the desired viewport. If the rect width or height is 0, it will use the whole target (a valid screen or image handle). |
| SDL_Rect * CRM64Pro::TileEngine::getViewport | ( | ) |
Get the current viewport.
| Sint32 CRM64Pro::TileEngine::setBackgroundColor | ( | Uint32 | iRGBA | ) |
Set background color.
| iRGBA | background color to set in the format RGBA. When A is 0 (totally transparent), the background color is disabled. |
| Uint32 CRM64Pro::TileEngine::getBackgroundColor | ( | ) |
Get background color.
| Sint32 CRM64Pro::TileEngine::getModificationDate | ( | string & | sDate | ) |
Get the level modification date (last save level date).
| sDate | a string containing the date. |
| Sint32 CRM64Pro::TileEngine::getCreationDate | ( | string & | sDate | ) |
Get the level creation date (first save level date).
| sDate | a string containing the date. |
| Sint32 CRM64Pro::TileEngine::loadTileset | ( | Sint32 | idRes, |
| Sint32 | globalID = -1, | ||
| Sint32 | idTileImg = 0 ) |
Load a tileset.
Loads tilesets based on: standard image with tiles (TETT_TILESET) or set of standalone images (TETT_IMAGESET).
| idRes | ID of a tile or an image. If successfully loaded, TileEngine takes ownership. |
| globalID | Global ID for tileset. Default -1 finds a valid one. 0 not allowed (minimum 1). For TETT_IMAGESET, if globalID exists, tries to add new image. |
| idTileImg | For TETT_IMAGESET: sets tile id of standalone image. |
| Sint32 CRM64Pro::TileEngine::loadTileset | ( | const string & | sCDCfile, |
| const string & | sTileName, | ||
| Sint32 | iID = -1 ) |
Load a tileset.
With TERC_AUTO: tileset is automatically removed after usage, szSource is set to the CDC containing the tileset. After loading, tileset is validated.
| sCDCfile | string with CDC filename containing the tileset. |
| sTileName | string with the tilename to load. |
| iID | Global ID for this tileset. Default -1 to find a valid gID. Value 0 not allowed (minimum is 1). |
| Sint32 CRM64Pro::TileEngine::loadTileset | ( | const string & | sIMGfile, |
| const string & | sTileName, | ||
| Sint32 | iTileWidth, | ||
| Sint32 | iTileHeight, | ||
| Sint32 | iID = -1 ) |
Load a tileset.
With TERC_AUTO: tileset is automatically removed after usage, szSource is set to the external image. After loading, tileset is validated.
| sIMGfile | string with the PNG or BMP filename. |
| sTileName | string with the desired tilename. |
| iTileWidth | integer with the tile width. |
| iTileHeight | integer with the tile height. |
| iID | Global ID for this tileset. Default -1 to find a valid gID. Value 0 not allowed (minimum is 1). |
| Sint32 CRM64Pro::TileEngine::unloadTileset | ( | Sint32 | iTN | ) |
Unload a given tileset.
The affected layers (the ones that use any tile of this tileset) will be disabled.
| iTN | Global ID or any tile of the tileset to be removed. |
| Sint32 CRM64Pro::TileEngine::getTileset | ( | Sint32 | iTN | ) |
Get the tileset id.
It can be used for modifying any tileset attributes.
| iTN | Global ID or any tile of the tileset. |
| eTileEngineTilesetType CRM64Pro::TileEngine::getTilesetType | ( | Sint32 | iTN | ) |
Get the tileset type.
| iTN | Global ID or any tile of the tileset. |
| Sint32 CRM64Pro::TileEngine::getTilesetSource | ( | Sint32 | iTN, |
| string & | sName ) |
Get tileset source.
The tileset source is used when saving the level.
| iTN | Global ID or any tile of the tileset. |
| sName | a string containing the tile source. |
| Sint32 CRM64Pro::TileEngine::setTilesetSource | ( | Sint32 | iTN, |
| const string & | sSource ) |
Set tileset source.
The tileset source is used when saving the level.
| iTN | Global ID or any tile of the tileset. |
| sSource | New source: TE_TILESET_DEFAULT_SOURCE, a full path and filename of a CDC, PNG or BMP. |
| Sint32 CRM64Pro::TileEngine::setLayerFlags | ( | Sint32 | layer, |
| Sint32 | iFlags, | ||
| char | iState ) |
Set the layer flags.
| layer | Number of layer(from 1 to number of allocated layers) |
| iFlags | See TE_LAYERFLAG_xxx defines for further information. They can be OR'ed |
| iState | <=0 for disabling the given bFlags or >1 for enabling it. With TE_LAYERFLAG_DISABLE it does not have sense. |
| Sint32 CRM64Pro::TileEngine::getLayerFlags | ( | Sint32 | layer | ) |
Get the layer flags.
| layer | Number of layer(from 1 to number of allocated layers) |
| Sint32 CRM64Pro::TileEngine::setLayerAlphaMod | ( | Sint32 | layer, |
| Sint32 | alpha ) |
Set layer alpha modulation used for rendering this layer.
| layer | Selected layer to set the alpha value (from 1 to number of allocated layers). |
| alpha | It ranges from 255 (opaque) to 0 (fully transparent). |
| Sint32 CRM64Pro::TileEngine::getLayerAlphaMod | ( | Sint32 | layer | ) |
Get layer alpha modulation.
| layer | Selected layer to get the alpha value (from 1 to number of allocated layers) |
| Sint32 CRM64Pro::TileEngine::setLayerParallaxRatio | ( | Sint32 | layer, |
| float | fPRX, | ||
| float | fPRY ) |
Set the layer parallax ratio.
Changes the real speed of any layer without affecting the rest.
| layer | Selected layer to set the parallax ratio (from 1 to number of allocated layers). |
| fPRX | Parallax ratio on X axis. 0 makes layer independent on X axis, any other value links it. |
| fPRY | Parallax ratio on Y axis. 0 makes layer independent on Y axis, any other value links it. If any linked layer moves, it affects others using this ratio as base. |
| Sint32 CRM64Pro::TileEngine::getLayerParallaxRatio | ( | Sint32 | layer, |
| float * | fPRX, | ||
| float * | fPRY ) |
Get current layer parallax ratio.
| layer | Selected layer to get the parallax ratio (from 1 to number of allocated layers). |
| fPRX | a float pointer filled in with parallax ratio on X axis. If nullptr is passed, the method ignores the retrieving of this value. |
| fPRY | a float pointer filled in with parallax ratio on Y axis. If nullptr is passed, the method ignores the retrieving of this value. |
| Sint32 CRM64Pro::TileEngine::setLayerPosition | ( | Sint32 | layer, |
| float | xpos = TE_KEEP_VALUE, | ||
| float | ypos = TE_KEEP_VALUE ) |
Set the layer absolute position (in pixels).
Changes position for linked layers according to parallax ratios. Layers with parallax ratio 0.0 are independent. Requires valid base mapdata or image set. Special flags: TE_KEEP_VALUE (keep axis value), TE_LAYERPOSITION_BEGINNING/MIDDLE/END (move layer, skips smoothing), TE_LAYERPOSITION_CENTER (center based on viewport).
| layer | Selected layer to set position (from 1 to number of allocated layers). |
| xpos | Flag or value for X axis position. |
| ypos | Flag or value for Y axis position. |
| Sint32 CRM64Pro::TileEngine::getLayerPosition | ( | Sint32 | layer, |
| float * | xpos, | ||
| float * | ypos ) |
Get the current layer position (in pixels).
| layer | Selected layer to get its current position (from 1 to number of allocated layers). |
| xpos | Pointer to float var to store the position on X axis. nullptr if you dont want to retrieve it. |
| ypos | Pointer to float var to store the position on Y axis. nullptr if you dont want to retrieve it. |
| Sint32 CRM64Pro::TileEngine::setLayerAutoScroll | ( | Sint32 | layer, |
| float | xspeed = TE_KEEP_VALUE, | ||
| float | yspeed = TE_KEEP_VALUE ) |
Set the layer AutoScroll speed (in pixels per second).
Changes AutoScroll speed for linked layers according to parallax ratios.
| layer | Selected layer to set autoscroll speed (from 1 to number of allocated layers). |
| xspeed | TE_KEEP_VALUE keeps current X speed. Any other value sets it. |
| yspeed | TE_KEEP_VALUE keeps current Y speed. Any other value sets it. |
Changing speed of others layers. With ratio=0, independent layer.
| Sint32 CRM64Pro::TileEngine::getLayerAutoScroll | ( | Sint32 | layer, |
| float * | xspeed, | ||
| float * | yspeed ) |
Get the layer AutoScroll speed (in pixels per seconds).
| layer | Selected layer to get its current AutoScroll speed (from 1 to number of allocated layers). |
| xspeed | Pointer to float var to store the speed on X axis. nullptr if you dont want to retrieve it. |
| yspeed | Pointer to float var to store the speed on Y axis. nullptr if you dont want to retrieve it. |
| Sint32 CRM64Pro::TileEngine::setLayerMapData | ( | Sint32 | layer, |
| TE_MapData * | map ) |
Assign a mapdata to the given layer.
If the mapdata is already set, it will remove it following resource control policies (see ::eTileEngineResCtrl for further information)
| layer | Selected layer to try to set a new mapdata (from 1 to number of allocated layers) |
| map | Pointer to a valid mapdata: TE_MapData or a derivated one. nullptr to try to remove the existing mapdata. |
| TE_MapData * CRM64Pro::TileEngine::getLayerMapData | ( | Sint32 | layer | ) |
Get current mapdata on the layer.
| layer | Selected layer to try to get its mapdata (from 1 to number of allocated layers). |
| Sint32 CRM64Pro::TileEngine::setLayerOnUpdateEnd | ( | Sint32 | layer, |
| TE_OnLayerEnd | myfunc ) |
Set an event function (onUpdateEnd) to be called when the engine finishes updating the layer.
Use nullptr to remove a previous onUpdateEnd event function.
| layer | Number of layer to set the event function (from 1 to number of allocated layers). |
| myfunc | pointer to your custom event function. |
| TileEngine::TE_OnLayerEnd * CRM64Pro::TileEngine::getLayerOnUpdateEnd | ( | Sint32 | layer | ) |
Get current onUpdateEnd event function if any.
| layer | Selected layer to get current onUpdateEnd event function (from 1 to number of allocated layers). |
| Sint32 CRM64Pro::TileEngine::setLayerOnRenderEnd | ( | Sint32 | layer, |
| TE_OnLayerEnd | myfunc ) |
Set an event function (onRenderEnd) to be called when the engine finishes rendering the layer.
Use nullptr to remove a previous onRenderEnd event function.
| layer | Number of layer to set the event function (from 1 to number of allocated layers). |
| myfunc | pointer to your custom event function. |
| TileEngine::TE_OnLayerEnd * CRM64Pro::TileEngine::getLayerOnRenderEnd | ( | Sint32 | layer | ) |
Get current onRenderEnd event function if any.
| layer | Selected layer to get current onRenderEnd event function (from 1 to number of allocated layers). |
| Sint32 CRM64Pro::TileEngine::getLayerName | ( | Sint32 | layer, |
| string & | sName ) |
Get the layer name.
| layer | Selected layer to get its name (from 1 to number of allocated layers). |
| sName | a string containing the layer name. |
| Sint32 CRM64Pro::TileEngine::setLayerName | ( | Sint32 | layer, |
| const string & | sName ) |
Set a new layer name.
| layer | Selected layer to set its name (from 1 to number of allocated layers). |
| sName | The name to give to the layer e.g. 'layer0'. |
| Sint32 CRM64Pro::TileEngine::setLayerGridColor | ( | Sint32 | layer, |
| Uint32 | iColor ) |
Set the grid color for the base mapdata.
It is used for debugging purposes
| layer | Selected layer to set the grid color (from 1 to number of allocated layers). |
| iColor | packed unsigned int with the color value (RGBA). |
| Sint32 CRM64Pro::TileEngine::screen2LayerCell | ( | Sint32 | layer, |
| Sint32 | sx, | ||
| Sint32 | sy, | ||
| Sint32 * | cx, | ||
| Sint32 * | cy ) |
Convert screen coordinates in to layer cell values.
| layer | Selected layer (from 1 to number of allocated layers). |
| sx | Screen X coordinate (mouse position, etc.). |
| sy | Screen Y coordinate (mouse position, etc.). |
| cx | Point to integer where the Cell X position will be returned if this method call succeed. |
| cy | Point to integer where the Cell Y position will be returned if this method call succeed. |
| Sint32 CRM64Pro::TileEngine::screen2LayerAbsolute | ( | Sint32 | layer, |
| Sint32 | sx, | ||
| Sint32 | sy, | ||
| Sint32 * | px, | ||
| Sint32 * | py ) |
Convert screen coordinates to layer absolute values.
| layer | Selected layer (from 1 to number of allocated layers). |
| sx | Screen X coordinate (mouse position, etc.). |
| sy | Screen Y coordinate (mouse position, etc.). |
| px | Point to integer where the absolute X position will be returned if this method call succeed. |
| py | Point to integer where the absolute Y position will be returned if this method call succeed. |
| Sint32 CRM64Pro::TileEngine::moveLayer | ( | Sint32 | layer, |
| float | x, | ||
| float | y ) |
Move the layer by adding or subtracting the given X/Y values.
Changes position for linked layers according to parallax ratios. Layers with parallax ratio 0.0 are independent.
| layer | Selected layer to move (from 1 to number of allocated layers). |
| x | Float X value, positive or negative. 0 does nothing. |
| y | Float Y value, positive or negative. 0 does nothing. |
| Sint32 CRM64Pro::TileEngine::update | ( | Sint32 | layer = 0 | ) |
Update status of TileEngine.
Only layers with TE_LAYERFLAG_UPDATE flag are processed. Calculates autoscroll and pre-calculations for rendering. Call as part of logic code. Optionally update individual layers. Calls onUpdateEnd event function at end of each layer update if it exists.
| layer | Default 0 updates all layers from 1 (background) to foreground. Any other value updates only that layer. |
| Sint32 CRM64Pro::TileEngine::render | ( | Sint32 | layer = 0, |
| Sint32 | idRes = 0 ) |
Render of visible layers.
Only layers with TE_LAYERFLAG_RENDER flag are processed. Uses positions from update() to render cells. Call as part of graphic update code. Select rendering order by calling with specific layers. Calls onRenderEnd at end of each layer. With TE_LAYERFLAG_SMOOTHSCROLL, interpolates values for smooth scrolling.
| layer | Default 0 processes all layers. Values 1 (background) to foreground process only that layer. |
| idRes | a valid screen. Default tries the default screen. Does not support rendering to an image. |
| Sint32 CRM64Pro::TileEngineMgr::info | ( | Sint32 | iMode = 0 | ) |
Request TileEngine Manager information.
Writes information to the default log.
| iMode | -1 for Manager info only. 0 (default) for Manager and all Objects. A positive TE id for Manager and that specific TileEngine. |
| Sint32 CRM64Pro::TileEngineMgr::create | ( | const string & | sName, |
| Uint32 | iNumLayers = 3 ) |
Create a new TileEngine.
Default viewport is 320x200 starting at (0,0).
| sName | The level name (e.g. 'myLevel'), also used for TileEngine object name. Must be unique and max 64 characters (truncated if longer). |
| iNumLayers | layers to allocate. Default 3. Use allocateLayers() to dynamically change this. |
| Sint32 CRM64Pro::TileEngineMgr::close | ( | Sint32 | idTE | ) |
Close and destroy a TileEngine.
| idTE | 0 for closing all TileEngine objects or a specific TileEngine id. |
| Sint32 CRM64Pro::TileEngineMgr::getNum | ( | ) | const |
Get number of loaded objects.
| Sint32 CRM64Pro::TileEngineMgr::setName | ( | Sint32 | idTE, |
| const string & | sName ) |
Change the object name.
| idTE | TileEngine id. |
| sName | The name (e.g. 'myTE'). Must be unique and max 64 characters (truncated if longer). |
| TileEngine * CRM64Pro::TileEngineMgr::get | ( | Sint32 | idTE = 0 | ) |
Get a pointer to the TileEngine using its handler.
| idTE | TileEngine id. By default it returns the first TileEngine. |