HeadlessBackend

Undocumented in source.
@safe
class HeadlessBackend : FluidBackend {}

Constructors

this
this(Vector2 windowSize)
Undocumented in source.

Members

Aliases

Drawing
alias Drawing = SumType!(DrawnLine, DrawnTriangle, DrawnRectangle, DrawnTexture)
Undocumented in source.
lines
alias lines = filterCanvas!DrawnLine
Undocumented in source.
rectangles
alias rectangles = filterCanvas!DrawnRectangle
Undocumented in source.
textures
alias textures = filterCanvas!DrawnTexture
Undocumented in source.
triangles
alias triangles = filterCanvas!DrawnTriangle
Undocumented in source.

Enums

State
enum State
Undocumented in source.

Functions

area
Rectangle area(Rectangle rect)

Set area within the window items will be drawn to; any pixel drawn outside will be discarded.

area
Rectangle area()
Undocumented in source. Be warned that the author may not have intended to support it.
assertRectangle
void assertRectangle(Rectangle r, Color color)

Throw an AssertError if given rectangle was never drawn.

assertTexture
void assertTexture(Texture texture, Vector2 position, Color tint)

Throw an AssertError if the texture was never drawn with given parameters.

assertTexture
void assertTexture(Rectangle r, Color color)

Throw an AssertError if given texture was never drawn.

assertTriangle
void assertTriangle(Vector2 a, Vector2 b, Vector2 c, Color color)

Throw an AssertError if given triangle was never drawn.

deltaTime
float deltaTime()

Get time elapsed since last frame in seconds.

dpi
Vector2 dpi()

Get HiDPI scale of the window. This is not currently supported by this backend.

drawLine
void drawLine(Vector2 start, Vector2 end, Color color)

Draw a line.

drawRectangle
void drawRectangle(Rectangle rectangle, Color color)

Draw a rectangle.

drawTexture
void drawTexture(Texture texture, Rectangle rectangle, Color tint, string altText)

Draw a texture.

drawTextureAlign
void drawTextureAlign(Texture texture, Rectangle rectangle, Color tint, string altText)

Draw a texture, but keep it aligned to pixel boundaries.

drawTriangle
void drawTriangle(Vector2 a, Vector2 b, Vector2 c, Color color)

Draw a triangle, consisting of 3 vertices with counter-clockwise winding.

filterCanvas
auto filterCanvas()

Get items from the canvas that match the given type.

hasJustResized
bool hasJustResized()

True if the user has just resized the window.

inputCharacter
dchar inputCharacter()

Get next queued character from user's input. The queue should be cleared every frame. Return null if no character was pressed.

inputCharacter
void inputCharacter(dchar character)
void inputCharacter(dstring str)

Insert a character into input queue.

