Vertical callback or per pixel callback : I understand/How does Tilengine work? - Printable Version +- Tilengine - The 2D retro graphics engine forum (http://tilengine.org/forum) +-- Forum: English forums (http://tilengine.org/forum/forumdisplay.php?fid=3) +--- Forum: Support (http://tilengine.org/forum/forumdisplay.php?fid=7) +--- Thread: Vertical callback or per pixel callback : I understand/How does Tilengine work? (/showthread.php?tid=2299) |
RE: Vertical callback or per pixel callback : I understand/How does Tilengine work? - System64 - 08-27-2023 (08-27-2023, 03:10 AM)megamarc Wrote: Hi! Hi! You were not rude at all, I totally understand. We can't know everything about everything. I just had the idea "Hey what if I try to do something similar to Tilengine? It probably would be a good experience and I probably can learn a lot of things!" That makes sense for the fact that one layer can have one mode at a time. Thanks for accepting the feature idea! I do some improvements to the Nim bindings for Tilengine and I thought it was a necessary feature to avoid out of bounds errors. I will compile the latest commit and tell you if it works. I'm also working on a game for my final school work now. And guess what I'm using for graphics? Tilengine! RE: Vertical callback or per pixel callback : I understand/How does Tilengine work? - megamarc - 08-29-2023 Hi! I've updated Tilengine binaries at itch.io. In addition to the initial black screen fix, I've implemented TLN_GetPaletteNumColors() following your suggestion. I understand the Nim binding may need this number, but if you passed a color index greater than available to a given palette function, it would fail setting TLN_ERR_IDX_PALETTE global error without crashing. Cool to know you're going to use Tilengine in your school project! What are you stidying? What kind of game prototype are you planning to build? RE: Vertical callback or per pixel callback : I understand/How does Tilengine work? - System64 - 08-30-2023 (08-29-2023, 09:41 PM)megamarc Wrote: Hi! Hi! Thanks for the update! I will try this! I study programming and I'm working on an online multiplayer Shoot 'Em Up right now. Sometimes it's fun, sometimes it's pain. It's quite painful for now because in title screen and lobby, I use Layer 1 and 2, and in a level I don't use Layer 2. At each room initialization (including title screen and lobby) I clean all the tilemaps with a NULL check to avoid a double free, however, when I don't use this Layer 2, I have a segfault unless I remove the code that cleans tilemap (BAD PRACTICE! LEADS TO MEMORY LEAKS!) Is there a manipulation I need to do before cleaning tilemaps? Especially when I don't use a layer? Thanks for your answer! Edit : it often happens when I go to fullscreen mode. RE: Vertical callback or per pixel callback : I understand/How does Tilengine work? - megamarc - 08-30-2023 Hi, As a general rule, there are two things to take into account when dealing with resources: 1. Don't delete a resource you don't own. You own a resource when you explicitly create, load or clone it. You don't own a resource that has been chain-loaded and is a child of another resource. You should not do this: Code: TLN_Tilemap tilemap = TLN_LoadTilemap("tilemap.tmx", NULL); // load tilemap, you own it 2. Don't delete a resource that is currently assigned to the renderer. Also applies to child resources, when you delete an owned resource, all of its owned child resources get deleted with it Code: TLN_Tileset tileset = TLN_LoadTileset("tileset.tsx"); // loads tileset RE: Vertical callback or per pixel callback : I understand/How does Tilengine work? - System64 - 08-30-2023 (08-30-2023, 06:18 PM)megamarc Wrote: Hi, Hi! Makes sense! Now I only delete tilemaps from layers, I don't touch their tilesets nor their palettes and so on. so I just can do TLN_Tilemap tilemap = TLN_GetLayerTilemap(myLayer); TLN_DeleteTilemap(tilemap); tilemap = NULL; ? RE: Vertical callback or per pixel callback : I understand/How does Tilengine work? - megamarc - 08-30-2023 Hi! You can do this as long as you first call: Code: TLN_DisableLayer(myLayer) If not, you'll be deleting a resource that is attached to an active layer, that will cause a segfault on the next render. RE: Vertical callback or per pixel callback : I understand/How does Tilengine work? - System64 - 08-30-2023 (08-30-2023, 08:53 PM)megamarc Wrote: Hi! I do that before deleting its tilemap. It works flawlessly... Until I go to fullscreen mode RE: Vertical callback or per pixel callback : I understand/How does Tilengine work? - megamarc - 08-31-2023 Hi, To debug this particular issue I should have acces to full project (code with assets). You can send it via PM if you want RE: Vertical callback or per pixel callback : I understand/How does Tilengine work? - System64 - 09-01-2023 (08-31-2023, 07:09 PM)megamarc Wrote: Hi, Is it a problem if the code is written in Nim? RE: Vertical callback or per pixel callback : I understand/How does Tilengine work? - megamarc - 09-01-2023 Unfortunately yes, I can only give support for Tilengine itself, not for other bindings. But I can take a look, maybe I can see something suspicious |