RaylibView

Implements Raylib support through Fluid's I/O system. Use raylibStack or raylibView to construct.

RaylibView relies on a number of I/O systems that it does not implement, but must be provided for it to function. Use RaylibStack to initialize the chain along with default choices for these systems, suitable for most uses, or provide these systems as parent nodes:

* HoverIO for mouse support. Fluid does not presently support mobile devices through Raylib, and Raylib's desktop version does not fully support touchscreens (as GLFW does not). * FocusIO for keyboard and gamepad support. Gamepad support may currently be limited. * TimeIO for measuring time between mouse clicks. * PreferenceIO for user preferences from the system.

There is a few systems that RaylibView does not require, but are included in RaylibStack to support commonly needed functionality:

* ActionIO for translating user input into a format Fluid nodes can understand. * FileIO for loading and writing files.

RaylibView itself provides a number of I/O systems using functionality from the Raylib library:

* CanvasIO for drawing nodes and providing visual output. * MouseIO to provide mouse support. * KeyboardIO to provide keyboard support. * ClipboardIO to access system keyboard. * ImageLoadIO to load images using codecs available in Raylib.

Constructors

this
this(Node next)
Undocumented in source.

Members

Functions

alphaImageShader
Shader alphaImageShader()

Get the shader used for alpha images. This shader is loaded on the first resize, and is not accessible before.

cropArea
Optional!Rectangle cropArea()
Undocumented in source. Be warned that the author may not have intended to support it.
cropArea
void cropArea(Rectangle area)
Undocumented in source. Be warned that the author may not have intended to support it.
dpi
Vector2 dpi()
Undocumented in source. Be warned that the author may not have intended to support it.
drawCircleImpl
void drawCircleImpl(Vector2 center, float radius, Color color)
Undocumented in source. Be warned that the author may not have intended to support it.
drawCircleOutlineImpl
void drawCircleOutlineImpl(Vector2 center, float radius, float width, Color color)
Undocumented in source. Be warned that the author may not have intended to support it.
drawHintedImageImpl
void drawHintedImageImpl(DrawableImage image, Rectangle destination, Color tint)
Undocumented in source. Be warned that the author may not have intended to support it.
drawImageImpl
void drawImageImpl(DrawableImage image, Rectangle destination, Color tint)
Undocumented in source. Be warned that the author may not have intended to support it.
drawImpl
void drawImpl(Rectangle , Rectangle )
Undocumented in source. Be warned that the author may not have intended to support it.
drawLineImpl
void drawLineImpl(Vector2 start, Vector2 end, float width, Color color)
Undocumented in source. Be warned that the author may not have intended to support it.
drawRectangleImpl
void drawRectangleImpl(Rectangle rectangle, Color color)
Undocumented in source. Be warned that the author may not have intended to support it.
drawTriangleImpl
void drawTriangleImpl(Vector2 a, Vector2 b, Vector2 c, Color color)
Undocumented in source. Be warned that the author may not have intended to support it.
load
int load(fluid.Image image)
Undocumented in source. Be warned that the author may not have intended to support it.
loadImage
fluid.Image loadImage(ubyte[] image)
Undocumented in source. Be warned that the author may not have intended to support it.
palettedAlphaImageShader
Shader palettedAlphaImageShader(Color[] palette)

Get the shader used for palettedAlpha images. This shader is loaded on the first resize, and is not accessible before.

readClipboard
char[] readClipboard(char[] buffer, int offset)
Undocumented in source. Be warned that the author may not have intended to support it.
resetCropArea
void resetCropArea()
Undocumented in source. Be warned that the author may not have intended to support it.
resizeImpl
void resizeImpl(Vector2 )
Undocumented in source. Be warned that the author may not have intended to support it.
textureFor
raylib.Texture textureFor(DrawableImage image)

Get a Raylib texture for the corresponding drawable image. The image MUST be loaded.

toFluid
Vector2 toFluid(Vector2 position)
Vector2 toFluid(float x, float y)
Rectangle toFluid(Rectangle rectangle)

