Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canvas ¶
type Canvas interface {
CreateNewSprite() Sprite
SetCartesianPixel(x, y int, c color.RGBA) // Cartesian (x,y). Center in the middle of the window
SetPixel(x, y int, c color.RGBA) // Computer graphics (x,y). So y=0 is the top of the window, positive down.
Fill(x, y int, c color.RGBA) // Cartesian (x,y). Center in the middle of the window
ClearScreen(c color.RGBA)
GetWidth() int
GetHeight() int
GetUserInput() UserInput
}
type Keys ¶
type Keys struct {
LeftArrow bool
RightArrow bool
UpArrow bool
DownArrow bool
A bool
B bool
C bool
D bool
E bool
F bool
G bool
H bool
I bool
J bool
K bool
L bool
M bool
N bool
O bool
P bool
Q bool
R bool
S bool
T bool
U bool
V bool
W bool
X bool
Y bool
Z bool
Number0 bool
Number1 bool
Number2 bool
Number3 bool
Number4 bool
Number5 bool
Number6 bool
Number7 bool
Number8 bool
Number9 bool
F1 bool
F2 bool
F3 bool
F4 bool
F5 bool
F6 bool
F7 bool
F8 bool
F9 bool
F10 bool
F11 bool
F12 bool
Space bool
Backspace bool
Tab bool
LeftShift bool
RightShift bool
LeftCtrl bool
RightCtrl bool
LeftAlt bool
RightAlt bool
Enter bool
Delete bool
Escape bool
Backquote bool
Minus bool
Equal bool
Comma bool
Period bool
SemiColon bool
Apostrophe bool
ForwardSlash bool
BackSlash bool
OpenSquareBracket bool
CloseSquareBracket bool
}
type MouseButtons ¶
type Sprite ¶ added in v0.1.0
type Sprite interface {
SetSpriteImage(image.Image)
SetSpriteImageTurtle()
SetSpriteImageArrow()
SetRotation(radianAngle float64)
SetPosition(cartX, cartY float64) // Cartesian (x,y). Center in the middle of the window
SetVisible(visible bool)
SetScale(scale float64)
Set(visible bool, cartX, cartY, radianAngle float64) // Cartesian (x,y). Center in the middle of the window
}
type Turtle ¶
type Turtle interface {
Forward(distance float64)
F(distance float64) // Forward alias
Backward(distance float64)
B(distance float64) // Backward alias
PanRightward(distance float64)
PanR(distance float64) // PanRightward alias
PanLeftward(distance float64)
PanL(distance float64) // PanLeftward alias
GoTo(x, y float64) // Cartesian (x,y). Center in the middle of the window
GetPos() (x, y float64) // Cartesian (x,y). Center in the middle of the window
Left(angle float64)
L(angle float64) // Turn Left alias
Right(angle float64)
R(angle float64) // Turn Right alias
Angle(angle float64)
GetAngle() float64
PointToward(x, y float64)
DegreesMode() // Default is degrees mode.
RadiansMode()
CompassMode() // Make it so North is 0 degrees, East is 90...
GetAngleMode() AngleMode
Speed(PixelsPerSecond float64)
GetSpeed() float64
PenUp()
PU() // Pen Up alias
Off() // Pen Up alias
PenDown()
PD() // Pen Down alias
On() // Pen Down alias
Color(c color.RGBA)
GetColor() color.RGBA
Size(size float64)
GetSize() float64
Dot(size float64)
Fill(c color.RGBA)
// Draw a circle with given radius. The center is radius units left of the turtle; angleAmountToDraw determines
// which part of the circle is drawn. If angleAmountToDraw is not a full circle, one
// endpoint of the arc is the current pen position. Draw the arc in counterclockwise direction if radius is positive,
// otherwise in clockwise direction. Finally the direction of the turtle is changed by the amount of angleAmountToDraw.
//
// As the circle is approximated by an inscribed regular polygon, steps determines the number of steps to use.
// May be used to draw regular polygons.
Circle(radius, angleAmountToDraw float64, steps int)
ShowTurtle()
HideTurtle() // Default
ShapeAsTurtle() // Default
ShapeAsArrow()
ShapeAsImage(in image.Image)
ShapeScale(scale float64)
}
Click to show internal directories.
Click to hide internal directories.