Fluid 0.7.3 — a user interface library, now with a reworked I/O system
Artha
artha at samerion.com
Sun Feb 16 13:25:58 UTC 2025
[**Fluid is a user interface library for
D**](https://git.samerion.com/Samerion/Fluid). It supports Raylib
out of the box, and works on Linux, macOS and Windows.
* Fluid is declarative, making UI code easier to write and
understand.
* It is prepared to serve responsible apps, and supports HiDPI.
* Very extensible, providing API for custom nodes or binding
devices.
```sh
# Start a new project
dub fetch fluid at 0.7.2
dub init -t fluid my-project
# Learn the basics
dub run fluid:tour
```

## Update highlight: I/O system
Despite being a "patch" update — only the last digit has changed
— it is one of the largest updates, as I've completely reworked
the backend. To perform platform-specific functions, like drawing
to the screen, or taking keyboard or mouse input, Fluid defaults
to a monolithic `FluidBackend` interface. This monolith has
become very difficult to work with as the library has grown.
To address this issue, I introduced the new, *modular* I/O
system, with the intent of making it naturally integrate with
Fluid's node-based tree structure. Any node in the tree now has
the capability to replace individual I/O modules, essentially
creating an effect system.
The new system is disabled by default, and has to be enabled by
adding a system node as the root of the tree:
```d
// Use Raylib 5.5 as the backend
auto root = raylibStack.v5_5(
label("Hello, World!"),
);
```
Nodes now opt into each specific I/O system by calling either
`use` or `require`, depending on whether the system is required
or optional:
```d
class RedRectangle : Node {
// Declare your I/O systems
CanvasIO canvasIO;
// Load them
void resizeImpl(Vector2) {
require(canvasIO);
}
// Use them
void drawImpl(Rectangle, Rectangle inner) {
canvasIO.drawRectangle(inner, color("#f00"));
}
}
```
This system will completely replace the old backend in Fluid
0.8.0, which makes 0.7.3 a **transitional release**. If you're
writing an app with Fluid, I recommend upgrading and enabling the
new I/O system, so you can address issues before the upcoming big
release.
There still remain a few issues with the new system, but they
will be fixed with further updates.
**Full changelog:**
https://git.samerion.com/Samerion/Fluid/releases/tag/v0.7.3
**Keep the Fluid going and sponsor me on Patreon:
https://www.patreon.com/samerion**
## DConf 2025 topic selection
[My last talk on DConf
2024](https://www.youtube.com/live/AzezZhvIyS4?t=21126) covered
Fluid's use of D meta-programming to create its declarative
interface. This year, I'm split between Fluid and its parent
project, Samerion, as well as my personal attachment to the
language.
I would also like to spread the word around and put other
conferences on my schedule. I believe topics like Fluid's new I/O
system could be very interesting to audiences other than just the
D language community, but I'm not very familiar with other
options. If you know of any place that would accept talk
submissions in this area, please tell me about them!
As for DConf, I would like to know if there's any particular
topic relating to Fluid or my work that would be of interest to
any of you, so I could prioritize it when choosing the subject of
my next talk.
More information about the Digitalmars-d-announce
mailing list