Commit 145a0f01 authored by devsaurus's avatar devsaurus
Browse files

add scaling functions

parent c1662a99
...@@ -310,6 +310,32 @@ static int lu8g_drawCircle( lua_State *L ) ...@@ -310,6 +310,32 @@ static int lu8g_drawCircle( lua_State *L )
return 0; return 0;
} }
// Lua: u8g.setScale2x2( self )
static int lu8g_setScale2x2( lua_State *L )
{
lu8g_userdata_t *lud;
if ((lud = get_lud( L )) == NULL)
return 0;
u8g_SetScale2x2( lud );
return 0;
}
// Lua: u8g.undoScale( self )
static int lu8g_undoScale( lua_State *L )
{
lu8g_userdata_t *lud;
if ((lud = get_lud( L )) == NULL)
return 0;
u8g_UndoScale( lud );
return 0;
}
// Lua: u8g.firstPage( self ) // Lua: u8g.firstPage( self )
static int lu8g_firstPage( lua_State *L ) static int lu8g_firstPage( lua_State *L )
{ {
...@@ -517,6 +543,8 @@ static const LUA_REG_TYPE lu8g_display_map[] = ...@@ -517,6 +543,8 @@ static const LUA_REG_TYPE lu8g_display_map[] =
{ LSTRKEY( "drawRFrame" ), LFUNCVAL( lu8g_drawRFrame ) }, { LSTRKEY( "drawRFrame" ), LFUNCVAL( lu8g_drawRFrame ) },
{ LSTRKEY( "drawDisc" ), LFUNCVAL( lu8g_drawDisc ) }, { LSTRKEY( "drawDisc" ), LFUNCVAL( lu8g_drawDisc ) },
{ LSTRKEY( "drawCircle" ), LFUNCVAL( lu8g_drawCircle ) }, { LSTRKEY( "drawCircle" ), LFUNCVAL( lu8g_drawCircle ) },
{ LSTRKEY( "setScale2x2" ), LFUNCVAL( lu8g_setScale2x2 ) },
{ LSTRKEY( "undoScale" ), LFUNCVAL( lu8g_undoScale ) },
{ LSTRKEY( "firstPage" ), LFUNCVAL( lu8g_firstPage ) }, { LSTRKEY( "firstPage" ), LFUNCVAL( lu8g_firstPage ) },
{ LSTRKEY( "nextPage" ), LFUNCVAL( lu8g_nextPage ) }, { LSTRKEY( "nextPage" ), LFUNCVAL( lu8g_nextPage ) },
#if LUA_OPTIMIZE_MEMORY > 0 #if LUA_OPTIMIZE_MEMORY > 0
......
...@@ -87,6 +87,13 @@ function ascii_2() ...@@ -87,6 +87,13 @@ function ascii_2()
end end
end end
function extra_page(a)
disp:drawStr(0, 12, "setScale2x2")
disp:setScale2x2()
disp:drawStr(0, 6+a, "setScale2x2")
disp:undoScale()
end
-- the draw() routine -- the draw() routine
function draw(draw_state) function draw(draw_state)
...@@ -110,6 +117,8 @@ function draw(draw_state) ...@@ -110,6 +117,8 @@ function draw(draw_state)
ascii_1() ascii_1()
elseif (component == 7) then elseif (component == 7) then
ascii_2() ascii_2()
elseif (component == 8) then
extra_page(bit.band(draw_state, 7))
end end
end end
...@@ -120,7 +129,7 @@ function graphics_test() ...@@ -120,7 +129,7 @@ function graphics_test()
-- cycle through all components -- cycle through all components
local draw_state local draw_state
for draw_state = 0, 7 + 7*8, 1 do for draw_state = 0, 7 + 8*8, 1 do
disp:firstPage() disp:firstPage()
repeat repeat
draw(draw_state) draw(draw_state)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment