Skip to content

Commit

Permalink
Add Lua Gdi32 clipping support
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurumaker72 committed Jun 2, 2023
1 parent d367f0b commit 9468af0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lua/LuaConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2531,6 +2531,19 @@ int DrawLine(lua_State *L) {
::LineTo(lua_dc, luaL_checknumber(L, 3), luaL_checknumber(L, 4));
return 0;
}
int SetClip(lua_State* L) {
auto lua = GetLuaClass(L);
auto rgn = CreateRectRgn(luaL_checkinteger(L, 1), luaL_checkinteger(L, 2), luaL_checkinteger(L, 1) + luaL_checkinteger(L, 3), luaL_checkinteger(L, 2) + luaL_checkinteger(L, 4));
SelectClipRgn(lua_dc, rgn);
DeleteObject(rgn);
return 0;
}
int ResetClip(lua_State* L) {
Lua* lua = GetLuaClass(L);
SelectClipRgn(lua_dc, NULL);
return 0;
}

int GetGUIInfo(lua_State *L) {
InitializeLuaDC(mainHWND);
lua_newtable(L);
Expand Down Expand Up @@ -3478,6 +3491,8 @@ const luaL_Reg wguiFuncs[] = {
{"line", DrawLine},
{"info", GetGUIInfo},
{"resize", ResizeWindow},
{"setclip", SetClip},
{"resetclip", ResetClip},
{NULL, NULL}
};

Expand Down

0 comments on commit 9468af0

Please sign in to comment.