mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Add masking (see issue #211). Only "hard" masks are supported, no
semitransparent ones. --HG-- branch : minor
This commit is contained in:
@@ -144,6 +144,33 @@ namespace opengl
|
||||
return instance->getScissor(L);
|
||||
}
|
||||
|
||||
int w_defineMask(lua_State * L)
|
||||
{
|
||||
// just return the function
|
||||
if (!lua_isfunction(L, 1))
|
||||
return luaL_typerror(L, 1, "function");
|
||||
lua_settop(L, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_setMask(lua_State * L)
|
||||
{
|
||||
// no argument -> clear mask
|
||||
if (lua_isnoneornil(L, 1)) {
|
||||
instance->discardMask();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!lua_isfunction(L, 1))
|
||||
return luaL_typerror(L, 1, "mask");
|
||||
|
||||
instance->defineMask();
|
||||
lua_call(L, lua_gettop(L) - 1, 0); // call mask(...)
|
||||
instance->useMask();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_newImage(lua_State * L)
|
||||
{
|
||||
// Convert to File, if necessary.
|
||||
@@ -1020,6 +1047,9 @@ namespace opengl
|
||||
{ "setScissor", w_setScissor },
|
||||
{ "getScissor", w_getScissor },
|
||||
|
||||
{ "defineMask", w_defineMask },
|
||||
{ "setMask", w_setMask },
|
||||
|
||||
{ "point", w_point },
|
||||
{ "line", w_line },
|
||||
{ "triangle", w_triangle },
|
||||
|
||||
Reference in New Issue
Block a user