tmx icon indicating copy to clipboard operation
tmx copied to clipboard

Documentation: Fix raylib code samples (draw_tile)

Open nawarian opened this issue 4 years ago • 3 comments

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:

  1. Fixed DrawTextureRec() call by derefing image as the function requires a Texture2D variable instead of a Texture2D* pointer
  2. Fixed the Alpha issue: raylib's Color struct works with 4 uint fields (r, g, b, a). Passing opacity directly will result in a rgba(1,1,1,1) color (black). Adopted WHITE as default and applied opacity as its alpha

The above was tested with most recent Raylib's version: 3.7.0

nawarian avatar Jul 20 '21 17:07 nawarian

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

RobLoach avatar Aug 28 '21 01:08 RobLoach

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.

baylej avatar Jan 26 '22 17:01 baylej

Hello @baylej ; Please go ahead, it would take me another few weeks to find time for it.

Thanks!

nawarian avatar Jan 26 '22 17:01 nawarian