when i have too much pictures ( more than thousand in my website )
it’s too long to load all pictures whereas i need one randomly in draw() function.
But i can’t load picture in draw() function.
displayMode(FULLSCREEN)
function setup()
flag={"Bd","Chronologie","Cinema","Geographie","Histoire",
"Humour","Inventions","Litterature","Musique","Science","Sports","Television"}
for i=1, 12 do
str="icone"..i.."=nil ; "
str=str.."http.get('http://gregory.thomas.free.fr/quizz/icones/"
str=str..flag[i]..".jpg',didGetImage"..i..")"
f=loadstring(str) ; ic1=f()
end
end
for i=1, 12 do
str="function didGetImage"..i.."(theImage,status,head) icone"..i.."=theImage end"
f=loadstring(str) ; ic1=f()
end
function draw()
background(20,20,40) ; spriteMode(CORNER) ; textMode(CORNER) ; fill(255, 241, 0, 255)
for lig=1, 3 do
for col=1,4 do
j=600-((lig-1)*250+25) ; i=(col-1)*250+25 ; k=(lig-1)*4+col
f=loadstring("if icone"..k.." ~=nil then sprite(icone"..k..",i,j,220,170) end")
ic1=f() ; text(flag[k],i,j-40)
end
end
end