mirror of
https://github.com/forth-ev/VolksForth.git
synced 2024-11-22 20:34:07 +00:00
1 line
9.0 KiB
Plaintext
1 line
9.0 KiB
Plaintext
\ Turtle-Graphic UH 03Dec86 Dieses File enthaelt die Definitionen fuer eine LOGO-aehnliche Turtle-Grafik. (Siehe volksFORTH-Handbuch.) \ Turtle-Graphic 05Sep86 \needs Graphics include grafik.scr \needs sin include mathe.scr 1 $05 +thru \ Turtle Variables UH 05Sep86 Onlyforth Graphics also definitions | Variable direction &90 ( degrees ) direction ! | Variable pendown? pendown? on : heading ( -- deg ) direction @ ; : seth ( deg -- ) &360 mod direction ! ; : lt ( deg -- ) heading + seth ; : rt ( deg -- ) negate lt ; \ Turtle moves 10Oct86| : scale ( trig len -- len' ) &10000 */ &5 + &10 / ; : fd ( n -- ) heading cos over scale heading sin rot scale pendown? @ IF liner ELSE mover THEN ; : bk ( n -- ) negate fd ; : xcor ( -- x ) cursor@ drop ; : ycor ( -- y ) cursor@ nip ; : setx ( x -- ) ycor move ; : sety ( y -- ) xcor swap move ; ' move Alias setxy \ Turtle writes 05Sep86 : pd ( -- ) pendown? on ; : pu ( -- ) pendown? off ; : home ( -- ) &320 &200 setxy &90 seth pd ; : ts ( -- pen papercolour pencolour ) pendown? @ paper@ (ink drop pen@ (ink drop ; \ Farben setzen UH 05Sep86 ' ink Alias pc : bg ( color -- ) dup paper@ (ink ; ' clearwindow Alias cs : fullscreen ; : splitscreen ; \ long Names 05Sep86 ' pc Alias pencolor ' bg Alias background ' cs Alias clearscreen ' seth Alias setheading ' rt Alias right ' lt Alias left ' fd Alias forward ' bk Alias back ' pd Alias pendown ' pu Alias penup ' ts Alias turtlestate |