Add object layer support#15
Conversation
|
While I'm not 100% happy with rendering the debug from the library like this, it's certainly the most performant idea... besides the cost of having to calculate the lines every tick, you'd also have to build and flatten an array, so it'd be heavier on memory too, methinks... |
|
To expand on what you said in #14 about breaking off the rendering code to its own library and making this a simple, lightweight API for the parsed XML files, I like that idea. I'm picturing a When I get around to collisions I'll think about a modular implementation for that as well. What do you say we merge this and discuss what to extract into a separate rendering library in a different issue? Let me know if you'd like anything else on this pull- I want to use Tiled in an eventual production DR game, so you can expect my continued help with some of the other things we've discussed. EDIT: Whoops, found an off-by-one error, fixed here in the last force push. |
|
So I decided to test the limits of how many polygons you can draw in this manner and as it turns out, my fears about rendering too many line primitives proved to be well-founded 😞 As few as 6 polygons on-screen tanked my FPS to ~15. I'm not sure if there's a way around this while keeping the library compatible with the standard license. This would be easy with triangle primitives, but alas, it's a sacrifice we'll have to make. This code is soon-to-be extracted, so it won't be this library's problem anyway. ¯\_(ツ)_/¯ The fill has been removed for polygons. |
This was causing a massive performance hit, unfortunately. Rebased onto the color corrections that you made earlier.
|
Oh, while I was in the process of merging I missed your new commits. I made some tweaks in master, mostly adding usage of |
|
Ahhhh, I had found a bug and saw conflicts so I just rebased it on top of the color fixes that you had made, haha. I totally missed that you had color conversions built-in already. |
|
Yeah, I remembered what you had said about being able to tint sprites, which led me to realize that I was caching the first color that was used 😓 |
The first color that was loaded was being cached. Fixed by caching a white circle sprite and coloring it to order.
|
Thanks a lot, this is awesome changes :) |
Yep, I was thinking about the same.
I would rather focus on adding other Tiled TMX features first, and then focus on rendering. But it is just my plans :)
Thanks a lot! I would love to see your game :) |
This commit adds an API for Tiled's object layers. It adds 2 classes:
TiledObject- Represents a single objectObjectLayer- A layer of one or moreTiledObjectsrefs #14