Basic setup and management. More...



TLNAPI TLN_Engine TLN_Init (int hres, int vres, int numlayers, int numsprites, int numanimations)
 Initializes the graphic engine in 32 bpp pixel format. More...
TLNAPI void TLN_Deinit (void)
 Deinitialises current engine context and frees used resources.
TLNAPI bool TLN_DeleteContext (TLN_Engine context)
 Deletes explicit context. More...
TLNAPI bool TLN_SetContext (TLN_Engine context)
 Sets current engine context. More...
TLNAPI TLN_Engine TLN_GetContext (void)
 Returns the current engine context.
TLNAPI int TLN_GetWidth (void)
 Returns the width in pixels of the framebuffer. More...
TLNAPI int TLN_GetHeight (void)
 Returns the height in pixels of the framebuffer. More...
TLNAPI int TLN_GetBPP (void)
 Returns the pixel format of the framebuffer. More...
TLNAPI uint32_t TLN_GetNumObjects (void)
 Returns the number of objets used by the engine so far. More...
TLNAPI uint32_t TLN_GetUsedMemory (void)
 Returns the total amount of memory used by the objects. More...
TLNAPI uint32_t TLN_GetVersion (void)
 Retrieves Tilengine dll version. More...
TLNAPI int TLN_GetNumLayers (void)
 Returns the number of layers specified during initialisation. More...
TLNAPI int TLN_GetNumSprites (void)
 Returns the number of sprites specified during initialisation. More...
TLNAPI void TLN_SetBGColor (uint8_t r, uint8_t g, uint8_t b)
 Sets the background color. More...
TLNAPI bool TLN_SetBGColorFromTilemap (TLN_Tilemap tilemap)
 Sets the background color from a Tilemap defined color. More...
TLNAPI void TLN_DisableBGColor (void)
 Disales background color rendering. If you know that the last background layer will always cover the entire screen, you can disable it to gain some performance. More...
TLNAPI bool TLN_SetBGBitmap (TLN_Bitmap bitmap)
 Sets a static bitmap as background. More...
TLNAPI bool TLN_SetBGPalette (TLN_Palette palette)
 Changes the palette for the background bitmap. More...
TLNAPI void TLN_SetRenderTarget (uint8_t *data, int pitch)
 Sets the output surface for rendering. More...
TLNAPI void TLN_UpdateFrame (int time)
 Draws the frame to the previously specified render target. More...
TLNAPI void TLN_BeginFrame (int time)
 Starts active rendering of the current frame. More...
TLNAPI bool TLN_DrawNextScanline (void)
 Draws the next scanline of the frame started with TLN_BeginFrame() or TLN_BeginWindowFrame() More...
TLNAPI void TLN_SetLoadPath (const char *path)
 Sets base path for TLN_LoadXXX functions. More...
TLNAPI void TLN_SetCustomBlendFunction (TLN_BlendFunction)
 Sets custom blend function to use when BLEND_CUSTOM mode is selected. More...
TLNAPI void TLN_SetLogLevel (TLN_LogLevel log_level)
 Sets logging level for current instance. More...

Function Documentation

TLNAPI TLN_Engine TLN_Init ( int  hres,
int  vres,
int  numlayers,
int  numsprites,
int  numanimations 
hreshorizontal resolution in pixels
vresvertical resolution in pixels
numlayersnumber of layers
numspritesnumber of sprites
numanimationsnumber of animations

Performs initialisation of the main engine, creates the viewport with the specified dimensions and allocates the number of layers, sprites and animation slots

TLNAPI bool TLN_DeleteContext ( TLN_Engine  context)
contextcontext reference to delete
TLNAPI bool TLN_SetContext ( TLN_Engine  context)
contextTLN_Engine object to set as current context, returned by TLN_Init()
true if success or false if wrong context is supplied
TLNAPI int TLN_GetWidth ( void  )
TLNAPI int TLN_GetHeight ( void  )
TLNAPI int TLN_GetBPP ( void  )
See also
TLNAPI uint32_t TLN_GetNumObjects ( void  )
The objects is the total amount of tilesets, tilemaps, spritesets, palettes or sequences combined
See also
TLNAPI uint32_t TLN_GetUsedMemory ( void  )
TLNAPI uint32_t TLN_GetVersion ( void  )
Returns a 32-bit integer containing three packed numbers: bits 23:16 -> major version bits 15: 8 -> minor version bits 7: 0 -> bugfix revision
Compare this number with the TILENGINE_HEADER_VERSION macro to check that both versions match!
TLNAPI int TLN_GetNumLayers ( void  )
See also
TLNAPI int TLN_GetNumSprites ( void  )
See also
TLNAPI void TLN_SetBGColor ( uint8_t  r,
uint8_t  g,
uint8_t  b 
rred component (0-255)
ggreen component (0-255)
bblue component (0-255)

The background color is the color of the pixel when there isn't any layer or sprite at that position.

This funcion can be called during a raster callback to create gradient backgrounds
TLNAPI bool TLN_SetBGColorFromTilemap ( TLN_Tilemap  tilemap)
tilemapReference to the tilemap with the background color to set
TLNAPI void TLN_DisableBGColor ( void  )
TLNAPI bool TLN_SetBGBitmap ( TLN_Bitmap  bitmap)
bitmapReference to bitmap for the background. Set NULL to disable

Sets an optional bitmap instead of a solid color where there is no layer or sprite. Unlike tilemaps or sprites, this bitmap cannot be moved and has no transparency

See also
TLNAPI bool TLN_SetBGPalette ( TLN_Palette  palette)
paletteReference to palette
See also
TLNAPI void TLN_SetRenderTarget ( uint8_t *  data,
int  pitch 
dataPointer to the start of the target framebuffer
pitchNumber of bytes per each scanline of the framebuffer

Sets the output surface for rendering. Tilengine doesn't provide a windowing or hardware video access. The application is responsible of allocating and maintaining the surface where tilengine does the rendering. It can be a SDL surface, a locked DirectX surface, an OpenGL texture, or whatever the application has access to.

The render target pixel format must be 32 bits RGBA
See also
TLNAPI void TLN_UpdateFrame ( int  time)
timetimestamp for animation control
the timestamp value meaning is application defined, but its units must match the same used in the sequences xml file. It usually is the frame number or millisecond count
See also
TLNAPI void TLN_BeginFrame ( int  time)
timeTimestamp value
See also
TLN_DrawNextScanline(), TLN_BeginWindowFrame(), TLN_EndWindowFrame()
TLNAPI bool TLN_DrawNextScanline ( void  )
Use this function in conjunction with TLN_BeginFrame() (custom render target) or TLN_BeginWindoFrame() and TLN_EndWindowFrame() (built-in window) for active rendering without callbacks.
true if there are still scanlines to draw or false when the frame is complete
TLNAPI void TLN_SetLoadPath ( const char *  path)
pathBase path. Files will load at path/filename. Can be NULL
TLNAPI void TLN_SetCustomBlendFunction ( uint8_t(*)(uint8_t src, uint8_t dst)  blend_function)
blend_functionpointer to a user-provided function that takes two parameters: source component intensity, destination component intensity, and returns the desired intensity. This function is called for each RGB component when blending is enabled
This function is not called in realtime, but its result is precomputed into a look-up table when TLN_SetCustomBlendFunction() is called, so the performance impact is minimal, just as low as the other built-in blending modes
See also
TLNAPI void TLN_SetLogLevel ( TLN_LogLevel  log_level)
log_levelvalue to set, member of the TLN_LogLevel enumeration