mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 17:01:08 +02:00
CLuaInstance: Add script function paintVLine() & paintHLine()
- Set Lua api version to 1.16
Origin commit data
------------------
Branch: ni/coolstream
Commit: 482cf41adf
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2015-11-27 (Fri, 27 Nov 2015)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -558,6 +558,8 @@ const luaL_Reg CLuaInstance::methods[] =
|
||||
{
|
||||
{ "GetRevision", CLuaInstance::GetRevision },
|
||||
{ "PaintBox", CLuaInstance::PaintBox },
|
||||
{ "paintHLine", CLuaInstance::paintHLineRel },
|
||||
{ "paintVLine", CLuaInstance::paintVLineRel },
|
||||
{ "saveScreen", CLuaInstance::saveScreen },
|
||||
{ "restoreScreen", CLuaInstance::restoreScreen },
|
||||
{ "deleteSavedScreen", CLuaInstance::deleteSavedScreen },
|
||||
@@ -783,6 +785,64 @@ int CLuaInstance::PaintBox(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CLuaInstance::paintHLineRel(lua_State *L)
|
||||
{
|
||||
int x, y, dx;
|
||||
unsigned int c;
|
||||
|
||||
CLuaData *W = CheckData(L, 1);
|
||||
if (!W || !W->fbwin)
|
||||
return 0;
|
||||
x = luaL_checkint(L, 2);
|
||||
dx = luaL_checkint(L, 3);
|
||||
y = luaL_checkint(L, 4);
|
||||
|
||||
#if HAVE_COOL_HARDWARE
|
||||
c = luaL_checkunsigned(L, 5);
|
||||
#else
|
||||
/* luaL_checkint does not like e.g. 0xffcc0000 on powerpc (returns INT_MAX) instead */
|
||||
c = (unsigned int)luaL_checknumber(L, 5);
|
||||
#endif
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
if (dx < 0 || x + dx > W->fbwin->dx)
|
||||
dx = W->fbwin->dx - x;
|
||||
checkMagicMask(c);
|
||||
W->fbwin->paintHLineRel(x, dx, y, c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CLuaInstance::paintVLineRel(lua_State *L)
|
||||
{
|
||||
int x, y, dy;
|
||||
unsigned int c;
|
||||
|
||||
CLuaData *W = CheckData(L, 1);
|
||||
if (!W || !W->fbwin)
|
||||
return 0;
|
||||
x = luaL_checkint(L, 2);
|
||||
y = luaL_checkint(L, 3);
|
||||
dy = luaL_checkint(L, 4);
|
||||
|
||||
#if HAVE_COOL_HARDWARE
|
||||
c = luaL_checkunsigned(L, 5);
|
||||
#else
|
||||
/* luaL_checkint does not like e.g. 0xffcc0000 on powerpc (returns INT_MAX) instead */
|
||||
c = (unsigned int)luaL_checknumber(L, 5);
|
||||
#endif
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
if (dy < 0 || y + dy > W->fbwin->dy)
|
||||
dy = W->fbwin->dy - y;
|
||||
checkMagicMask(c);
|
||||
W->fbwin->paintVLineRel(x, y, dy, c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CLuaInstance::PaintIcon(lua_State *L)
|
||||
{
|
||||
DBG1("CLuaInstance::%s %d\n", __func__, lua_gettop(L));
|
||||
|
@@ -34,7 +34,7 @@ extern "C" {
|
||||
#include <vector>
|
||||
|
||||
#define LUA_API_VERSION_MAJOR 1
|
||||
#define LUA_API_VERSION_MINOR 15
|
||||
#define LUA_API_VERSION_MINOR 16
|
||||
|
||||
typedef std::pair<lua_Integer, Font*> fontmap_pair_t;
|
||||
typedef std::map<lua_Integer, Font*> fontmap_t;
|
||||
@@ -238,6 +238,8 @@ private:
|
||||
static int restoreScreen(lua_State *L);
|
||||
static int deleteSavedScreen(lua_State *L);
|
||||
static int PaintBox(lua_State *L);
|
||||
static int paintHLineRel(lua_State *L);
|
||||
static int paintVLineRel(lua_State *L);
|
||||
static int PaintIcon(lua_State *L);
|
||||
static int RenderString(lua_State *L);
|
||||
static int getRenderWidth(lua_State *L);
|
||||
|
Reference in New Issue
Block a user