Added love.graphics.reset()
This commit is contained in:
@@ -96,6 +96,10 @@ Returns true if images are set to be horizontally flipped when drawn
|
||||
Set whether images should be horizontally flipped when draw. If `enable` is not
|
||||
passed then this is set to false by default.
|
||||
|
||||
##### love.graphics.reset()
|
||||
Resets the font, color, background color, canvas, blend mode and flip mode to
|
||||
their defaults.
|
||||
|
||||
##### love.graphics.clear([color])
|
||||
Clears the screen (or canvas) to the `color`. If no `color` argument is given
|
||||
then the background color is used.
|
||||
|
||||
@@ -185,6 +185,25 @@ int l_graphics_setFlip(lua_State *L) {
|
||||
}
|
||||
|
||||
|
||||
int l_graphics_reset(lua_State *L) {
|
||||
int (*funcs[])(lua_State*) = {
|
||||
l_graphics_setBackgroundColor,
|
||||
l_graphics_setColor,
|
||||
l_graphics_setBlendMode,
|
||||
l_graphics_setFont,
|
||||
l_graphics_setCanvas,
|
||||
l_graphics_setFlip,
|
||||
NULL,
|
||||
};
|
||||
int i;
|
||||
for (i = 0; funcs[i]; i++) {
|
||||
lua_pushcfunction(L, funcs[i]);
|
||||
lua_call(L, 0, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int l_graphics_clear(lua_State *L) {
|
||||
int color = lua_isnoneornil(L, 1) ? graphics_backgroundColor
|
||||
: luaL_checkint(L, 1);
|
||||
@@ -433,6 +452,7 @@ int luaopen_graphics(lua_State *L) {
|
||||
{ "setCanvas", l_graphics_setCanvas },
|
||||
{ "getFlip", l_graphics_getFlip },
|
||||
{ "setFlip", l_graphics_setFlip },
|
||||
{ "reset", l_graphics_reset },
|
||||
{ "clear", l_graphics_clear },
|
||||
{ "present", l_graphics_present },
|
||||
{ "draw", l_graphics_draw },
|
||||
|
||||
Reference in New Issue
Block a user