- [FIX] clip(x,y,w,h) works as expected.

- [NEW] clip() with no arguments resets clipping region.
- [FIX] cls() respects clipping region (but now it's slower)
- [FIX] pset's and pget now respect clipping region correctly
This commit is contained in:
2023-07-04 19:50:13 +02:00
parent 38e209fa76
commit 58f4845746
3 changed files with 30 additions and 14 deletions

14
lua.cpp
View File

@@ -259,11 +259,15 @@ extern "C" {
}
static int cpp_clip(lua_State *L) {
int x = luaL_checknumber(L, 1);
int y = luaL_checknumber(L, 2);
int w = luaL_checknumber(L, 3);
int h = luaL_checknumber(L, 4);
clip(x, y, w, h);
if (lua_gettop(L) == 0) {
clip();
} else {
int x = luaL_checknumber(L, 1);
int y = luaL_checknumber(L, 2);
int w = luaL_checknumber(L, 3);
int h = luaL_checknumber(L, 4);
clip(x, y, w, h);
}
return 0;
}