Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Bug?] Disable Layer and Raster Callbacks
#3
(03-01-2025, 05:54 PM)megamarc Wrote: 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:

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;
}

Oh so that was intentional, sorry.
However it seems I have a more serious bug. Did you already tried to load an objectList from a TMX file? I have no issues under Linux, but it crashes on Windows, saying that I access invalid memory, with C# at least.
Reply


Messages In This Thread
RE: [Bug?] Disable Layer and Raster Callbacks - by System64 - 03-06-2025, 08:23 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)