Help with using drawing line!

Computer builds, hardware and software discussion or troubleshooting, including peripherals. Essentially a general place to talk about desktop computers.
Locked
Anonymous

Help with using drawing line!

Post 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
syb
Posts: 222
Joined: Wed Jun 18, 2003 10:12 pm

Help with using drawing line!

Post by syb »

uuhh. what? explain.

Archived topic from Iceteks, old topic ID:1915, old post ID:15815
The wisdom of sight comes from the father of lights
Fat Cat
Posts: 16
Joined: Wed Mar 31, 2004 8:33 pm

Help with using drawing line!

Post 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
Locked