
https://www.pasteboard.co/kq06mZhDps32.png
(Note to self: This image is set to expire Oct 7, so I'll have to find another more permanent image dump later, or link to an image on a Github page.)
Current Features:
- Elements: Panel, Button, Image display, Text box, Windows, Contextual (basis of ContextMenu), ContextMenu, Dropdown Menu, ScrollBar, ScrollPane, DualArea.
- Elements have a transform for position, rotation, and scaling, with rotation being at 90-degree angles (for speed and simplicity), and an element's transform is relative to its parent's transform
- Elements can have rounded corners, borders, and some have multiple colors depending on their state
- All element features can be optionally set using a Style object passed to Element::style(). This is alot like deserializeAttributes() in Irrlicht but easier.
- Layouts can be used to control how child elements are placed and size - including layouts Flow (sequential), Grid, Pin (closest to Irrlicht's), and Stretch.
- Copy, Cut, and Paste from any element using keyboard shortcuts.
- OS mouse visual changes for various situations (like resizing windows, editing text, etc).
- Optional receiving of user input events from SDL3 with very little effort to include the feature. SDL3 is optional, and you could use Irrlicht for events if you wanted, but that will require converting from Irrlicht events to NAUI events.
- Font rendering includes bridge to Harfbuzz and Freetype (which makes for the pretty text you see in the sample image), which completes support for text-shaping (and no more ugly box fonts)
- Supports Text Input events, received via SDL3 (or manually, if you dare), which allows for input from Linux Anthy, Windows IME, and similar services.
- Callbacks for many things accept lambda functions, like Button::onClick(), Element::onHover(), and Button::onPressed().
TextBox special features:
- UTF-8 encoded text, UTF-32 done transparently for editing
- Text can be oriented left-to-right, right-to-left, top-down, and bottom-up
- Text orientation can be automatically detected from bcp language setting
- Selection of multiple-characters over multiple lines supported, with keyboard commands for controlling selection, AND selection works regardless of orientation
- Via FreeType2, support for text of any language is possible.
(Currently, only one font with one specification (e.g. bold, weight=100, size=14) is possible per TextBox. I plan to add RichTextBox later, but that's going to be alot more work.
Limitations:
- C++17 only
- Harfbuzz, Freetype, and Irrlicht must be installed separately and prior. (SDL3 code is already included)
Bonus:
- An naui::IrrApp class is included that does most of the setup work for you, so all you have to do for setup is tell it the app window size, which fonts to load, and where the icons directory is.
Comments:
My sample tests ran faster than the comparable Irrlicht versions, albeit this was done in the earlier stages of development and by manually transforming elements rather than using a layout, which could be slower.
Layouts make building a UI significantly smoother than Irrlicht. While Irrlicht was "fast" if you knew the exact dimensions, much of building a UI in Irrlicht involves doing math to position the next element. Layouts eliminate the need for any math on your part.
There are some things not very intuitive:
Some functions for setting element values must be called before others, otherwise the rendering features won't be properly set. These are properly handled if you set an element using Element::style(), but the other functions may not be intuitive.
There are things you will miss from Irrlicht: namely, simplicity
Elements require setting a transform and a bounding box, whereas Irrlicht was just a bounding box.
Creating new elements is a tricky task, which can be simple in one sense but requires checking the right boxes and overriding the correct functions to complete.
There are defects:
Trying to copy from an element (like a text box) only initiates the copy process, so if you delete this element and try to paste the contents elsewhere, you will probably crash the application. I haven't tried this, but I'm positive it'll happen. The only fix I can see is replacing the std::shared_ptr usages for storing elements with a reference-counting system like Irrlicht.
There are wont-fixes:
I noticed Irrlicht with OpenGL lags on my computer on certain things, like resizing the window, using either the native Irrlicht GUI or NAUI, which is annoying.