OpenNefia
OpenNefia copied to clipboard
Remove color argument to calls to Draw and asset methods
They cause unnecessary table allocations, and you can just use Draw.set_color() instead for slight performance gains from not having to set the color between multiple assets each time. It would be better if we used Draw.set_color() as the blessed way of setting colors. Also we should remove the option of passing a table argument to Draw.set_color() as well.
This really needs to be done before the API gets too popular.
Actually, being able to pass a table to Draw.set_color() is very useful when used with the theme table returned by UiTheme.load(), so you could just do Draw.set_color(self.t.base.text_color). The real issue is with code that will allocate a table every frame because a table color constant was not bound to an upvalue outside :draw().