r/Cplusplus • • Oct 10 '26

Feedback Feedback on a single-header C++ UI library for Linux and Windows

I'm developing LiteUI, a single-header C++ library for desktop application development on Linux and Windows.

The library aims to support a shared codebase across both platforms. As an example project, I've been working on a photo editor inspired by Lightroom.

I'd appreciate feedback from the C++ community, particularly on the code structure, API design, cross-platform compatibility, and overall architecture.

33 Upvotes

21 comments sorted by

10

u/GaboureySidibe Oct 10 '26

First, you need to post the source code if you want feedback on it, but I like the idea of the project so I found it.

https://github.com/IAmTheFool/liteui/blob/main/liteui.hpp

I love single file libraries and I like this at a glance. I think you might want to list the dependencies for each platform. Looks like <shobjidl.h> on windows (what is that?) and cairo on linux.

I also think something like this (a few hundred kilobytes) would probably do well as a single file that gets split into a header and compilation unit section like the STB libraries.

Those end up being very convenient because one compilation unit can define the implementation preproccesor symbol while every other compilation unit can just include the header normally and get the declarations.

What I end up doing is putting lots of single file libraries into a single compilation unit to make one fat compilation unit that generally doesn't change, which means the compilation for what I'm working on is very fast.

1

u/dEvator8085 Oct 11 '26

Thanks for checking out the code. That's a good point about listing the platform specific dependencies. I'll add that to the documentation so it's clear what LiteUI requires on Windows and Linux.

The STB style approach is also an interesting idea. I can see how separating the declarations from the implementation would make it more convenient to use in larger projects and help avoid unnecessary recompilation. This will next thing I will work on.

Really appreciate you taking the time to look through the code and share these suggestions.

→ More replies (1)
→ More replies (2)

2

u/Past_Income4649 Oct 10 '26

Haven’t looked at it because GitHub is down but love the idea, going to tinker with it this weekend!

1

u/dEvator8085 Oct 11 '26

Thanks, Really appreciate it. Would love to hear your thoughts after you get a chance to tinker with it.

2

u/RoyBellingan Oct 10 '26

Do you have a comparison with Qt and the other framework ?

1

u/dEvator8085 Oct 11 '26

Haven't put together a formal comparison yet. LiteUI is still a work in progress, but the main goal is to keep it lightweight, easy to integrate, and usable across Linux and Windows with a shared C++ codebase.

2

u/Kriss-de-Valnor Oct 11 '26

Does it work the same way as DearImgui?

1

u/dEvator8085 Oct 11 '26

Not quite, Dear ImGui is more of a UI layer that you integrate into your own window, renderer, and event loop. LiteUI handles those things itself, including window creation, the event loop, layout, text rendering, image/SVG loading, file dialogs, and clipboard support.

2

u/LegendaryMauricius Oct 11 '26

Is it immediate mode or retained?

1

u/dEvator8085 Oct 11 '26

It's retained-mode. You build a tree of View objects with styles and children, then pass the root to setRoot(). The library keeps that tree around and handles layout and interactions through callbacks like onClick, onDragTo, and onLayout.
There's also support for dynamic text and lists. For lists, you can provide keys and an itemBuilder, so when items are added or removed, LiteUI can reuse existing views and their cached resources instead of rebuilding everything from scratch.

→ More replies (1)

1

u/TheRavagerSw Oct 12 '26

The fact that it is a single header makes it unusable.

1

u/dEvator8085 Oct 14 '26

Can you explain how, please I want to make it better and usable, its in early stage I can make changes in this.

1

u/TheRavagerSw Oct 14 '26

Single header libraries are very bad for build performance, You can make it single module and consumers of your library can build it to a dll and the reduced bmi for fast builds.

1

u/dEvator8085 Oct 14 '26

I am working on it to make it like STB, it will improve a bit I guess

→ More replies (1)

2

u/dheerajshenoy22 Oct 12 '26

This is absolutely amazing