Computer Graphics: Turtle Graphics using C Language

1 29
Avatar for Fria
Written by
2 years ago

Turtle graphics started way back 1967 it was included in LOGO programming language a programming language for kids and adults alike and because of its easy syntax and visual feedback with simple animation it became a great learning tool for that early computer age.

let us now dive into Turtle Graphics Programming...

I implemented just minimal turtle commands but you can add your own functions using these basic building blocks...

Turtle Graphics Commands:

Turtle *turtle = CreateTurtle(x,y,heading,size,color,isVisible); -> create new turtle object at screen location x,y facing heading degrees east with a size, color and isVisible properties.

Move(turtle,distance); -> the turtle move distance in pixels, forward if positive, backward if negative.

Turn(turtle,angle); -> the turtle will turn angle in degrees, clockwise if positive, counter clockwise if negative.

Jump(turtle,x,y); -> the turtle will jump to screen location x,y

PenUp(turtle); -> the turtle will move only but not draw.

PenDown(turtle); -> the turtle will draw and move.

Hide(turtle); -> hide the turtle.

Show(turtle); -> show the turtle.

DrawStar(turtle,size); -> the turtle will draw a size star.

Screenshot:

Sample Output

Source Code: https://github.com/rald/CSDL2TurtleGraphics

2
$ 0.10
$ 0.10 from @Ceddy-lim
Avatar for Fria
Written by
2 years ago

Comments

Now ko lang yan narinig ahhh..

$ 0.00
2 years ago