www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Fluid 0.6.0 =?UTF-8?B?4oCU?= UI library for D

reply cookiewitch <artha samerion.com> writes:
Fluid is a library I started developing 3 years ago when I joined 
the D community, after failing to find a suitable library for my 
gamedev project. Developing user interfaces through websites, 
games or applications is something I've spent a significant 
amount of time in the past, so I saw this as an opportunity for 
developing a solution that combines the best aspects of different 
frameworks I have previously used, whereas targeted at web 
browsers, mobile applications, games or desktop. Similarly to how 
many praise D for being both great for prototyping and amazingly 
scalable, I found that I would love to build something that 
shares both of those traits.

![Hello World from 
Fluid!](https://git.samerion.com/Samerion/Fluid/media/branch/main/resources/hello-fluid.png)

Fluid is a flexible UI library for the D programming language. 
Minimal setup. Declarative. Non-intrusive.

```d
auto root = vspace(
     .layout!"center",
     label(
         .layout!"center",
         "Hello World from"
     ),
     imageView("./logo.png"),
);
```

Fluid is not standalone, but relies on other libraries to provide 
input and output facilities. It comes with build in support for 
[Raylib 5][raylib] and [arsd.simpledisplay][sdpy]. Integration is 
seamless, as one or two calls do the job.

```d
while (!WindowShouldClose) {

     BeginDrawing();

         ClearBackground(color!"#fff");
         root.draw();

     EndDrawing();

}
```

Fluid comes with a number of helpful nodes that you can use to 
build your interface. Communicate with the user using `label`, 
`button`, `textInput`, `fileInput`, `scrollInput`, and quickly 
build layouts using simple and easy to learn `space`, `frame`, 
`nodeSlot`, `grid`, `mapSpace`.

Fluid exposes a high-level API, provides layout capabilities that 
are responsive-by-default, Unicode support and text rendering 
with Freetype2, reliable mouse, keyboard and gamepad support, is 
themable, extensible and looks great on HiDPI displays.

Supported platforms: Windows, Linux, macOS*, with plans to 
support Android and WASM.

The showcase should be a nice introduction to the library, 
describing each feature, providing live examples and code 
snippets. It's still a work in progress, so don't expect it to be 
complete nor perfect by any means, but I hope to improve it with 
further updates.

```
dub run fluid:showcase
```

If you'd like to start a new DUB projects with Fluid, you can 
start with a template:

```
dub init -t fluid
```



While I still have work to do to make Fluid as good as I want it 
to be, both in regards of performance and usability, I believe 
that 0.6.0, being the biggest update yet, is a breakthrough 
moment in Fluid's development, and the library is only about to 
gain stability.

Most importantly, 0.6.0 is the first release to no longer 
exclusively rely on Raylib. As noted earlier, it's already 
possible to use Fluid with [arsd.simpledisplay][sdpy]. This opens 
a lot of new possibilities, since Fluid could be used with 
*anything* as long as you implement the `FluidBackend` interface.

This release also completely reworked input, making the entire 
interface immediately controllable with tabs and arrow keys. All 
mouse, keyboard and gamepad binds are configurable and can easily 
be used in user-provided nodes via Input Actions. It is also the 
first to introduce the new showcase. A full changelog is 
available on 
https://git.samerion.com/Samerion/Fluid/releases/tag/v0.6.0



Fluid is still lacking a number of features. Speaking of numbers, 
no `numberInput`, for example. But having just reinforced the 
code of the library, I think it's a great time to add all that is 
now missing, see 
<https://git.samerion.com/Samerion/Fluid/issues/74>. Despite of 
this, Fluid is already in a great state and can be used in 
practical scenarios. New nodes aren't difficult to add.

The roadmap for Fluid sees just two missing major pre-releases, 
with only one of them possibly introducing any greater breaking 
changes. The theming system needs a refactor, which I believe 
will make it more powerful and easier to use, and I plan to do so 
in 0.7.0.

Changes I made to the backend side of Fluid make it possible to 
expand the reach of Fluid. I'm interested in making it work with 
[Hipreme Engine](https://github.com/MrcSnm/HipremeEngine) because 
of the engine's great portability. I'm also very excited to 
expand outside of game development and try and make the library 
integrate with naive UI frameworks or at least mimic their look.

Later on, along with 0.8.0, I plan to develop a graphical, live 
editor for Fluid user interfaces, with support for debugging and 
analysis of running programs.



It's typical for many D projects now that they come and go, 
libraries are born out of hobby projects just to be forgotten and 
abandoned later. Will this happen to Fluid?

Fluid has mostly been developed in bursts. Development slows 
downs or stops for some time, then resumes with me pushing a lot 
of changes and new features. This is a model that I find 
necessary since I'm the sole maintainer. Fluid however, has been 
in development for 3 years now, which bodes it well in regards to 
its future. Moreover, now almost every project of mine depends on 
Fluid in one way or another.

I'm active on the [D language 
Discord](https://discord.gg/MZ9eB37Uta), and in the future I 
might also consider the option of commercial support, if someone 
finds it needed.

Even if at this point Fluid doesn't satisfy all needs, I really 
hope in the future it'll grow to be a suitable solution for 
developing different kinds of user interfaces.

[raylib]: https://www.raylib.com/
[sdpy]: https://arsd-official.dpldocs.info/arsd.simpledisplay.html
Jan 25
next sibling parent cookiewitch <artha samerion.com> writes:
On Thursday, 25 January 2024 at 12:33:31 UTC, cookiewitch wrote:
 Fluid is a library I started developing 3 years ago when I 
 joined the D community, after failing to find a suitable 
 library for my gamedev project. Developing user interfaces 
 through websites, games or applications is something I've spent 
 a significant amount of time in the past, so I saw this as an 
 opportunity for developing a solution that combines the best 
 aspects of different frameworks I have previously used, whereas 
 targeted at web browsers, mobile applications, games or 
 desktop. Similarly to how many praise D for being both great 
 for prototyping and amazingly scalable, I found that I would 
 love to build something that shares both of those traits.

 [...]
Also, thanks to schveiguy, Hipreme, adr and members of the Raylib community for assisting me with this project, providing help and support over Discord, motivating me to work on this, while developing their own fantastic libraries and tools! <3
Jan 25
prev sibling next sibling parent Matheus Catarino <matheus-catarino hotmail.com> writes:
On Thursday, 25 January 2024 at 12:33:31 UTC, cookiewitch wrote:
 Fluid is a library I started developing 3 years ago when I 
 joined the D community, after failing to find a suitable 
 library for my gamedev project. Developing user interfaces 
 through websites, games or applications is something I've spent 
 a significant amount of time in the past, so I saw this as an 
 opportunity for developing a solution that combines the best 
 aspects of different frameworks I have previously used, whereas 
 targeted at web browsers, mobile applications, games or 
 desktop. Similarly to how many praise D for being both great 
 for prototyping and amazingly scalable, I found that I would 
 love to build something that shares both of those traits.

 [...]
Wow. Congrats on your project, it looks interesting and visually modern.
Jan 25
prev sibling next sibling parent zjh <fqbqrr 163.com> writes:
On Thursday, 25 January 2024 at 12:33:31 UTC, cookiewitch wrote:
 Fluid is a library I started developing 3 years ago when I 
 joined the D community, after failing to find a suitable 
 library for my gamedev project. Developing user interfaces 
 through websites, games or applications is something I've spent 
 a significant amount of time in the past, so I saw this as an 
 opportunity for developing a solution that combines the best 
 aspects of different frameworks I have previously used, whereas 
 targeted at web browsers, mobile applications, games or desktop.
Nice,I'll try it!
Jan 25
prev sibling next sibling parent Sebastiaan Koppe <mail skoppe.eu> writes:
On Thursday, 25 January 2024 at 12:33:31 UTC, cookiewitch wrote:
 Fluid is a flexible UI library for the D programming language. 
 Minimal setup. Declarative. Non-intrusive.
Awesome!
Jan 25
prev sibling next sibling parent cookiewitch <artha samerion.com> writes:
 Fluid is a library I started developing 3 years ago when I 
 joined the D community, after failing to find a suitable 
 library for my gamedev project. Developing user interfaces 
 through websites, games or applications is something I've spent 
 a significant amount of time in the past, so I saw this as an 
 opportunity for developing a solution that combines the best 
 aspects of different frameworks I have previously used, whereas 
 targeted at web browsers, mobile applications, games or 
 desktop. Similarly to how many praise D for being both great 
 for prototyping and amazingly scalable, I found that I would 
 love to build something that shares both of those traits.
 
 [...]
I have fixed reported Windows build problems, and now distribute Freetype binaries alongside the package. I've also updated dparse, fixing the LDC build. This means `dub run fluid:showcase` should now work out-of-the-box on both Linux and Windows. That's not the case for the showcase on macOS, but the DUB init template ought to work. If you want to run the showcase `brew install raylib` and then try `dub run fluid:showcase-raylib`. I will soon look into non-GL rendering to help improve this. Sorry to everybody who ran into these issues, and thank you for your patience!
Jan 27
prev sibling next sibling parent reply aberba <karabutaworld gmail.com> writes:
On Thursday, 25 January 2024 at 12:33:31 UTC, cookiewitch wrote:
 Fluid is a library I started developing 3 years ago when I 
 joined the D community, after failing to find a suitable 
 library for my gamedev project. Developing user interfaces 
 through websites, games or applications is something I've spent 
 a significant amount of time in the past, so I saw this as an 
 opportunity for developing a solution that combines the best 
 aspects of different frameworks I have previously used, whereas 
 targeted at web browsers, mobile applications, games or 
 desktop. Similarly to how many praise D for being both great 
 for prototyping and amazingly scalable, I found that I would 
 love to build something that shares both of those traits.

 [...]
Could you have a small documentation website? Could even be based on something like GitHub pages or readthedocs (https://readthedocs.io).
Jan 30
next sibling parent reply Bastiaan Veelo <Bastiaan Veelo.net> writes:
On Wednesday, 31 January 2024 at 06:38:17 UTC, aberba wrote:
 On Thursday, 25 January 2024 at 12:33:31 UTC, cookiewitch wrote:
 Fluid is a library I started developing 3 years ago when I 
 joined the D community, after failing to find a suitable 
 library for my gamedev project.
 [...]
Could you have a small documentation website? Could even be based on something like GitHub pages or readthedocs (https://readthedocs.io).
There is this https://fluid.dpldocs.info/v0.6.1/fluid.html and https://fluid.dpldocs.info/v0.6.1/fluid.showcase.html. -- Bastiaan.
Jan 31
parent aberba <karabutaworld gmail.com> writes:
On Wednesday, 31 January 2024 at 09:34:06 UTC, Bastiaan Veelo 
wrote:
 On Wednesday, 31 January 2024 at 06:38:17 UTC, aberba wrote:
 On Thursday, 25 January 2024 at 12:33:31 UTC, cookiewitch 
 wrote:
 Fluid is a library I started developing 3 years ago when I 
 joined the D community, after failing to find a suitable 
 library for my gamedev project.
 [...]
Could you have a small documentation website? Could even be based on something like GitHub pages or readthedocs (https://readthedocs.io).
There is this https://fluid.dpldocs.info/v0.6.1/fluid.html and https://fluid.dpldocs.info/v0.6.1/fluid.showcase.html. -- Bastiaan.
I think we all should learn to market our projects to appeal to more users. I've always thought that's why a number of great D project don't end up getting used because their maintainers do a poor job marketing them. This should be on the readme along with sample code.
Feb 04
prev sibling parent cookiewitch <artha samerion.com> writes:
On Wednesday, 31 January 2024 at 06:38:17 UTC, aberba wrote:
 On Thursday, 25 January 2024 at 12:33:31 UTC, cookiewitch wrote:
 Fluid is a library I started developing 3 years ago when I 
 joined the D community, after failing to find a suitable 
 library for my gamedev project. Developing user interfaces 
 through websites, games or applications is something I've 
 spent a significant amount of time in the past, so I saw this 
 as an opportunity for developing a solution that combines the 
 best aspects of different frameworks I have previously used, 
 whereas targeted at web browsers, mobile applications, games 
 or desktop. Similarly to how many praise D for being both 
 great for prototyping and amazingly scalable, I found that I 
 would love to build something that shares both of those traits.

 [...]
Could you have a small documentation website? Could even be based on something like GitHub pages or readthedocs (https://readthedocs.io).
I didn't work on proper documentation yet, you can however view what there is at dpldocs.info: https://fluid.dpldocs.info/fluid.html Right now the best learning resource is the showcase, available at `dub run fluid:showcase`
Feb 06
prev sibling parent reply cookiewitch <artha samerion.com> writes:
On Thursday, 25 January 2024 at 12:33:31 UTC, cookiewitch wrote:
 Fluid is a library I started developing 3 years ago when I 
 joined the D community, after failing to find a suitable 
 library for my gamedev project. Developing user interfaces 
 through websites, games or applications is something I've spent 
 a significant amount of time in the past, so I saw this as an 
 opportunity for developing a solution that combines the best 
 aspects of different frameworks I have previously used, whereas 
 targeted at web browsers, mobile applications, games or 
 desktop. Similarly to how many praise D for being both great 
 for prototyping and amazingly scalable, I found that I would 
 love to build something that shares both of those traits.

 [...]
I've just released 0.6.2, which is focused on cross-platform fixes. Windows: * Static Windows libraries for Freetype have been replaced with dynamic ones, which makes it a lot easier to compile. macOS: * Freetype should now work correctly on both Intel and Apple Silicon. * Compiling using DMD has been marked as unsupported and Fluid will refuse to compile by default. Use `Fluid_Force` to override. * Disable coordinate scaling, since macOS does that automatically; Apps should now scale correctly on Retina screens. * Implement analog scroll, scrolling should now feel far better.
Feb 06
parent reply ryuukk_ <ryuukk.dev gmail.com> writes:
On Wednesday, 7 February 2024 at 07:43:58 UTC, cookiewitch wrote:
 Windows:

 * Static Windows libraries for Freetype have been replaced with 
 dynamic ones, which makes it a lot easier to compile.
I am working on a PR that makes working with static libraries easier https://github.com/dlang/dmd/pull/15479
Feb 07
parent reply cookiewitch <artha samerion.com> writes:
On Wednesday, 7 February 2024 at 12:49:31 UTC, ryuukk_ wrote:
 On Wednesday, 7 February 2024 at 07:43:58 UTC, cookiewitch 
 wrote:
 Windows:

 * Static Windows libraries for Freetype have been replaced 
 with dynamic ones, which makes it a lot easier to compile.
I am working on a PR that makes working with static libraries easier https://github.com/dlang/dmd/pull/15479
That's good to know! Sadly the issue with Freetype static libraries is something with the C/C++ Microsoft runtime. I forgot to mention it's specific to LDC — as DMD has no trouble at all.
Feb 07
parent ryuukk_ <ryuukk.dev gmail.com> writes:
On Wednesday, 7 February 2024 at 15:27:34 UTC, cookiewitch wrote:
 On Wednesday, 7 February 2024 at 12:49:31 UTC, ryuukk_ wrote:
 On Wednesday, 7 February 2024 at 07:43:58 UTC, cookiewitch 
 wrote:
 Windows:

 * Static Windows libraries for Freetype have been replaced 
 with dynamic ones, which makes it a lot easier to compile.
I am working on a PR that makes working with static libraries easier https://github.com/dlang/dmd/pull/15479
That's good to know! Sadly the issue with Freetype static libraries is something with the C/C++ Microsoft runtime. I forgot to mention it's specific to LDC — as DMD has no trouble at all.
I am statically linking freetype in my game too, and have no issues, what's the issue exactly?
Feb 07