Code: Select all
imgdir = System.listDirectory("/images")
Image = {}
Image[1] = {}
Image[2] = {}
Image[3] = {}
Image[4] = {}
Image[5] = {}
Image[6] = {}
Image[7] = {}
Image[8] = {}
Image[9] = {}
Image[10] = {}
pics = {}
Picture 1
Picture 2
Picture 3
Picture 4
Picture 5
Picture 6
Picture 7
Picture 8
Picture 9
Picture 10
for i = 1, table.getn(imgdir) do
if string.lower(string.sub(imgdir[i].name, -4)) == ".png" then
table.insert(pics, imgdir[i])
end
end
--this is one way to filter the array for the images only, you can do that for BMP and whatever images your Lua interpreter supports.
counter = 0
currentpic = 1
while true do
counter = counter + 1
if counter > 10 then
counter = 0
picture = Image.load("/images" .. pics[Picture 1].name)
currentpic = currentpic + 1
if currentpic > table.getn(pics) then
currentpic = 1
end
end
screen:clear()
if picture then
screen:blit(0, 0, picture)
end
screen.waitVblankStart()
screen.flip()
end