TurtleGame

Inherit from this to make a game.

Members

Functions

canvas
Canvas* canvas()
draw
void draw()

Drawing with a canvas goes here. Override this function in your game.

elapsedTime
double elapsedTime()
exitGame
void exitGame()

Marks the game as finished. It will end in the next game loop iteration.

framebuffer
ImageRef!RGBA framebuffer()
keyboard
Keyboard keyboard()

Get keyboard API. Cannot be called before load().

load
void load()

Initialization go here. Override this function in your game. By default: do nothing.

mouse
Mouse mouse()

Get mouse API. Cannot be called before load().

mouseMoved
void mouseMoved(float x, float y, float dx, float dy)

Callback function triggered when the mouse is moved.

mousePressed
void mousePressed(float x, float y, MouseButton button, int repeat)

Callback function triggered when a mouse button is pressed.

mouseReleased
void mouseReleased(float x, float y, MouseButton button)

Callback function triggered when a mouse button is released.

mouseWheel
void mouseWheel(float wheelX, float wheelY)

Callback function triggered when a mouse wheel is turned.

resized
void resized(float width, float height)

Called whenever the window is resized. Override this function in your game.

root
Node root()

Root of the scene.

setBackgroundColor
void setBackgroundColor(RGBA color)

Changes the clear color to fill the screen with.

setTitle
void setTitle(const(char)[] title)

Changes the title of the window.

update
void update(double dt)

Scene updates go here. Override this function in your game. By default: do nothing.

windowHeight
double windowHeight()

Height of the window. Can only be used inside a draw override.

windowWidth
double windowWidth()

Width of the window. Can only be used inside a draw override.

Meta