function setup()
displayMode(FULLSCREEN)
bg = image(1024,768)
setContext(bg)
displayMode(FULLSCREEN)
fill(255, 0, 0, 255)
rect(0,0,WIDTH/2,HEIGHT)
fill(0, 255, 39, 255)
rect(WIDTH/2,0,WIDTH/2,HEIGHT)
setContext()
saveImage('Documents:DualColour',bg)
end
function draw()
background(sprite("Documents:DualColour"))
end
Am i just making this complicated for myself?
I want to create a background image (in this case an image thats half red, half greeen) and set it as, well the background, this seems like the correct approach though a little procrastinating voice (that might be right) tells me to just setContext(bg) and just subsequently draw on that, though i’m not sure if that ideas very good either
My only other problem is size. If i get a gigantic, lets say 4000x4000, image and set it as the background, will codea keeps the part of the background that isnt shown or will codea just clip it off? if codea will clip it (or shrink it) how can i stop this?
I cleaned up your code a little to give you the red/green background. I added a circle that you can drag around the screen with your finger so you can see how it works with the background.
displayMode(FULLSCREEN)
function setup()
bg = image(WIDTH,HEIGHT)
setContext(bg)
fill(255, 0, 0, 255)
rect(0,0,WIDTH/2,HEIGHT)
fill(0, 255, 0, 255)
rect(WIDTH/2,0,WIDTH/2,HEIGHT)
end
function draw()
sprite(bg,WIDTH/2,HEIGHT/2)
fill(255)
ellipse(CurrentTouch.x,CurrentTouch.y,50,50) -- draw circle
end