Window

The main window

Handles drawing and input

struct Window {}

Disabled Default Constructor

A disabled default is present on this object. To use it, use one of the other constructors or a factory function.

Constructors

this
this(in string title, in int width, in int height, in WindowConfig config = WindowConfig(), in bool bindToGlobal = true)

Create a window

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Postblit

Copying this object is disabled.

A postblit is present on this object, but not explicitly documented in the source.

Members

Functions

addParticleBurst
void addParticleBurst(in ParticleEmitter emitter)

Create a burst of particles using the emitter

begin
void begin(in Color bg)

Start a frame

begin
void begin(in Color bg, in Camera cam)

Start a frame

close
void close()

Stop keeping the window alive

draw
void draw(in Color color, in Vector[Len] points)

Draw a polygon with each point following the next in a circle around the edge

draw
void draw(in Color color, in Circle circle)

Draw a circle with a given color

draw
void draw(in Color color, in Rectangle rect)

Draw a rectangle with a color

draw
void draw(in Texture tex, in Vector position, in Color col = Color.white)

Draw a texture at the given position with the given color

draw
void draw(in Texture tex, in float x, in float y, in Color col = Color.white)

Draw a texture at the given units with the given color

draw
void draw(in Texture tex, in Rectangle area, in float rotation = 0, in Vector origin = Vector(0, 0), in Vector scale = Vector(1, 1), in bool flipHorizontal = false, in bool flipVertical = false, in Color color = Color.white)

Draw a transformed textur

draw
void draw(in Texture tex, in float x, in float y, in float w, in float h, in float rot = 0, in float originX = 0, in float originY = 0, in float scaleX = 1, in float scaleY = 1, in bool flipHorizontal = false, in bool flipVertical = false, in Color color = Color.white)

Draw a transformed texture

draw
void draw(in Texture tex, in Transform trans, in float x, in float y, in float w, in float h, in bool flipHorizontal = false, in bool flipVertical = false, in Color color = Color.white)

Draw a texture with a precalculated transform

draw
void draw(ref scope Sprite sprite)

Draw a sprite to the screen

draw
float draw(ref in Font font, in char c, in float x, in float y, in Color col = Color.white)

Draw a character using a font and find the width it took

draw
void draw(ref in Font font, in string str, in float x, in float y, in float lineHeight = 1, in Color col = Color.white)

Draw a string using a font

draw
void draw(ref in Font font, in string str, in float x, in float y, in float maxWidth, in Color col = Color.white, in bool wrapOnWord = true, float lineHeight = 1)

Draw a wrapped string that can wrap on word or by character

end
void end()

Update particles and display the drawn objects

end
void end(in Tilemap!T map)

Update particles, check particles against the tilemap, and display the drawn objects

isKeyDown
bool isKeyDown(in string name)

Checks if a key is being held down by a key name

setShader
void setShader(in string vertexShader, in string fragmentShader, in string transformAttributeName = "transform", in string positionAttributeName = "position", in string texPositionAttributeName = "tex_coord", in string colorAttributeName = "color", in string textureAttributeName = "tex", in string colorOutputName = "outColor")

Sets the GLSL shader, see the GL backend docs

setTransform
void setTransform(in Camera cam)

Set the camera transform

wasKeyDown
bool wasKeyDown(in string name)

Checks if key was down previously by a key name

Properties

mouse
Vector mouse [@property getter]

Get the position of the mouse

Static functions

getInstance
Window* getInstance()

Get a global instance of the window

Variables

aspectRatio
float aspectRatio;

The target aspect ratio of the window

fps
uint fps;

The number of target frames per second

inUIMode
bool inUIMode;

If the window is drawing in UI Mode, where drawing ignores the camera

Meta