I've added some features to make the library more kids-friendly (after all, I've written it for my son). There are two new functions for colour. They accept 17 colour names (white, black, green, red, blue, yellow, grey, purple, aqua, teal, olive, maroon, navy, magenta, lightblue, lightgrey, darkgrey).
setcolour("[colour name]") - set the colour for drawing to "colour name"
setbgcolour("[colour name]") - clears the screen and set the background colour to"colour name"
For more colours you can still use EGSL functions.
There is also a new fill() function that fills the area with a currently set colour.
Here is a small example (see the screenshot):
require "turtle"
openwindow (640, 550, 0, "Example of turtle graphics")
function koch(x, t)
if t > 0 then
t=t-1
x=x/3
koch(x, t)
turnleft(60)
koch(x, t)
turnright(120)
koch(x, t)
turnleft(60)
koch(x, t)
else
forward(3*x)
end
end
setredraw(0)
setbgcolor("red")
setcolor("yellow")
goxy (100, 150)
turnright(90)
for x = 1, 3 do
koch(150, 5)
turnright(120)
end
goxy (250, 237)
for x = 1, 3 do
koch(50, 4)
turnright(120)
end
setcolor("white")
circle (325, 275, 200)
redraw()
setredraw(1)
goxy (200, 200)
setcolor("purple")
fill()
goxy (320, 275)
setcolor("olive")
fill()
goxy (10, 10)
setcolor("teal")
fill()
inkey()
Source codes and an updated configuration file for Geany are attached.