Jump to page: 1 2
Thread overview
Fluid 0.7.0 has been released!
Oct 03
ryuukk_
Oct 04
Dennis
Oct 20
WB
Oct 24
IchorDev
Oct 24
IchorDev
Oct 25
IchorDev
Oct 31
IchorDev
Nov 02
IchorDev
3 days ago
IchorDev
October 03

After 9 months of development and 252 commits later, finally 0.7.0 gets to see the sunlight! This is the biggest update to Fluid yet, almost twice as big as 0.6.0, and also almost half the size of Fluid itself. In fact, so big, that I decided to delay some of the changes to a separate future update; too big.

Fluid is a general-purpose user interface library. It is D first, and comes with Raylib support. While largely a work in progress, and of pre-release quality, it's already mostly stable and ready for use.

Start a new Fluid project with DUB:

dub fetch fluid
dub init -t fluid myproject

Add Fluid to your existing project:

dub add fluid

Among other stuff, this update addresses feedback from community members. Folks reported a lot of issue with building this thing. Fluid now has CI coverage and should work just fine on all the three major platforms. Fluid's tour now also features an experimental, fully interactive "moduleView" chapter, which at the moment only works properly on Linux.

In short term, I hope to improve Fluid's documentation and add a number of missing features, mostly nodes. In long term, I would like to work on animations and reactive programming.

Full changelog can be seen on the releases page

Reworked theme system

Most importantly, 0.7.0 introduces a reworked theme system, one much more readable than the last:

import fluid.theme;  // explicit import needed!

auto theme = Theme(
    rule!Node(
        typeface        = Style.loadTypeface("noto.ttf"),
        fontSize        = 12.pt,
        textColor       = color("#fff"),
    ),
    rule!Frame(
        backgroundColor = color("#000"),
    ),
);

when rules can be used to alter the style based on any of the node's properties. Multiple when rules can be applied at the same time.

border          = 1,
borderStyle     = colorBorder(color("#444")),
backgroundColor = color("#000"),
when!"a.isHovered"(
    backgroundColor = color("#444"),
),
when!"a.isFocused"(
    borderStyle = colorBorder(color("#fff")),
),
when!(a => a.text.isValidPassword)(
    backgroundColor = color(color("#0a0")),
),

Rules can now also affect children nodes through children:

rule!PopupFrame(
    border = 1,
    borderStyle = colorBorder(color("#555")),
    children!Button(  // style all buttons inside PopupFrames
        margin = 0,
        padding.sideX = 4,
        padding.sideY = 2,
    )
),

For more advanced usecases, values can also be picked based on runtime values:

rule!Node(
    a => rule(
        backgroundColor = pickColor(a.score),
    ),
),

Extensible construction via node builder

This feature was covered on this year's DConf!

In the previous releases, Layout and Theme were taken directly as constructor arguments, which could be really confusing, and at the same time, limiting. Now, the nodeBuilder takes care of this automatically:

alias label = nodeBuilder!Label;
class Label : Node {
    this(string text) {
        // ...
    }
    // ...
}

label(
    .layout!"fill",
    .myTheme,
    "Hello, World!"
),

More interestingly, it's now extensible — for example, sizeLimit can be used with sizeLock nodes:

sizeLock!label(
    .sizeLimitX = 400,
    .layout!"fill",
    .myTheme,
    "Hello, World!"
)

You can define your own node property by creating a struct with an apply method:

auto hidden(bool value = true) {
    static struct Hidden {
        bool value;
        void apply(Node node) {
            node.isHidden = value;
        }
    }
    return Hidden(value);
}

label(
    .hidden,
    "I'm invisible!"
),

Other node properties are now available: .tags (see below), .ignoreMouse, .hidden and .disabled.

simpleConstructor remains alive as an alias to nodeBuilder.

Tags

One can now define an enum marked @NodeTag to create tags. These are very similar to CSS classes, making it possible to change how a node is styled in a consistent, predictable manner:

@NodeTag
enum Tag {
    heading,
    red,
}

vspace(
    myTheme,
    label(
        .tags!(Tag.heading),
        "This is a heading!"
    ),
    label(
        .tags!(Tag.red),
        "Red text!"
    ),
	label(
        .tags!(Tag.heading, Tag.red),
        "Red heading!"
    ),
);

