Hello,
Why CAMERA is not an image?
Someone knows how to make an variable with Camera as Image?
Here’s an example. Use collectgarbage() to prevent Codea from crashing when it updates img.
displayMode(FULLSCREEN)
function setup()
end
function draw()
background(40, 40, 50)
img=image(CAMERA)
collectgarbage()
if img~=nil then
sprite(img,WIDTH/2,HEIGHT/2)
end
end
Why that doesn’t work???
function setup()
end
function draw()
i = image(CAMERA)
collectgarbage()
imgCopy = i:copy(i.width/2, i.height/2, 500, 500)
end
Are you after something like this. Tap the screen to copy a section of the Camera image.
displayMode(FULLSCREEN)
function setup()
end
function draw()
background(0)
i = image(CAMERA)
collectgarbage()
if imgCopy~=nil then
sprite(imgCopy,WIDTH/2,HEIGHT/2)
elseif i~=nil then
sprite(i,WIDTH/2,HEIGHT/2)
end
end
function touched(t)
if t.state==BEGAN then
print(i)
imgCopy = i:copy(i.width/2, i.height/2, 500, 500)
end
end
Thanks!