Hello guys, I’ve go a problem, with my code. I want to create an interface for my first app, but there is one problem, that I don’t know how this works, because if I write the fill function to the text, the rect color changed. An I don’t know, how the zLevel function works here
Can you please help me? Please try this code.
displayMode(FULLSCREEN)
function setup()
getImg()
end
function draw()
background(40, 40, 50)
fill(255)
if img==nil then
text("Loading image",WIDTH/2,HEIGHT/2)
else
sprite(img,WIDTH/2,HEIGHT/2,700)
end
end
function getImg()
http.request('https://dl.dropboxusercontent.com/s/3149mj9xjx1w71e/Costa Rican Frog.jpg',gotImage)
end
function gotImage(image,status,header)
img=image
end
@hallomio77 Not sure what you’re doing, but you need to set the fill color before each item you want changed. Also, you need to set the noStroke after stroke to prevent it from show on other items.
Codea reads your code from the top to the bottom, so you’re drawing a rectangle over your text. Also, you can call fill() multiple times to change the colors of multiple objects. Like this:
background(61, 62, 92, 255)
--rect
fill(0, 0, 0, 98)
rect(0, 690, 1024, 200)
--stroke
stroke(0, 0, 0, 255)
strokeWidth(1)
line(0, 690, 1024, 690)
--textfield Land
--Draw the rectangle first, it's the background
fill(255, 0, 0, 255) -- Change the color to red
rect(345, 300, 300, 50) -- Draw a rectangle (uses the last specified fill(), so in this case red)
--text
--Then draw the text afterwards, on top of the rectangle
font("Futura-Medium")
fill(255, 255, 255, 255) -- Change the next color to white
fontSize(40)
textWrapWidth(1000)
text("Fahndung Pro Deutschland", 512, 730) -- Draw some text (uses the last specified fill() yet again, so in this case white)