Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
145a0f01
Commit
145a0f01
authored
Feb 08, 2015
by
devsaurus
Browse files
add scaling functions
parent
c1662a99
Changes
2
Show whitespace changes
Inline
Side-by-side
app/modules/u8g.c
View file @
145a0f01
...
...
@@ -310,6 +310,32 @@ static int lu8g_drawCircle( lua_State *L )
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 )
static
int
lu8g_firstPage
(
lua_State
*
L
)
{
...
...
@@ -517,6 +543,8 @@ static const LUA_REG_TYPE lu8g_display_map[] =
{
LSTRKEY
(
"drawRFrame"
),
LFUNCVAL
(
lu8g_drawRFrame
)
},
{
LSTRKEY
(
"drawDisc"
),
LFUNCVAL
(
lu8g_drawDisc
)
},
{
LSTRKEY
(
"drawCircle"
),
LFUNCVAL
(
lu8g_drawCircle
)
},
{
LSTRKEY
(
"setScale2x2"
),
LFUNCVAL
(
lu8g_setScale2x2
)
},
{
LSTRKEY
(
"undoScale"
),
LFUNCVAL
(
lu8g_undoScale
)
},
{
LSTRKEY
(
"firstPage"
),
LFUNCVAL
(
lu8g_firstPage
)
},
{
LSTRKEY
(
"nextPage"
),
LFUNCVAL
(
lu8g_nextPage
)
},
#if LUA_OPTIMIZE_MEMORY > 0
...
...
lua_examples/graphics_test.lua
View file @
145a0f01
...
...
@@ -87,6 +87,13 @@ function ascii_2()
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
function
draw
(
draw_state
)
...
...
@@ -110,6 +117,8 @@ function draw(draw_state)
ascii_1
()
elseif
(
component
==
7
)
then
ascii_2
()
elseif
(
component
==
8
)
then
extra_page
(
bit
.
band
(
draw_state
,
7
))
end
end
...
...
@@ -120,7 +129,7 @@ function graphics_test()
-- cycle through all components
local
draw_state
for
draw_state
=
0
,
7
+
7
*
8
,
1
do
for
draw_state
=
0
,
7
+
8
*
8
,
1
do
disp
:
firstPage
()
repeat
draw
(
draw_state
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment