VERSIÓ 1.3.12

- [FIX] La paleta per defecte era tota transparent
- [NEW] draw.rrect() i draw.rrectf()
This commit is contained in:
2025-11-27 17:18:07 +01:00
parent 33d7cc3b6d
commit 839c1e82eb
6 changed files with 139 additions and 20 deletions

24
lua.cpp
View File

@@ -429,6 +429,28 @@ extern "C" {
return 0;
}
static int cpp_draw_roundrect(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);
int r = luaL_optnumber(L, 5, 4);
uint8_t color = luaL_checkinteger(L, 6);
roundrect(x, y, w, h, r, color);
return 0;
}
static int cpp_draw_roundrectfill(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);
int r = luaL_optnumber(L, 5, 4);
uint8_t color = luaL_checkinteger(L, 6);
roundrectfill(x, y, w, h, r, color);
return 0;
}
static int cpp_draw_oval(lua_State *L) {
int x0 = luaL_checknumber(L, 1);
int y0 = luaL_checknumber(L, 2);
@@ -924,6 +946,8 @@ void push_lua_funcs() {
lua_pushcfunction(L,cpp_draw_rectfill); lua_setfield(L, -2, "rectf");
lua_pushcfunction(L,cpp_draw_circ); lua_setfield(L, -2, "circ");
lua_pushcfunction(L,cpp_draw_circfill); lua_setfield(L, -2, "circf");
lua_pushcfunction(L,cpp_draw_roundrect); lua_setfield(L, -2, "rrect");
lua_pushcfunction(L,cpp_draw_roundrectfill); lua_setfield(L, -2, "rrectf");
lua_pushcfunction(L,cpp_draw_oval); lua_setfield(L, -2, "oval");
lua_pushcfunction(L,cpp_draw_ovalfill); lua_setfield(L, -2, "ovalf");
lua_pushcfunction(L,cpp_draw_pattern); lua_setfield(L, -2, "pattern");