Advertisement
gocha

BizHawk Color creation function

Aug 13th, 2014
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.30 KB | None | 0 0
  1. function gui.color(r, g, b, a)
  2.   if not a then
  3.     a = 255
  4.   end
  5.  
  6.   r = math.floor(r)
  7.   g = math.floor(g)
  8.   b = math.floor(b)
  9.   a = math.floor(a)
  10.  
  11.   if a > 127 then
  12.     return (r * 65536 + g * 256 + b) - ((256 - a) * 16777216)
  13.   else
  14.     return a * 16777216 + r * 65536 + g * 256 + b
  15.   end
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement