Detailed API documentation.
The easiest way to write a program drawing something on a screen is turtle graphics. I saw a five-year-old kid doing it.
You command the imaginary robot called “turtle” using very simple commands: forward, turnLeft, turnRight, backward. The turtle moves drawing line on the screen. You also can use commands: penUp and penDown to move it without drawing.
Turtle graphics was originally created as part of Logo programming language in the 1967 year and accepted as a great way to learn Programming.
Using ToyGraphics you can combine good old turtle graphics with a modern programming language (Kotlin).
If you use turtle graphics you may skip “Coordinate system” and “Graphics” in this manual.
Turtle graphics is very easy to use but has its own limitations.
If you need to write a game or use a Cartesian coordinate system you have to use Graphics class.
To use turtle graphics you have to create an object of the Turtle class passing the window as an argument. Like this:
val turtle = Turtle(wnd)
You create several turtles and move them independently.
Here are some complete examples and results on the screen: