public class TurtleGraphics extends FunGraphics
FunGraphics
by Pierre-Andre Mudry.FunGraphics
as main classModifier and Type | Field and Description |
---|---|
private double |
angle |
private java.awt.Color |
color |
private boolean |
penDown |
private int |
x |
private int |
y |
major, minor
backBuffer, backg2d, bufferStrategy, checkBorders, current_fps, DISPLAY_FPS, enableRenderingHints, fHeight, frontBuffer, frontg2d, fWidth, g2d, mainFrame, numBuffers, target_fps, TRANSPARENT, VERBOSE
Constructor and Description |
---|
TurtleGraphics(int width,
int height) |
TurtleGraphics(int width,
int height,
java.lang.String windowName) |
Modifier and Type | Method and Description |
---|---|
void |
changeColor(java.awt.Color color)
Change the color of drawing
|
void |
forward(double distance)
Go forward the specified distance (writing if the pen is down)
|
java.awt.Point |
getPosition() |
double |
getTurtleAngle() |
double |
getTurtleAngleRad() |
void |
jump(int x,
int y)
Jump to a specific location (without drawing)
|
void |
penDown()
Start the writing
|
void |
penUp()
Stop the drawing
|
void |
setAngle(double angle)
Set the direction of writing to the specified angle
|
void |
setAngleRad(double angle)
Set the direction of writing to the specified angle
|
void |
setMouseMotionManager(java.awt.event.MouseMotionListener mouseMotionListener) |
void |
setWidth(float w)
Sets the width of the pen
|
void |
turn(double angle)
Turn the direction of writing with the specified angle
|
void |
turnRad(double angle)
Turn the direction of writing with the specified angle
|
addMouseListener, addMouseMotionListener, clear, clear, drawBackground, drawCircle, drawFancyString, drawFilledCircle, drawFilledOval, drawFilledPolygon, drawFillRect, drawFillRect, drawForeground, drawLine, drawMirroredPicture, drawPicture, drawRect, drawRect, drawString, drawString, drawTransformedPicture, drawTransformedPicture, gameloopSample, getFrameHeight, getFrameWidth, main, setColor, setKeyManager, setPenWidth, setPixel, setPixel, setPixel
displayFPS, syncGameLogic
private int x
private int y
private boolean penDown
private double angle
private java.awt.Color color
public TurtleGraphics(int width, int height, java.lang.String windowName)
public TurtleGraphics(int width, int height)
public void penDown()
public void changeColor(java.awt.Color color)
color
- public void penUp()
public void forward(double distance)
distance
- The distance to movepublic void jump(int x, int y)
x
- X coordinate of the destinationy
- Y coordinate of the destinationpublic java.awt.Point getPosition()
public void setWidth(float w)
w
- public double getTurtleAngle()
public void turn(double angle)
angle
- specified angle in degreespublic void setAngle(double angle)
angle
- specified angle in degreespublic void turnRad(double angle)
angle
- specified angle in radianspublic void setAngleRad(double angle)
angle
- specified angle in radianspublic double getTurtleAngleRad()
public void setMouseMotionManager(java.awt.event.MouseMotionListener mouseMotionListener)