Convert position of a point or rectangle in Raylib space to Fluid space.

toRaylib
Vector2 toRaylib(Vector2 position)
Rectangle toRaylib(Rectangle rectangle)

Convert position of a point or rectangle in Fluid space to Raylib space.

updateKeyboard
void updateKeyboard()
Undocumented in source. Be warned that the author may not have intended to support it.
updateMouse
void updateMouse()
Undocumented in source. Be warned that the author may not have intended to support it.
writeClipboard
bool writeClipboard(string text)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

focusIO
FocusIO focusIO;
Undocumented in source.
hoverIO
HoverIO hoverIO;
Undocumented in source.
next
Node next;

Node drawn by this view.

preferenceIO
PreferenceIO preferenceIO;
Undocumented in source.
scale
auto scale;

Scale set for this view. It can be controlled through the FLUID_SCALE environment variable (expected to be a float, e.g. 1.5 or a pair of floats 1.5x1.25)

timeIO
TimeIO timeIO;
Undocumented in source.

Inherited Members

From Node

NodeAlign (from fluid.structs)
enum NodeAlign via public import fluid.structs : NodeAlign, Layout;
Undocumented in source.
Layout (from fluid.structs)
struct Layout via public import fluid.structs : NodeAlign, Layout;

Node parameter for setting the node layout.

Align (from fluid.structs)
enum NodeAlign via public import fluid.structs : Align = NodeAlign;
Undocumented in source.
Extra
class Extra
Undocumented in source.
tree
LayoutTree* tree;

Tree data for the node. Note: requires at least one draw before this will work.

layout
Layout layout;

Layout for this node.

tags
TagList tags;

Tags assigned for this node.

breadcrumbs
Breadcrumbs breadcrumbs;

Breadcrumbs assigned and applicable to this node. Loaded every resize and every draw.

ignoreMouse
bool ignoreMouse;

If true, mouse focus will be disabled for this node, so mouse signals will "go through" to its parents, as if the node wasn't there. The node will still detect hover like normal.

isOpaque
IsOpaque isOpaque;

Filter to apply to every result of inBounds, controlling how the node reacts to some events, such as mouse click or a finger touch.

isThemeExplicit
bool isThemeExplicit;

True if the theme has been assigned explicitly by a direct assignment. If false, the node will instead inherit themes from the parent.

minSize
auto minSize;

Minimum size of the node.

isHidden
bool isHidden [@property getter]

Check if the node is hidden.

isHidden
bool isHidden [@property setter]

Set the visibility

opEquals
bool opEquals(Object other)
bool opEquals(Node otherNode)
theme
inout(Theme) theme()

The theme defines how the node will appear to the user.

theme
Theme theme(Theme value)

Set the theme.

inheritTheme
void inheritTheme(Theme value)

Nodes automatically inherit theme from their parent, and the root node implicitly inherits the default theme. An explicitly-set theme will override any inherited themes recursively, stopping at nodes that also have themes set explicitly.

resetTheme
void resetTheme()

Clear the currently assigned theme

style
inout(Style) style()

Current style, used for sizing. Does not include any changes made by when clauses or callbacks.

show
This show()

Show the node.

hide
This hide()

Hide the node.

disable
This disable()

Disable this node.

enable
This enable()

Enable this node.

treeContext
inout(TreeContext) treeContext()
Undocumented in source. Be warned that the author may not have intended to support it.
backend
inout(FluidBackend) backend()
Undocumented in source. Be warned that the author may not have intended to support it.
backend
FluidBackend backend(FluidBackend backend)
Undocumented in source. Be warned that the author may not have intended to support it.
io
alias io = backend
Undocumented in source.
toggleShow
void toggleShow()

Toggle the node's visibility.

remove
void remove()

Remove this node from the tree before the next draw.

toRemove
bool toRemove(bool value)
bool toRemove()

toRemove is used to mark nodes for removal. A node marked as such should stop being drawn, and should be removed from the tree.

