- [NEW] view(x,y,w,h) Creates a clipped viewport that also translates origin.

-[NEW] view() Resets the viewport to all the window.
This commit is contained in:
2023-07-04 23:03:19 +02:00
parent 0a92e29aa3
commit 584b65041c
4 changed files with 36 additions and 2 deletions

14
lua.cpp
View File

@@ -278,6 +278,19 @@ extern "C" {
return 0;
}
static int cpp_view(lua_State *L) {
if (lua_gettop(L) == 0) {
view();
} 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);
view(x, y, w, h);
}
return 0;
}
static int cpp_circ(lua_State *L) {
int x = luaL_checknumber(L, 1);
int y = luaL_checknumber(L, 2);
@@ -831,6 +844,7 @@ void push_lua_funcs() {
lua_pushcfunction(L,cpp_print); lua_setglobal(L, "prnt");
lua_pushcfunction(L,cpp_clip); lua_setglobal(L, "clip");
lua_pushcfunction(L,cpp_camera); lua_setglobal(L, "camera");
lua_pushcfunction(L,cpp_view); lua_setglobal(L, "view");
lua_pushcfunction(L,cpp_circ); lua_setglobal(L, "circ");
lua_pushcfunction(L,cpp_circfill); lua_setglobal(L, "circfill");
lua_pushcfunction(L,cpp_oval); lua_setglobal(L, "oval");