turtlegraphic.c File Reference

Implementation of the TurtleGraphic functions. More...

#include "turtlegraphic.h"

Include dependency graph for turtlegraphic.c:

Go to the source code of this file.

Defines

#define CLS_TURTLEGRAPHIC   "at/fhv/sgr/graphiclib/TurtleGraphic"
 Defines the full name of the TurtleGraphic-Class.

Functions

void clearTurtleScreen (TurtleGraphic *tg)
 Clears the Screen.
void createTurtleGraphic_ (TurtleGraphic *tg, Frame *frame)
 Creates the TurtleGraphic by getting the Java TurtleGraphic-Class, the method ids and createing a new Java TurtleGraphic-Object.
void createTurtleGraphicC (TurtleGraphic_ *tg, Frame *frame)
 Function is called when working with C and calling the function createTurtleGraphic.
void createTurtleGraphicCPP (TurtleGraphicCPP_ *tg, Frame *frame)
 Function is called when working with C++ and calling the function createTurtleGraphic.
void deleteTurtleGraphic_ (TurtleGraphic *tg)
 Deletes the TurtleGraphic by deleting the global references.
void deleteTurtleGraphicC (TurtleGraphic_ *tg)
 Function is called when working with C and calling the function deleteTurtleGraphic.
void deleteTurtleGraphicCPP (TurtleGraphicCPP_ *tg)
 Function is called when working with C++ and calling the function deleteTurtleGraphic.
jfloat getTurtleX (TurtleGraphic *tg)
 Gets X-Pos of the "turtle".
jfloat getTurtleY (TurtleGraphic *tg)
 Get Y-Pos of the "turtle".
void initTurtleGraphic_ (TurtleGraphic_ *tg)
 Initializes the TurtleGraphic_ structure by setting the function pointers.
void moveTurtleTo (TurtleGraphic *tg, jfloat x, jfloat y)
 Moves the "turtle" to a position.
void printTurtleText (TurtleGraphic *tg, const char *text)
 Prints the Text on Screen at the current position of the "turtle".
void setTurtleAngle (TurtleGraphic *tg, jfloat angle)
 Sets the angle of the "turtle" moves to.
void setTurtleColor (TurtleGraphic *tg, Color c)
 Sets the color with which the "turtle" draws.
void setTurtleDraw (TurtleGraphic *tg, jboolean draw)
 Sets if the "turtle" draws or not.
void turtlebackward (TurtleGraphic *tg, jfloat l)
 Moves the "turtle" backward.
void turtleforward (TurtleGraphic *tg, jfloat l)
 Moves the "turtle" forward.
void turtleleft (TurtleGraphic *tg, jfloat angle)
 Turns the "turtle" left.
void turtleright (TurtleGraphic *tg, jfloat angle)
 Turns the "turtle" right.


Detailed Description

Implementation of the TurtleGraphic functions.

The TurtleGraphic enables you draw on a Frame like you could to it with the LogoWriter. You will not see a turtle, but you can move forward and backward, change your movement angle, write on a Frame, etc.

Author:
Stefan Gruber
Date:
19.01.2005

Definition in file turtlegraphic.c.


Define Documentation

#define CLS_TURTLEGRAPHIC   "at/fhv/sgr/graphiclib/TurtleGraphic"
 

Defines the full name of the TurtleGraphic-Class.

Definition at line 16 of file turtlegraphic.c.


Function Documentation

void clearTurtleScreen TurtleGraphic tg  ) 
 

Clears the Screen.

Parameters:
tg - Pointer to the TurtleGraphic.

Definition at line 164 of file turtlegraphic.c.

void createTurtleGraphic_ TurtleGraphic tg,
Frame frame
 

Creates the TurtleGraphic by getting the Java TurtleGraphic-Class, the method ids and createing a new Java TurtleGraphic-Object.

Parameters:
tg - Pointer to the TurtleGraphic.
frame - Pointer to the frame to draw on.

Definition at line 195 of file turtlegraphic.c.

void createTurtleGraphicC TurtleGraphic_ tg,
Frame frame
 

Function is called when working with C and calling the function createTurtleGraphic.

It initializes the TurtleGraphic_ structure.

Parameters:
tg - Pointer to the TurtleGraphic_ structure.
frame - Pointer to the frame to draw on.

Definition at line 237 of file turtlegraphic.c.

void createTurtleGraphicCPP TurtleGraphicCPP_ tg,
Frame frame
 

Function is called when working with C++ and calling the function createTurtleGraphic.

It initializes the TurtleGraphicCPP_ structure.

Parameters:
tg - Pointer to the TurtleGraphicCPP_ structure.
frame - Pointer to the frame to draw on.

Definition at line 224 of file turtlegraphic.c.

void deleteTurtleGraphic_ TurtleGraphic tg  ) 
 

Deletes the TurtleGraphic by deleting the global references.

Parameters:
tg - Pointer to the TurtleGraphic.