getMinSize
Vector2 getMinSize()

Get the minimum size of this node.

isHovered
bool isHovered [@property getter]

Check if this node is hovered.

isDisabled
inout(bool) isDisabled()

Check if this node is disabled.

isDisabledInherited
bool isDisabledInherited()

Checks if the node is disabled, either by self, or by any of its ancestors. Updated when drawn.

applyAll
void applyAll(Parameters params)

Apply all of the given node parameters on this node.

queueAction
void queueAction(TreeAction action)

Queue an action to perform within this node's branch.

startAction
void startAction(TreeAction action)

Perform a tree action the next time this node is drawn.

startBranchAction
auto startBranchAction(BranchAction action)
auto startBranchAction(T range)

Start a branch action (or multiple) to run on children of this node.

controlBranchAction
auto controlBranchAction(BranchAction action)
Undocumented in source.
controlBranchAction
auto controlBranchAction(T range)
Undocumented in source. Be warned that the author may not have intended to support it.
resizePending
bool resizePending()

True if this node is pending a resize.

updateSize
void updateSize()

Recalculate the window size before next draw.

draw
void draw()

Draw this node as a root node.

drawChild
void drawChild(Node child, Rectangle space)

Draw a child node at the specified location inside of this node.

draw
deprecated void draw(Rectangle space)

Draw this node at the specified location from within of another (parent) node.

marginBoxForSpace
Rectangle marginBoxForSpace(Rectangle space)

Get the node's margin box for given available space. The margin box, nor the available space aren't typically given to a node, but this may be useful for its parent nodes.

paddingBoxForSpace
Rectangle paddingBoxForSpace(Rectangle space)

Get the node's padding box (outer box) for set available space.

prepareChild
void prepareChild(Node child)

Prepare a child for use. This is automatically called by resizeChild and only meant for advanced usage.

resizeChild
Vector2 resizeChild(Node child, Vector2 space)

Resize a child of this node.

resize
deprecated void resize(LayoutTree* tree, Theme theme, Vector2 space)

Recalculate the minimum node size and update the minSize property.

focusPreviousOrNext
void focusPreviousOrNext(FluidInputAction actionType)

Switch to the previous or next focused item

focusInDirection
void focusInDirection(FluidInputAction action)

Switch focus towards a specified direction.

use
T use()
T use(T io)

Connect to an I/O system

require
T require()
T require(T io)

Require

load
void load(I io, T resource)

Load a resource associated with the given I/O.

implementIO
auto implementIO()

Enable I/O interfaces implemented by this node.

controlIO
mixintemplate controlIO()
Undocumented in source.
controlIO
auto controlIO()
Undocumented in source. Be warned that the author may not have intended to support it.
resizeImpl
void resizeImpl(Vector2 space)

This is the implementation of resizing to be provided by children.

drawImpl
void drawImpl(Rectangle paddingBox, Rectangle contentBox)

Draw this node.

hoveredImpl
bool hoveredImpl(Rectangle rect, Vector2 mousePosition)

Check if the node is hovered.

inBoundsImpl
IsOpaque inBoundsImpl(Rectangle outer, Rectangle inner, Vector2 position)
inBounds
IsOpaque inBounds(Rectangle outer, Rectangle inner, Vector2 position)

Test if the specified point is the node's bounds. This is used to map screen positions to nodes, such as when determining which nodes are hovered by mouse. If the node contains the point, then it is "opaque," and if not, it is "transparent".

ImplHoveredRect
alias ImplHoveredRect = implHoveredRect
Undocumented in source.
implHoveredRect
deprecated mixintemplate implHoveredRect()
Undocumented in source.
focusBoxImpl
Rectangle focusBoxImpl(Rectangle inner)

The focus box defines the *focused* part of the node. This is relevant in nodes which may have a selectable subset, such as a dropdown box, which may be more important at present moment (selected). Scrolling actions like scrollIntoView will use the focus box to make sure the selected area is presented to the user.