Use tags in your theme by passing them into a rule argument:

rule!(Label, Tag.heading)(
    fontSize = 22.pt,
),
rule!(Label, Tag.red)(
    textColor = color("#f00"),
).

TextInput was overhauled

TextInput now supports multiline input via .multiline, the caret can now be moved around, text can be selected, copied, pasted, and changes can be undone or redone with keyboard shortcuts.

textInput();  // single line
lineInput();  // single line
multilineInput();       // multiline
textInput(.multiline);  // multiline
codeInput();  // code editor

This is a massive change under the hood. Fluid's text rendering is now a lot more performant, and can support rendering pages of text without slowdowns. Editing performance still needs some improvements.

A code editor is now available with CodeInput with support for syntax highlighting and automatic indentation. Performance issues are especially visible with this one, but it is expected they will be fixed in coming releases.

Full changelog can be seen on the releases page

October 03

Congrats on the release

You should include some example with some screenshots, it'll be great way to advertise both the library and D

Your library has lot of potential

October 04

Nice!

On Thursday, 3 October 2024 at 11:15:16 UTC, cookiewitch wrote:

>

Start a new Fluid project with DUB:

dub fetch fluid
dub init -t fluid myproject

I tried dub run fluid:showcase, but it gives an error about a raylib import it can't resolve.

../../.dub/packages/fluid/0.7.0/fluid/tour/package.d(173,12): Error: unable to read module `raylib`

dub run fluid:tour does work though.

October 05

On Thursday, 3 October 2024 at 11:15:16 UTC, cookiewitch wrote:

>

After 9 months of development and 252 commits later, finally 0.7.0 gets to see the sunlight! This is the biggest update to Fluid yet, almost twice as big as 0.6.0, and also almost half the size of Fluid itself. In fact, so big, that I decided to delay some of the changes to a separate future update; too big.

[...]

Congratulations ! I will definitely try this one ! Thank you so much, I was looking for an UI native library, good timing !

October 05

On Friday, 4 October 2024 at 12:14:09 UTC, Dennis wrote:

>

Nice!

On Thursday, 3 October 2024 at 11:15:16 UTC, cookiewitch wrote:

>

Start a new Fluid project with DUB:

dub fetch fluid
dub init -t fluid myproject

I tried dub run fluid:showcase, but it gives an error about a raylib import it can't resolve.

../../.dub/packages/fluid/0.7.0/fluid/tour/package.d(173,12): Error: unable to read module `raylib`

dub run fluid:tour does work though.

dub fluid:showcase should issue a warning recommending :tour now. I'm going to be honest, I didn't check if it still works. ^^

October 05

On Saturday, 5 October 2024 at 08:44:58 UTC, holyzantaclara wrote:

>

On Thursday, 3 October 2024 at 11:15:16 UTC, cookiewitch wrote:

>

After 9 months of development and 252 commits later, finally 0.7.0 gets to see the sunlight! This is the biggest update to Fluid yet, almost twice as big as 0.6.0, and also almost half the size of Fluid itself. In fact, so big, that I decided to delay some of the changes to a separate future update; too big.

[...]

Congratulations ! I will definitely try this one ! Thank you so much, I was looking for an UI native library, good timing !

Hm, for what it's worth it uses OpenGL at the moment, but integrating with OS-specific toolkits is something I plan to do. At least it's not a web browser!

October 20

On Thursday, 3 October 2024 at 11:15:16 UTC, cookiewitch wrote:

>

Start a new Fluid project with DUB:

...

Kind of does not work out of the box:

```
user@debian:~/k$ dub run fluid:tour
             Package 'fluid:tour' was not found locally but is available online:
             ---
             Description: A straightforward and easy to use GUI library.
             Version: 0.7.0
             ---
Do you want to fetch 'fluid:tour' now? [Y/n]: Y
    Fetching fluid:tour 0.7.0
             Building package fluid:tour in /home/user/.dub/packages/fluid/0.7.0/fluid/tour/
    Fetching raylib-d 5.0.1 (getting selected version)
    Fetching silly 1.1.1 (getting selected version)
    Fetching bindbc-freetype 1.1.1 (getting selected version)
    Fetching fluid-tree-sitter 0.1.7 (getting selected version)
    Fetching bindbc-loader 1.1.5 (getting selected version)
    Fetching libdparse 0.23.2 (getting selected version)
    Starting Performing "debug" build using /usr/bin/gdc for x86_64.
    Building bindbc-freetype 1.1.1: building configuration [staticBC]
    Building bindbc-loader 1.1.5: building configuration [noBC]
    Building fluid 0.7.0: building configuration [linux-dynamic]
    Building fluid-tree-sitter:tree-sitter 0.1.7: building configuration [default]
gdc: error: unrecognized command-line option ‘-P-I/home/user/.dub/packages/fluid-tree-sitter/0.1.7/fluid-tree-sitter/external/tree-sitter/lib/include’
gdc: error: unrecognized command-line option ‘-P-I/home/user/.dub/packages/fluid-tree-sitter/0.1.7/fluid-tree-sitter/external/tree-sitter/lib/src’
Error /usr/bin/gdc failed with exit code 1.
user@debian:~/k$
```

versions:

user@debian:~/k$ dub --version
DUB version 1.36.0-3+b1, built on Aug  1 2024
user@debian:~/k$ gdc -v
Using built-in specs.
COLLECT_GCC=gdc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/14/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 14.2.0-3' --with-bugurl=file:///usr/share/doc/gcc-14/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust --prefix=/usr --with-gcc-major-version-only --program-suffix=-14 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/reproducible-path/gcc-14-14.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/reproducible-path/gcc-14-14.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.0 (Debian 14.2.0-3)
user@debian:~/k$
October 21

On Sunday, 20 October 2024 at 21:59:49 UTC, WB wrote:

>

On Thursday, 3 October 2024 at 11:15:16 UTC, cookiewitch wrote:

>

Start a new Fluid project with DUB:

...

Kind of does not work out of the box:

```
user@debian:~/k$ dub run fluid:tour
    [...]
    Building fluid-tree-sitter:tree-sitter 0.1.7: building configuration [default]
gdc: error: unrecognized command-line option ‘-P-I/home/user/.dub/packages/fluid-tree-sitter/0.1.7/fluid-tree-sitter/external/tree-sitter/lib/include’
gdc: error: unrecognized command-line option ‘-P-I/home/user/.dub/packages/fluid-tree-sitter/0.1.7/fluid-tree-sitter/external/tree-sitter/lib/src’
Error /usr/bin/gdc failed with exit code 1.
user@debian:~/k$
```

versions:

user@debian:~/k$ dub --version
DUB version 1.36.0-3+b1, built on Aug  1 2024
user@debian:~/k$ gdc -v
Using built-in specs.
COLLECT_GCC=gdc
[...]
gcc version 14.2.0 (Debian 14.2.0-3)
user@debian:~/k$

Fluid requires DMD≥2.098.1 or LDC≥1.28.1. The tour requires a newer compiler than that (meanining Fluid itself might still work) but I did not pinpoint the exact version. GDC is not supported.

October 24

On Monday, 21 October 2024 at 02:31:19 UTC, cookiewitch wrote:

>

Fluid requires DMD≥2.098.1 or LDC≥1.28.1. The tour requires a newer compiler than that (meanining Fluid itself might still work) but I did not pinpoint the exact version. GDC is not supported.

Is it going to be supported?

October 24

On Thursday, 3 October 2024 at 11:15:16 UTC, cookiewitch wrote:

>

After 9 months of development and 252 commits later, finally 0.7.0 gets to see the sunlight!

This project certainly seems promising, although I’m rather worried about how many classes there are with almost no data—so many allocations for what could just be a struct with function pointers, no? That’s how FreeType does ‘inheritance’ in pure C.

Anyway, at this stage, how difficult is it to make a custom Fluid backend? (e.g. SDL2 for input or a different renderer)
Also does this project have proper text layout support? I noticed there’s a dependency on FreeType; but FreeType doesn’t do layout, only rendering. I’m about to release BindBC-Pango if you need a text layout engine. They’re absolutely imperative for acceptable internationalisation support.

« First   ‹ Prev
1 2