Definition at line 247 of file turtlegraphic.c.

void deleteTurtleGraphicC TurtleGraphic_ tg  ) 
 

Function is called when working with C and calling the function deleteTurtleGraphic.

Parameters:
tg - Pointer to a TurtleGraphic_ structure.

Definition at line 267 of file turtlegraphic.c.

void deleteTurtleGraphicCPP TurtleGraphicCPP_ tg  ) 
 

Function is called when working with C++ and calling the function deleteTurtleGraphic.

Parameters:
tg - Pointer to a TurtleGraphicCPP_ structure.

Definition at line 257 of file turtlegraphic.c.

jfloat getTurtleX TurtleGraphic tg  ) 
 

Gets X-Pos of the "turtle".

Parameters:
tg - Pointer to the TurtleGraphic.
Returns:
the x-coordinate of the "turtle".
See also:
getTurtleY(TurtleGraphic* tg)

Definition at line 132 of file turtlegraphic.c.

jfloat getTurtleY TurtleGraphic tg  ) 
 

Get Y-Pos of the "turtle".

Parameters:
tg - Pointer to the TurtleGraphic.
Returns:
the y-coordinate of the "turtle".
See also:
getTurtleX(TurtleGraphic* tg)

Definition at line 145 of file turtlegraphic.c.

void initTurtleGraphic_ TurtleGraphic_ tg  ) 
 

Initializes the TurtleGraphic_ structure by setting the function pointers.

Parameters:
tg - Pointer to a TurtleGraphic_ structure.

Definition at line 173 of file turtlegraphic.c.

void moveTurtleTo TurtleGraphic tg,
jfloat  x,
jfloat  y
 

Moves the "turtle" to a position.

Parameters:
tg - Pointer to the TurtleGraphic.
x - The x-coordinate to move to.
y - The y-coordinate to move to.
See also:
forward(TurtleGraphic* tg, jfloat l)

backward(TurtleGraphic* tg, jfloat l)

Definition at line 109 of file turtlegraphic.c.

void printTurtleText TurtleGraphic tg,
const char *  text
 

Prints the Text on Screen at the current position of the "turtle".

Parameters:
tg - Pointer to the TurtleGraphic.
text - The text to draw.

Definition at line 155 of file turtlegraphic.c.

void setTurtleAngle TurtleGraphic tg,
jfloat  angle
 

Sets the angle of the "turtle" moves to.

Parameters:
tg - Pointer to the TurtleGraphic.
angle - The angel in degrees.
See also:
turtleright(TurtleGraphic* tg, jfloat angle)

turtleleft(TurtleGraphic* tg, jfloat angle)

Definition at line 83 of file turtlegraphic.c.

void setTurtleColor TurtleGraphic tg,
Color  c
 

Sets the color with which the "turtle" draws.

Parameters:
tg - Pointer to the TurtleGraphic.
c - The new Color.

Definition at line 93 of file turtlegraphic.c.

void setTurtleDraw TurtleGraphic tg,
jboolean  draw
 

Sets if the "turtle" draws or not.

Parameters:
tg - Pointer to the TurtleGraphic.
draw - If JNI_TRUE the "turtle" draws when moving, if JNI_FALSE the "turtle" does not draw.

Definition at line 119 of file turtlegraphic.c.

void turtlebackward TurtleGraphic tg,
jfloat  l
 

Moves the "turtle" backward.

Parameters:
tg - Pointer to the TurtleGraphic.
l - The length to move.
See also:
turtleforward(TurtleGraphic* tg, jfloat l)

moveTurtleTo(TurtleGraphic* tg, jfloat x, jfloat y)

Definition at line 70 of file turtlegraphic.c.

void turtleforward TurtleGraphic tg,
jfloat  l
 

Moves the "turtle" forward.

Parameters:
tg - Pointer to the TurtleGraphic.
l - The length to move.
See also:
turtlebackward(TurtleGraphic* tg, jfloat l)

moveTurtleTo(TurtleGraphic* tg, jfloat x, jfloat y)

Definition at line 57 of file turtlegraphic.c.

void turtleleft TurtleGraphic tg,
jfloat  angle
 

Turns the "turtle" left.

Parameters:
tg - Pointer to the TurtleGraphic.
angle - The angel in degrees to turn.
See also:
turtleright(TurtleGraphic* tg, jfloat angle)

setTurtleAngle(TurtleGraphic* tg, jfloat angle)

Definition at line 44 of file turtlegraphic.c.

void turtleright TurtleGraphic tg,
jfloat  angle
 

Turns the "turtle" right.

Parameters:
tg - Pointer to the TurtleGraphic.
angle - The angel in degrees to turn.
See also:
turtleleft(TurtleGraphic* tg, jfloat angle)

setTurtleAngle(TurtleGraphic* tg, jfloat angle)

Definition at line 31 of file turtlegraphic.c.


Generated on Sat Nov 19 14:11:15 2005 for GrubC by  doxygen 1.4.4