03-01-2025, 05:54 PM
Hi,
I can't reproduce what you describe. You can disable or enable layers inside raster callbacks, and they keep in that state until you change it. Take into account that setting the type of layer (i.e. tilemaps, bitmap, objects...) automatically enables it.
This variation of the "tutorial" basic example disables and enables the layer mid-frame with expected result:
I can't reproduce what you describe. You can disable or enable layers inside raster callbacks, and they keep in that state until you change it. Take into account that setting the type of layer (i.e. tilemaps, bitmap, objects...) automatically enables it.
This variation of the "tutorial" basic example disables and enables the layer mid-frame with expected result:
Code:
#include "Tilengine.h"
void rasterCallback(int line){
if (line == 128)
TLN_DisableLayer(0);
if (line == 200)
TLN_EnableLayer(0);
}
int main (int argc, char* argv[]) {
TLN_Tilemap tilemap;
int frame = 0;
TLN_Init (400, 240, 1,0,0);
tilemap = TLN_LoadTilemap ("assets/sonic/Sonic_md_fg1.tmx", NULL);
TLN_SetLayer (0, NULL, tilemap);
TLN_SetBGColor (32,32,128);
TLN_CreateWindow (NULL, 0);
TLN_SetRasterCallback(rasterCallback);
while (TLN_ProcessWindow ()) {
TLN_SetLayerPosition (0, frame, 0);
TLN_DrawFrame (0);
frame++;
}
TLN_DeleteTilemap (tilemap);
TLN_Deinit ();
return 0;
}