![]() |
|
Sprinter SDK Documentation
robot "Hello"
author "NedoPC"
+inc/rw1_std.rwi
+inc/rw1p2.rwi
+hellos.rwi
main()
{
termclear(@MYSPR) // fill screen
say "HELLO, WORLD !" // hello world
select 0 0 // choose cell to draw
set @MYSPR // draw our picture
loop: goto loop
}
+lib/p2term.rwl
Here we included two files of macros (third inclusion is file of tiles
identifiers). First one is standard macros of RW1 programming language
inc/rw1_std.rwi and additional macros inc/rw1p2.rwi.
And we included library for working with terminal lib/p2term.rwl.
Now we may use function "termclear" to clear screen by defined tile.
Note last line of function main(). It is code to loop command pointer in
this line forever.
Let's add new tile to our list of tiles. To do this we have to open file hellos.spr (use F3 and change type of file to *.*) and put new definition: ;8x8-2/16 BLUE DB #00,#00,#00,#00,#00,#00,#00,#00,#01 ; MYSPR DB #FF,#81,#A5,#81,#81,#9F,#81,#FF,#40 ;@Again open hello.rw1 and run it to rebuild the project by system for use modified hellos.spr and than change our program to clear terminal by new tile:
robot "Hello"
author "NedoPC"
+inc/rw1_std.rwi
+inc/rw1p2.rwi
+hellos.rwi
main()
{
termclear(@BLUE) // fill screen
termsetsay(2,0,#1E) // yellow on blue
say "HELLO, WORLD !" // hello world
select 0 0 // choose cell to draw
set @MYSPR // draw our picture
loop: goto loop
}
+lib/p2term.rwl
See, we add code to locate output position for text and set new color for it. Try it now! ;)
|