Re: Blank Window (Tile Engine)
- Posted by Icy_Viking Apr 25, 2023
- 661 views
ghaberek said...
As a test, I ported Tutorial.c to Euphoria and got the same problem. When I checked the result of TLN_SetLayerTilemap() it was returning zero, so I grabbed the last error and printed it out:
atom tilemap = TLN_LoadTilemap( "assets/sonic/Sonic_md_fg1.tmx" ) if not TLN_SetLayerTilemap( 0, tilemap ) then integer errno = TLN_GetLastError() sequence errmsg = TLN_GetErrorString( errno ) printf( 2, "Error %d: %s\n", {errno,errmsg} ) end if
Tilengine v2.14.0 64-bit built Feb 1 2023 19:08:33 Error 6: Invalid Tileset reference
I think you need to all of the assets as they seem to reference each other. You'd probably have to open them with Tiled to see what-references-what since the content is all base64/zlib encoded.
Once I extracted the entire assets directory and updated the path to "assets/sonic/Sonic_md_fg1.tmx" your demo worked correctly. At the very least, you probably need the contents of the sonic folder.
-Greg
You were right Greg. At the very least I needed the sonic folder and it showed up.
Updated example
without warning without type_check include std/ffi.e include tilengine.e TLN_Init(400,240,1,0,0) object fg = TLN_LoadTilemap("sonic/Sonic_md_fg1.tmx",NULL) ? fg if fg = -1 then puts(1,"Failed to load background!\n") abort(0) end if TLN_SetLayerTilemap(0,fg) TLN_CreateWindow(NULL,0) while TLN_ProcessWindow() do TLN_DrawFrame(0) end while TLN_DeleteTilemap(fg) TLN_DeleteWindow() TLN_Deinit()