Tangent128 / luasdl2

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

General Fixes + Refactor Color Handling #62

Closed Web-eWorks closed 7 years ago

Web-eWorks commented 7 years ago

Couple of fixes / minor features:

I unified how the library takes colors from Lua code, and deprecated videoGetColorHex. In theory, all hex-encoded values taken from Lua are interpreted as ARGB8888, without user code having to do anything.

The only place where videoGetColorHex was being used was in surface:fillRect/surface:fillRects, and there's handy access to SDL_MapRGBA() and the needed pixel format pointer there.

Web-eWorks commented 7 years ago

And done. Incidentally, I tested this on a couple of different surface types (BGRA4444, BGR565, BGR888, ABGR/BGRA/ARGB/RGBA8888), and color handling stayed the same (with the obvious difference in alpha channel presence, of course).