This change switches from string-indexed colors for numeric-indexed.
{ r = 0, g = 0, b = 0 }
-- becomes
{ 0, 0, 0 }
ROT.Color is now used statically, as in rot.js, instead of needing to be instantiated (it can still be instantiated, but there's no reason to do that). Fixed some functions that were variadic in rot.js to also be variadic here, instead of taking a table-of-tables as a second argument.
Also converted the relevant Jasmine tests for Busted, and fixed things up so all tests pass. This was the main motivation for the change; I wanted to use something as close as possible to the existing tests. This change should also improve performance in some parts (no more pairs, shared cache) and makes colors slightly more convenient to define.
Kept colon instead of dot notation for symmetry with ROT.RNG, but could be changed to dot notation to reinforce the idea that it's static. That would also make it suitable as a prototype for color objects, since almost every function takes a color as its first parameter. Might be something to consider, anyway.
This change switches from string-indexed colors for numeric-indexed.
ROT.Color is now used statically, as in rot.js, instead of needing to be instantiated (it can still be instantiated, but there's no reason to do that). Fixed some functions that were variadic in rot.js to also be variadic here, instead of taking a table-of-tables as a second argument.
Also converted the relevant Jasmine tests for Busted, and fixed things up so all tests pass. This was the main motivation for the change; I wanted to use something as close as possible to the existing tests. This change should also improve performance in some parts (no more
pairs
, shared cache) and makes colors slightly more convenient to define.Kept colon instead of dot notation for symmetry with ROT.RNG, but could be changed to dot notation to reinforce the idea that it's static. That would also make it suitable as a prototype for color objects, since almost every function takes a color as its first parameter. Might be something to consider, anyway.