isDown
bool isDown(MouseButton button)
Undocumented in source. Be warned that the author may not have intended to support it.
isDown
bool isDown(KeyboardKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
isDown
int isDown(GamepadButton button)
Undocumented in source. Be warned that the author may not have intended to support it.
isPressed
bool isPressed(MouseButton button)

Check if the given mouse button has just been pressed/released or, if it's held down or not (up).

isPressed
bool isPressed(KeyboardKey key)

Check if the given keyboard key has just been pressed/released or, if it's held down or not (up).

isPressed
int isPressed(GamepadButton button)

Check if the given gamepad button has been pressed/released or, if it's held down or not (up).

isReleased
bool isReleased(MouseButton button)
Undocumented in source. Be warned that the author may not have intended to support it.
isReleased
bool isReleased(KeyboardKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
isReleased
int isReleased(GamepadButton button)
Undocumented in source. Be warned that the author may not have intended to support it.
isRepeated
bool isRepeated(KeyboardKey key)

If true, the given keyboard key has been virtually pressed again, through a long-press.

isRepeated
int isRepeated(GamepadButton button)
Undocumented in source. Be warned that the author may not have intended to support it.
isTextureValid
bool isTextureValid(Texture texture)

Check if the given texture has a valid ID

isTextureValid
bool isTextureValid(uint id)
Undocumented in source. Be warned that the author may not have intended to support it.
isUp
bool isUp(MouseButton button)
Undocumented in source. Be warned that the author may not have intended to support it.
isUp
bool isUp(KeyboardKey key)
Undocumented in source. Be warned that the author may not have intended to support it.
isUp
int isUp(GamepadButton button)
Undocumented in source. Be warned that the author may not have intended to support it.
loadTexture
Texture loadTexture(Image image)
Undocumented in source. Be warned that the author may not have intended to support it.
loadTexture
Texture loadTexture(string filename)
Undocumented in source. Be warned that the author may not have intended to support it.
loadTexture
Texture loadTexture(string url, int width, int height)
Undocumented in source. Be warned that the author may not have intended to support it.
mouseCursor
FluidMouseCursor mouseCursor(FluidMouseCursor cursor)

Get or set mouse cursor icon.

mouseCursor
FluidMouseCursor mouseCursor()
Undocumented in source. Be warned that the author may not have intended to support it.
mousePosition
Vector2 mousePosition(Vector2 value)

Get/set mouse position

mousePosition
Vector2 mousePosition()
Undocumented in source. Be warned that the author may not have intended to support it.
nextFrame
void nextFrame(float deltaTime)

Switch to the next frame.

press
void press(KeyboardKey key)

Press the given key, and hold it until release. Marks as repeated if already down.

press
void press(MouseButton button)

Press the given button, and hold it until release.

press
void press(GamepadButton button)

Press the given button, and hold it until release.

reaper
TextureReaper* reaper()
Undocumented in source. Be warned that the author may not have intended to support it.
release
void release(KeyboardKey key)

Release the given keyboard key.

release
void release(MouseButton button)

Release the given mouse button.

release
void release(GamepadButton button)

Release the given mouse button.

resize
void resize(Vector2 size)

Resize the window.

restoreArea
void restoreArea()

Restore the capability to draw anywhere in the window.

saveSVG
void saveSVG(string filename)

Convert the canvas to SVG. Intended for debugging only.

scale
float scale()
Undocumented in source. Be warned that the author may not have intended to support it.
scale
float scale(float value)
Undocumented in source. Be warned that the author may not have intended to support it.
scroll
Vector2 scroll(Vector2 value)

Get/set mouse scroll

scroll
Vector2 scroll()
Undocumented in source. Be warned that the author may not have intended to support it.
toSVG
string toSVG()
toSVGElement
Element toSVGElement()

Convert the canvas to SVG. Intended for debugging only.

unloadTexture
void unloadTexture(uint id)

Destroy a texture created by this backend. texture.destroy() is the preferred way of calling this, since it will ensure the correct backend is called.

windowSize
Vector2 windowSize(Vector2 value)

Get or set the size of the window.

windowSize
Vector2 windowSize()
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

DrawnLine
struct DrawnLine
Undocumented in source.
DrawnRectangle
struct DrawnRectangle
Undocumented in source.
DrawnTexture
struct DrawnTexture
Undocumented in source.
DrawnTriangle
struct DrawnTriangle
Undocumented in source.

Variables

canvas
Appender!(Drawing[]) canvas;

All items drawn during the last frame

Inherited Members

From FluidBackend

isPressed
bool isPressed(MouseButton )

Check if the given mouse button has just been pressed/released or, if it's held down or not (up).

isReleased
bool isReleased(MouseButton )
Undocumented in source.
isDown
bool isDown(MouseButton )
Undocumented in source.
isUp
bool isUp(MouseButton )
Undocumented in source.
isPressed
bool isPressed(KeyboardKey )

Check if the given keyboard key has just been pressed/released or, if it's held down or not (up).

isReleased
bool isReleased(KeyboardKey )
Undocumented in source.
isDown
bool isDown(KeyboardKey )
Undocumented in source.
isUp
bool isUp(KeyboardKey )
Undocumented in source.
isRepeated
bool isRepeated(KeyboardKey )

If true, the given keyboard key has been virtually pressed again, through a long-press.

inputCharacter
dchar inputCharacter()

Get next queued character from user's input. The queue should be cleared every frame. Return null if no character was pressed.

isPressed
int isPressed(GamepadButton button)

Check if the given gamepad button has been pressed/released or, if it's held down or not (up) on any of the connected gamepads.

isReleased
int isReleased(GamepadButton button)
Undocumented in source.
isDown
int isDown(GamepadButton button)
Undocumented in source.
isUp
int isUp(GamepadButton button)
Undocumented in source.
isRepeated
int isRepeated(GamepadButton button)

If true, the given gamepad button has been virtually pressed again, through a long-press.

mousePosition
Vector2 mousePosition(Vector2 )

Get/set mouse position

mousePosition
Vector2 mousePosition()
Undocumented in source.
scroll
Vector2 scroll()

Get scroll value on both axes.

deltaTime
float deltaTime()

Get time elapsed since last frame in seconds.

hasJustResized
bool hasJustResized()

True if the user has just resized the window.

windowSize
Vector2 windowSize(Vector2 )

Get or set the size of the window.

windowSize
Vector2 windowSize()
Undocumented in source.
scale
float scale()
float scale(float )

Set scale to apply to whatever is drawn next.

dpi
Vector2 dpi()

Get horizontal and vertical DPI of the window.

hidpiScale
Vector2 hidpiScale()

Get the DPI value for the window as a scale relative to 96 DPI.

area
Rectangle area(Rectangle rect)

Set area within the window items will be drawn to; any pixel drawn outside will be discarded.

area
Rectangle area()
Undocumented in source.
restoreArea
void restoreArea()

Restore the capability to draw anywhere in the window.

mouseCursor
FluidMouseCursor mouseCursor(FluidMouseCursor )

Get or set mouse cursor icon.

mouseCursor
FluidMouseCursor mouseCursor()
Undocumented in source.
reaper
TextureReaper* reaper()

Texture reaper used by this backend. May be null.

loadTexture
Texture loadTexture(Image image)

Load a texture from memory or file.

loadTexture
Texture loadTexture(string filename)
Undocumented in source.
unloadTexture
void unloadTexture(uint id)
void unloadTexture(Texture texture)

Destroy a texture created by this backend. Always use texture.destroy() to ensure thread safety and invoking the correct backend.

drawLine
void drawLine(Vector2 start, Vector2 end, Color color)

Draw a line.

drawTriangle
void drawTriangle(Vector2 a, Vector2 b, Vector2 c, Color color)

Draw a triangle, consisting of 3 vertices with counter-clockwise winding.

drawRectangle
void drawRectangle(Rectangle rectangle, Color color)

Draw a rectangle.

drawTexture
void drawTexture(Texture texture, Rectangle rectangle, Color tint, string altText)

Draw a texture.

drawTextureAlign
void drawTextureAlign(Texture texture, Rectangle rectangle, Color tint, string altText)

Draw a texture, but ensure it aligns with pixel boundaries, recommended for text.

Meta