mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Issue #262: Add per-sprite colors.
This commit is contained in:
@@ -93,6 +93,25 @@ namespace opengl
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_SpriteBatch_setColor(lua_State * L)
|
||||
{
|
||||
SpriteBatch * t = luax_checkspritebatch(L, 1);
|
||||
|
||||
if (lua_gettop(L) <= 1)
|
||||
t->setColor();
|
||||
else
|
||||
{
|
||||
Color c;
|
||||
c.r = (unsigned char)luaL_checkint(L, 2);
|
||||
c.g = (unsigned char)luaL_checkint(L, 3);
|
||||
c.b = (unsigned char)luaL_checkint(L, 4);
|
||||
c.a = (unsigned char)luaL_optint(L, 5, 255);
|
||||
t->setColor(c);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] = {
|
||||
{ "add", w_SpriteBatch_add },
|
||||
{ "addq", w_SpriteBatch_addq },
|
||||
@@ -100,6 +119,7 @@ namespace opengl
|
||||
{ "bind", w_SpriteBatch_bind },
|
||||
{ "unbind", w_SpriteBatch_unbind },
|
||||
{ "setImage", w_SpriteBatch_setImage },
|
||||
{ "setColor", w_SpriteBatch_setColor },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user