-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrollImageBuffer.lua
More file actions
40 lines (30 loc) · 829 Bytes
/
scrollImageBuffer.lua
File metadata and controls
40 lines (30 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
-- scrollImageBuffer
-- For showing how using
-- PNG *buffer* doesn't work.
-- Scrolls image so that
-- it is displayed multiple
-- times.
local png_filename = "/home/we/dust/code/nornsFun/images/image_ML309503171.png"
local current_count = 0
function tick(count)
current_count = count
redraw()
end
function init()
-- Load the buffer just once
png_buffer = screen.load_png (png_filename)
intro_counter = metro.init(tick, 0.1, 180)
intro_counter:start()
end
function redraw()
screen.clear()
-- These commands both work to wait until clear() is done so buffer successfully displayed
--os.execute("sleep 0")
--screen.current_point()
-- Scroll the png from right to left
x = -60 + current_count
y = 0
-- Display the png buffer
screen.display_image(png_buffer, x, y)
screen.update()
end