#include <turtlelib.h>
Definition at line 11 of file turtlelib.h.
Public Member Functions | |
| Turtle () | |
| Constructs a Turtle object and intializes its heading to North (up) and position to (0, 0). | |
| Turtle (double x, double y) | |
| Constructs a Turtle object and intializes its heading to North (up) and position to the x- and y-coordinates. | |
| void | forward (double distance) |
| Move this turtle forwards the given distance in the direction it is heading. | |
| void | backward (double distance) |
| Move this turtle backwards the given distance from the direction it is heading. | |
| void | left (double degrees) |
| Turn this turtle to the left (counter-clockwise) the given number of degrees from the current direction it is heading. | |
| void | right (double degrees) |
| Turn this turtle to the right (clockwise) the given number of degrees from the current direction it is heading. | |
| double | getHeading () const |
| Returns the current heading (direction) in degrees for this turtle as the number of degrees clockwise from the North (up). | |
| void | setHeading (double degrees) |
| Turn this turtle to the given heading (direction). | |
| double | getX () const |
| Returns the current x-coordinate of this Turtle. | |
| double | getY () const |
| Returns the current y-coordinate of this Turtle. | |
| void | moveTo (double x, double y) |
| Move this turtle to the given x and y location without drawing. | |
| void | moveTo (string prompt) |
| Move this turtle to the position of the mouse when clicked. | |
| bool | isPenDown () const |
| Checks whether the pen is down for this turtle. | |
| void | setPenDown (bool down) |
| Enables or disables drawing when this turtle moves. | |
| void | print (string message) |
| Prints a text message at the current Turtle position. | |
| void | print (double number) |
| Prints a number at the current Turtle position. | |
| void | sleep (int millis) |
| Stops program execution for the specified delay time. | |
| void | clear () |
| Clears the Turtle window. | |
| string | getString (string prompt) |
| Prompts the user for a string. | |
| int | getInt (const string &prompt) |
| Prompts the user for an integer. | |
| double | getDouble (const string &prompt) |
| Prompts the user for a floating-point value. | |
| Turtle::Turtle | ( | ) |
Constructs a Turtle object and intializes its heading to North (up) and position to (0, 0).
| Turtle::Turtle | ( | double | x, | |
| double | y | |||
| ) |
Constructs a Turtle object and intializes its heading to North (up) and position to the x- and y-coordinates.
| void Turtle::backward | ( | double | distance | ) |
Move this turtle backwards the given distance from the direction it is heading.
| distance | The distance to move |
| void Turtle::clear | ( | ) | [inline] |
| void Turtle::forward | ( | double | distance | ) |
Move this turtle forwards the given distance in the direction it is heading.
| distance | The distance to move |
| double Turtle::getDouble | ( | const string & | prompt | ) | [inline] |
Prompts the user for a floating-point value.
| prompt | The message to display while waiting for user input. |
Definition at line 154 of file turtlelib.h.
| double Turtle::getHeading | ( | ) | const [inline] |
Returns the current heading (direction) in degrees for this turtle as the number of degrees clockwise from the North (up).
Definition at line 58 of file turtlelib.h.
References T_INIT_HEADING.
| int Turtle::getInt | ( | const string & | prompt | ) | [inline] |
Prompts the user for an integer.
| prompt | The message to display while waiting for user input. |
Definition at line 147 of file turtlelib.h.
| string Turtle::getString | ( | string | prompt | ) | [inline] |
Prompts the user for a string.
| prompt | The message to display while waiting for user input. |
Definition at line 140 of file turtlelib.h.
| double Turtle::getX | ( | ) | const [inline] |
Returns the current x-coordinate of this Turtle.
Definition at line 75 of file turtlelib.h.
| double Turtle::getY | ( | ) | const [inline] |
Returns the current y-coordinate of this Turtle.
Definition at line 82 of file turtlelib.h.
| bool Turtle::isPenDown | ( | ) | const [inline] |
Checks whether the pen is down for this turtle.
true if the pen is down else false Definition at line 102 of file turtlelib.h.
| void Turtle::left | ( | double | degrees | ) |
Turn this turtle to the left (counter-clockwise) the given number of degrees from the current direction it is heading.
| degrees | The number of degrees to turn. |
| void Turtle::moveTo | ( | string | prompt | ) |
Move this turtle to the position of the mouse when clicked.
| prompt | The message to display while waiting for the mouse click. |
| void Turtle::moveTo | ( | double | x, | |
| double | y | |||
| ) |
| void Turtle::print | ( | double | number | ) |
| void Turtle::print | ( | string | message | ) |
| void Turtle::right | ( | double | degrees | ) |
Turn this turtle to the right (clockwise) the given number of degrees from the current direction it is heading.
| degrees | The number of degrees to turn. |
| void Turtle::setHeading | ( | double | degrees | ) |
Turn this turtle to the given heading (direction).
Headings are based on the degrees of the compass with zero (0) degrees meaning to point straight up and turning clockwise through 360 degrees.
| degrees | The new heading for this Turtle. |
| void Turtle::setPenDown | ( | bool | down | ) | [inline] |
Enables or disables drawing when this turtle moves.
| down | Set true to enable drawing and false to disable drawing. |
Definition at line 108 of file turtlelib.h.
| void Turtle::sleep | ( | int | millis | ) | [inline] |
Stops program execution for the specified delay time.
| millis | The delay in milliseconds. |
Definition at line 126 of file turtlelib.h.
1.4.7