Declare drawinc_x!, drawinc_y!, drawinc_a&, drawinc_hdl&
Var drawinc_pen&=1

Proc Paint
    Parameters hdl&
    drawinc_hdl&=hdl&
EndProc

Proc Go
    Parameters h&
    StartPaint drawinc_hdl&
        Case drawinc_pen& : Line drawinc_x!,drawinc_y! - drawinc_x!+(Sin((@Pi()/180)*drawinc_a&)*h&),drawinc_y!-(Cos((@Pi()/180)*drawinc_a&)*h&)
    EndPaint
    drawinc_x!=drawinc_x!+(Sin((@Pi()/180)*drawinc_a&)*h&)
    drawinc_y!=drawinc_y!-(Cos((@Pi()/180)*drawinc_a&)*h&)
EndProc

Proc Turn
    Parameters a&
    a& = a& mod 360
    Case a&<0 : a&=a&+360
    drawinc_a&=(drawinc_a&+a&) mod 360
EndProc

Proc Angle
    Parameters a&
    a& = a& mod 360
    Case a&<0 : a&=a&+360
    drawinc_a&=a&
EndProc

Proc Goto
    Parameters x&,y&
    drawinc_x!=x&
    drawinc_y!=y&
EndProc

Proc ResetScreen
    Goto(0,0)
    drawinc_a&=0
    PenDown()
    StartPaint drawinc_hdl&
        CLS RGB(255,255,255)
    EndPaint
EndProc

Proc Center
    Goto(width(drawinc_hdl&)/2,height(drawinc_hdl&)/2)
EndProc

Proc PenDown
    drawinc_pen&=1
EndProc

Proc PenUp
    drawinc_pen&=0
EndProc
