Tilengine API reference

Welcome to the Tilengine reference! This document is still somewhat basic and needs further work, but here you'll find how to use it for your productions.


Tilengine uses eight types of elements, arranged in two groups:

The following diagram shows all the elements: blue ones the left are the static elements, whereas green ones on the right are dynamic assets. This diagram also shows the relationships between them.

The dashed lines between Layer-Palette and Sprite-Palette means that this relationship is implicit, it isn't needed to be made explicitly. As tilesets and spritesets have a palette, assigning a layer to a tileset or a sprite to a spriteset automatically assigns its default palette too.

Functions by category

Setup & run

This section shows the basic functions to initialise, manage and query Tilengine. Read at least the functions TLN_Init, TLN_SetRenderTarget and TLN_UpdateFrame

Windowing & user input

Tilengine is designed to act as a back-end renderer for other gaming environments, but it has a built-in windowing system for easy setup and testing without having to rely on user provided components. Read at lest the functions TLN_CreateWindow, TLN_ProcessWindow, TLN_DrawFrame and TLN_GetInput (for user input)


Layers represent the scrolling planes (or backgrounds) composed of square tiles. A layer must be assigned a Tileset, a Tilemap and optionally a Palette. Read at least the functions TLN_SetLayer and TLN_SetLayerPosition


Sprites represent the movable objects that are not part of the backgrounds and where the gameplay occurs. A sprite must be assigned a Spriteset and optionally a Palette. Read at least the functions TLN_ConfigSprite, TLN_SetSpritePicture and TLN_SetSpritePosition.


Animations represent the built-in sequencers that play sequences. An animation must be assigned a Sequence and one of the following: a Layer (for tile animation), a Sprite (for sprite animation) or a Palette (for color animation). Read at least the functions TLN_SetSpriteAnimation, TLN_SetTilemapAnimation and TLN_SetPaletteAnimation


Tilesets are the building blocks of the backgrounds, the individual tiles themselves packed together. They are loaded at runtime from Tiled tsx files with the TLN_LoadTileset function


Tilemaps are a gird layout of tiles (from a tileset) that form a background. They are loaded at runtime from Tiled tmx files with the TLN_LoadTilemap function


Spritesets are collections of related individual images for sprites grouped together inside a big picture, for example all the animation frames of the main character. They are loaded at runtime from png/txt pairs with the TLN_LoadSpriteset function


Palettes are the color tables used by the graphics in layers and sprites. They can be loaded at runtime from standard .act files with the function TLN_LoadPalette, retrieved from tilesets with TLN_GetTilesetPalette or from spritesets with TLN_GetSpritesetPalette


A sequence is a serie of frames played in succession at a given speed by an animation. They can be loaded at runtime from .sqx files (xml) with the TLN_LoadSequencePack function.