How do i make so that the line doesn't erase?
var x, y, btnNumber, btnUpDown, buttons : int
var nx, ny : int
loop
Mouse.ButtonWait ("down", x, y, btnNumber, btnUpDown)
nx := x
ny := y
loop
Draw.Line (x, y, nx, ny, 0) % Erase previous line
exit when Mouse.ButtonMoved ("up")
Mouse.Where (nx, ny, buttons)
Draw.Line (x, y, nx, ny, 1) % Draw line to position
end loop
Mouse.ButtonWait ("up", nx, ny, btnNumber, btnUpDown)
Draw.Line (x, y, nx, ny, 2) % Draw line to final position
end loop
Archived topic from Iceteks, old topic ID:1915, old post ID:15655
Help with using drawing line!
Help with using drawing line!
uuhh. what? explain.
Archived topic from Iceteks, old topic ID:1915, old post ID:15815
Archived topic from Iceteks, old topic ID:1915, old post ID:15815
The wisdom of sight comes from the father of lights
Help with using drawing line!
Not sure what programming language you are using, but check the flow control of your loops.
var x, y, btnNumber, btnUpDown, buttons : int
var nx, ny : int
loop
Mouse.ButtonWait ("down", x, y, btnNumber, btnUpDown)
nx := x
ny := y
loop
Draw.Line (x, y, nx, ny, 0) % Erase previous line
exit when Mouse.ButtonMoved ("up")
Mouse.Where (nx, ny, buttons)
Draw.Line (x, y, nx, ny, 1) % Draw line to position
end loop
Mouse.ButtonWait ("up", nx, ny, btnNumber, btnUpDown)
Draw.Line (x, y, nx, ny, 2) % Draw line to final position
end loop
Your EXIT check statement occurs just after the Erase previous line function and before the New line is drawn.
If you move this EXIT check down 2 lines to the end of the first loop (ie: after the Draw line to final position) this will force the program to draw the new line before exiting the loop.
Archived topic from Iceteks, old topic ID:1915, old post ID:18903
var x, y, btnNumber, btnUpDown, buttons : int
var nx, ny : int
loop
Mouse.ButtonWait ("down", x, y, btnNumber, btnUpDown)
nx := x
ny := y
loop
Draw.Line (x, y, nx, ny, 0) % Erase previous line
exit when Mouse.ButtonMoved ("up")
Mouse.Where (nx, ny, buttons)
Draw.Line (x, y, nx, ny, 1) % Draw line to position
end loop
Mouse.ButtonWait ("up", nx, ny, btnNumber, btnUpDown)
Draw.Line (x, y, nx, ny, 2) % Draw line to final position
end loop
Your EXIT check statement occurs just after the Erase previous line function and before the New line is drawn.
If you move this EXIT check down 2 lines to the end of the first loop (ie: after the Draw line to final position) this will force the program to draw the new line before exiting the loop.
Archived topic from Iceteks, old topic ID:1915, old post ID:18903