Page 1 of 1

Help with using drawing line!

Posted: Thu Jan 15, 2004 7:50 pm
by Anonymous
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!

Posted: Tue Jan 20, 2004 4:59 pm
by syb
uuhh. what? explain.

Archived topic from Iceteks, old topic ID:1915, old post ID:15815

Help with using drawing line!

Posted: Tue Apr 13, 2004 1:02 am
by Fat Cat
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