mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
luainstance: allow any color for PaintBox, disable debug
This commit is contained in:
committed by
M. Liebmann
parent
a73dfbb2c5
commit
ef512f897a
@@ -30,6 +30,10 @@
|
|||||||
|
|
||||||
#include "luainstance.h"
|
#include "luainstance.h"
|
||||||
|
|
||||||
|
/* the magic color that tells us we are using one of the palette colors */
|
||||||
|
#define MAGIC_COLOR 0x42424200
|
||||||
|
#define MAGIC_MASK 0xFFFFFF00
|
||||||
|
|
||||||
struct table_key {
|
struct table_key {
|
||||||
const char *name;
|
const char *name;
|
||||||
long code;
|
long code;
|
||||||
@@ -123,16 +127,16 @@ static void set_lua_variables(lua_State *L)
|
|||||||
/* list of colors, exported e.g. as COL['INFOBAR_SHADOW'] */
|
/* list of colors, exported e.g. as COL['INFOBAR_SHADOW'] */
|
||||||
static table_key colorlist[] =
|
static table_key colorlist[] =
|
||||||
{
|
{
|
||||||
{ "COLORED_EVENTS_CHANNELLIST", COL_COLORED_EVENTS_CHANNELLIST },
|
{ "COLORED_EVENTS_CHANNELLIST", MAGIC_COLOR | (COL_COLORED_EVENTS_CHANNELLIST) },
|
||||||
{ "COLORED_EVENTS_INFOBAR", COL_COLORED_EVENTS_INFOBAR },
|
{ "COLORED_EVENTS_INFOBAR", MAGIC_COLOR | (COL_COLORED_EVENTS_INFOBAR) },
|
||||||
{ "INFOBAR_SHADOW", COL_INFOBAR_SHADOW },
|
{ "INFOBAR_SHADOW", MAGIC_COLOR | (COL_INFOBAR_SHADOW) },
|
||||||
{ "INFOBAR", COL_INFOBAR },
|
{ "INFOBAR", MAGIC_COLOR | (COL_INFOBAR) },
|
||||||
{ "MENUHEAD", COL_MENUHEAD },
|
{ "MENUHEAD", MAGIC_COLOR | (COL_MENUHEAD) },
|
||||||
{ "MENUCONTENT", COL_MENUCONTENT },
|
{ "MENUCONTENT", MAGIC_COLOR | (COL_MENUCONTENT) },
|
||||||
{ "MENUCONTENTDARK", COL_MENUCONTENTDARK },
|
{ "MENUCONTENTDARK", MAGIC_COLOR | (COL_MENUCONTENTDARK) },
|
||||||
{ "MENUCONTENTSELECTED", COL_MENUCONTENTSELECTED },
|
{ "MENUCONTENTSELECTED", MAGIC_COLOR | (COL_MENUCONTENTSELECTED) },
|
||||||
{ "MENUCONTENTINACTIVE", COL_MENUCONTENTINACTIVE },
|
{ "MENUCONTENTINACTIVE", MAGIC_COLOR | (COL_MENUCONTENTINACTIVE) },
|
||||||
{ "BACKGROUND", COL_BACKGROUND },
|
{ "BACKGROUND", MAGIC_COLOR | (COL_BACKGROUND) },
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -215,7 +219,8 @@ static void set_lua_variables(lua_State *L)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DBG printf
|
//#define DBG printf
|
||||||
|
#define DBG(...)
|
||||||
|
|
||||||
#define lua_boxpointer(L, u) \
|
#define lua_boxpointer(L, u) \
|
||||||
(*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
|
(*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
|
||||||
@@ -384,7 +389,8 @@ int CLuaInstance::PaintBox(lua_State *L)
|
|||||||
if (h < 0 || y + h > W->fbwin->dy)
|
if (h < 0 || y + h > W->fbwin->dy)
|
||||||
h = W->fbwin->dy - y;
|
h = W->fbwin->dy - y;
|
||||||
/* use the color constants */
|
/* use the color constants */
|
||||||
c = CFrameBuffer::getInstance()->realcolor[c & 0xff];
|
if ((c & MAGIC_MASK) == MAGIC_COLOR)
|
||||||
|
c = CFrameBuffer::getInstance()->realcolor[c & 0x000000ff];
|
||||||
W->fbwin->paintBoxRel(x, y, w, h, c, radius, corner);
|
W->fbwin->paintBoxRel(x, y, w, h, c, radius, corner);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -438,6 +444,7 @@ int CLuaInstance::RenderString(lua_State *L)
|
|||||||
utf8 = luaL_checkint(L, 9);
|
utf8 = luaL_checkint(L, 9);
|
||||||
if (f >= FONT_TYPE_COUNT || f < 0)
|
if (f >= FONT_TYPE_COUNT || f < 0)
|
||||||
f = SNeutrinoSettings::FONT_TYPE_MENU;
|
f = SNeutrinoSettings::FONT_TYPE_MENU;
|
||||||
|
c &= 0x000000FF; /* TODO: colors that are not in the palette? */
|
||||||
W->fbwin->RenderString(g_Font[f], x, y, w, text, c, boxh, utf8);
|
W->fbwin->RenderString(g_Font[f], x, y, w, text, c, boxh, utf8);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user