Documentation: Fix raylib code samples (draw_tile)
This PR refers to the page Creating a map renderer from scratch. The draw_tile() implementation there is faulty and leads to a black screen.
Here are my proposed fixes:
- Fixed
DrawTextureRec()call by derefingimageas the function requires aTexture2Dvariable instead of aTexture2D*pointer - Fixed the Alpha issue: raylib's
Colorstruct works with 4uintfields (r, g, b, a). Passing opacity directly will result in argba(1,1,1,1)color (black). AdoptedWHITEas default and appliedopacityas its alpha
The above was tested with most recent Raylib's version: 3.7.0
Hey @nawarian, I abstracted the raylib sample into its own wrapper library to help integration: https://github.com/robloach/raylib-tmx
The other change that was helpful is over at https://github.com/baylej/tmx/pull/58
Thank you for this fix, the raylib example needs to be fixed as well before I merge this PR. I will do it if you don't have the time, or have lost interest.
Hello @baylej ; Please go ahead, it would take me another few weeks to find time for it.
Thanks!