[Site Home] [Forum Home] [Articles] [File DB] [News Archives]

Programming -> Help with using drawing line!


(View original topic)


Fat Cat - Apr-13-2004 server time
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.

syb - Jan-20-2004 server time
uuhh. what? explain.

chibitenshi_03 - Jan-15-2004 server time
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

(Showing 50 last posts, newest on top)