focusBox
alias focusBox = focusBoxImpl
Undocumented in source.
pickStyle
Style pickStyle()

Get the current style.

reloadStyles
void reloadStyles()

Reload style from the current theme.

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

From CanvasIO

dpi
Vector2 dpi()

Determines the screen's pixel density. A higher value will effectively scale up the interface, but keeping all detail. The I/O system should trigger a resize when this changes.

toDots
Vector2 toDots(Vector2 pixels)

Convert pixels to screen-dependent dots.

fromDots
Vector2 fromDots(Vector2 dots)

Measure distance in pixels taken by a number of dots.

cropArea
Optional!Rectangle cropArea()

Getter for the current crop area, if one is set. Any shape drawn is cropped to fit this area on the canvas.

cropArea
void cropArea(Rectangle area)
void cropArea(Optional!Rectangle area)

Set an area the shapes can be drawn in. Any shape drawn after this call will be cropped to fit the specified rectangle on the canvas.

intersectCrop
Optional!Rectangle intersectCrop(Rectangle rectangle)

Crop the area to fit. Unlike setting cropArea, this will not replace the old area, but create an intersection between the new and old area.

resetCropArea
void resetCropArea()

If cropArea was called before, this will reset set area, disabling the effect.

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

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

drawTriangleOutline
void drawTriangleOutline(Vector2 a, Vector2 b, Vector2 c, float width, Color color)

Draw an outline of a triangle.

drawCircleImpl
void drawCircleImpl(Vector2 center, float radius, Color color)
drawCircle
void drawCircle(Vector2 center, float radius, Color color)

Draw a circle.

drawCircleOutlineImpl
void drawCircleOutlineImpl(Vector2 center, float radius, float width, Color color)
drawCircleOutline
void drawCircleOutline(Vector2 center, float radius, float width, Color color)

Draw the outline of a circle.

drawRectangleImpl
void drawRectangleImpl(Rectangle rectangle, Color color)
drawRectangle
void drawRectangle(Rectangle rectangle, Color color)

Draw a rectangle.

drawRectangleOutline
void drawRectangleOutline(Rectangle rectangle, float width, Color color)

Draw an outline of a rectangle.

drawLineImpl
void drawLineImpl(Vector2 start, Vector2 end, float width, Color color)
drawLine
void drawLine(Vector2 start, Vector2 end, float width, Color color)

Draw a line between two points.

load
int load(Image image)

Prepare an image for drawing. For hardware accelerated backends, this may involve uploading the texture to the GPU.

drawImageImpl
void drawImageImpl(DrawableImage image, Rectangle destination, Color tint)
drawImage
void drawImage(DrawableImage image, Rectangle destination, Color tint)
void drawImage(DrawableImage image, Vector2 destination, Color tint)
drawHintedImageImpl
void drawHintedImageImpl(DrawableImage image, Rectangle destination, Color tint)

Draw an image on the canvas.

drawHintedImage
void drawHintedImage(DrawableImage image, Rectangle destination, Color tint)
Undocumented in source. Be warned that the author may not have intended to support it.
drawHintedImage
void drawHintedImage(DrawableImage image, Vector2 destination, Color tint)

Draw an image on the canvas.

From MouseIO

__anonymous
mixin inputEvents!(MouseIO, Button)
Undocumented in source.
press
alias press = click
Undocumented in source.
release
alias release = click
Undocumented in source.
Button
enum Button
Undocumented in source.

From KeyboardIO

__anonymous
mixin inputEvents!(KeyboardIO, Key)
Undocumented in source.
press
alias press = click
Undocumented in source.
Key
enum Key
Undocumented in source.

From ClipboardIO

writeClipboard
bool writeClipboard(string text)

Write text to the clipboard.

readClipboard
char[] readClipboard(char[] buffer, int offset)

Read text from the clipboard.

From ImageLoadIO

loadImage
Image loadImage(const(ubyte)[] image)

Load an image from raw bytes.

Meta