mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 20:35:17 +03:00
[Horus] New Lua LCD functions
This commit is contained in:
parent
1d867a0daa
commit
f7fafc0948
1 changed files with 48 additions and 12 deletions
|
@ -121,6 +121,18 @@ static int luaLcdDrawLine(lua_State *L)
|
|||
int y2 = luaL_checkinteger(L, 4);
|
||||
int pat = luaL_checkinteger(L, 5);
|
||||
int flags = luaL_checkinteger(L, 6);
|
||||
|
||||
if (pat == SOLID) {
|
||||
if (x1 == x2) {
|
||||
lcdDrawSolidVerticalLine(x1, y1, y2-y1+1, flags);
|
||||
return 0;
|
||||
}
|
||||
else if (y1 == y2) {
|
||||
lcdDrawSolidHorizontalLine(x1, y1, x2-x1+1, flags);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
lcdDrawLine(x1, y1, x2, y2, pat, flags);
|
||||
return 0;
|
||||
}
|
||||
|
@ -544,6 +556,27 @@ static int luaLcdDrawCombobox(lua_State *L)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
static int luaLcdSetColor(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
int index = luaL_checkinteger(L, 1);
|
||||
int color = luaL_checkinteger(L, 2);
|
||||
lcdColorTable[index] = color;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int luaRGB(lua_State *L)
|
||||
{
|
||||
if (!luaLcdAllowed) return 0;
|
||||
int r = luaL_checkinteger(L, 1);
|
||||
int g = luaL_checkinteger(L, 2);
|
||||
int b = luaL_checkinteger(L, 3);
|
||||
lua_pushinteger(L, RGB(r, g, b));
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
const luaL_Reg lcdLib[] = {
|
||||
{ "refresh", luaLcdRefresh },
|
||||
{ "clear", luaLcdClear },
|
||||
|
@ -557,7 +590,10 @@ const luaL_Reg lcdLib[] = {
|
|||
{ "drawChannel", luaLcdDrawChannel },
|
||||
{ "drawSwitch", luaLcdDrawSwitch },
|
||||
{ "drawSource", luaLcdDrawSource },
|
||||
#if !defined(COLORLCD)
|
||||
#if defined(COLORLCD)
|
||||
{ "setColor", luaLcdSetColor },
|
||||
{ "RGB", luaRGB },
|
||||
#else
|
||||
{ "getLastPos", luaLcdGetLastPos },
|
||||
{ "drawGauge", luaLcdDrawGauge },
|
||||
{ "drawPixmap", luaLcdDrawPixmap },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue