Tangent128 / luasdl2

A pure C binding of SDL 2.0 for Lua 5.1, Lua 5.2, and LuaJIT.
ISC License
383 stars 73 forks source link

Add surface:mapRGB[A], fix number colors not having an alpha value. #53

Closed Web-eWorks closed 7 years ago

Web-eWorks commented 7 years ago

Added surface:mapRGB / surface:mapRGBA to map a color into the surface-appropriate color representation.

When passed as numbers, color channels are in the form ARGB, for ease of use and backwards compatibility. Also added masking on videoGetColorHex so out-of-range values didn't affect the other channels.

Without these changes, integer colors passed to renderer:setDrawColor (and others) were loosing their alpha channel, causing havoc when used with transparent textures.

Tangent128 commented 7 years ago

Thanks for the fix!