Hi,
I want to make a painting programm.
I want to Draw a ellipse where the user touch (I know that it works with CurrentTouch.x and CurrentTouch.y)
The Problem is because of the draw Funktion Starts again and again the Circle goes away.
I want the Circle still there so that you can draw something.
Get rid of the background function in draw()
Here’s a simple painting program. You can change the color and line size. Just drag your finger around the screen.
function setup()
backingMode(RETAINED)
parameter.color("col",255)
parameter.integer("size",2,40,2)
end
function draw()
if dr then
stroke(col)
strokeWidth(size)
line(bx,by,tx,ty)
bx,by=tx,ty
end
end
function touched(t)
if t.state==BEGAN then
bx,by=t.x,t.y
end
if t.state==MOVING then
dr=true
tx,ty=t.x,t.y
end
if t.state==ENDED then
dr=false
end
end
@lidddl You can find a lot of information/examples by doing a forum search. The search area is at the top right above the New Discussion box.
displayMode(FULLSCREEN)
function setup()
pos={} -- x,y position
end
function draw()
background(0)
fill(255,0,0)
for a,b in pairs(pos) do
ellipse(b.x,b.y,40,20)
end
end
function touched(t)
if t.state==BEGAN then
table.insert(pos,vec2(t.x,t.y))
end
end
Thank you for your answers.I will try it