RmlUi 5.0
The release of RmlUi 5.0 brings several larger changes to the library. The main one being the backends concept, which will help integration for new users in particular, and ease the development for additional renderers and platforms. We have already added several new ones, such as a more modern OpenGL renderer, a Vulkan renderer, and the GLFW windowing library.
There should also be plenty of features and important fixes for both new and existing users to enjoy with this release. Some big ones include support for sibling (+
and ~
) and attribute ([foo]
) selectors in RCSS, a large overhaul of the text input widget, and ensuring that the hover state of elements is always updated even without any mouse movement.
I want to thank all the contributors for their pull requests, which help make this library better for everyone. We also have a number of new contributors, which is very nice to see. A special thanks goes to @barotto, @hobyst, and @shubin for helping to write the documentation, with pull requests on the documentation repository. I also got a lot of feedback from several users regarding the backends concept, in particular a detailed one from @jbatnozic, thank you to everyone!
The documentation has been updated to reflect all the new changes. I've also been working for some time now to improve the documentation navigation, in particular with a search function. I'm interested to hear feedback on how well this works.
With this release comes a refreshed logo as well! I hope you like it.
Changelog
Backends
RmlUi 5.0 introduces the backends concept. This is a complete refactoring of the old sample shell, replacing most of it with a multitude of backends. A backend is a combination of a renderer and a platform, and a light interface tying them together. The shell is now only used for common functions specific to the included samples.
This change is beneficial in several aspects:
- Makes it easier to integrate RmlUi, as users can directly use the renderer and platform suited for their setup.
- Makes it a lot easier to add new backends and maintain existing ones.
- Allows all the samples to run on any backend by choosing the desired backend during CMake configuration.
All samples and tests have been updated to work with the backends interface, which is a very light abstraction over all the different backends.
The following renderers and platforms are included:
- A new OpenGL 3 renderer. #261
- Including Emscripten support so RmlUi even runs in web browsers now.
- A new Vulkan renderer. #236 #328 #360 #385 (thanks @wh1t3lord)
- A new GLFW platform.
- The OpenGL 2 and SDL native renderers ported from the old samples.
- The Win32, X11, SFML, and SDL platforms ported from the old samples.
The old macOS shell has been removed as it used a legacy API that is no longer working on modern Apple devices. Now the samples build again on macOS using one of the windowing libraries such as GLFW or SDL.
See the Backends section in the readme for all the combinations of renderers and platforms, and more details. The backend used for running the samples can be selected by setting the CMake option SAMPLES_BACKEND
to any of the supported backends.
RCSS selectors
- Implemented the next-sibling
+
and subsequent-sibling~
combinators. - Implemented attribute selectors
[foo]
,[foo=bar]
,[foo~=bar]
,[foo|=bar]
,[foo^=bar]
,[foo$=bar]
,[foo*=bar]
. #240 (thanks @aquawicket) - Implemented the negation pseudo class
:not()
, including support for selector listsE:not(s1, s2, ...)
. - Refactored structural pseudo classes for improved performance.
- Selectors will no longer match any text elements, like in CSS.
- Selectors now correctly consider all paths toward the root, not just the first greedy path.
- Structural selectors are no longer affected by the element's display property, like in CSS.
RCSS properties
max-width
andmax-height
properties now support thenone
keyword.
Text editing
The <textarea>
and <input type="text">
elements have been improved in several aspects.
- Improved cursor navigation between words (Ctrl + Left/Right).
- Selection is now expanded to highlight selected newlines.
- When word-wrap is enabled, words can now be broken to avoid overflow.
- Fixed several issues where the text cursor would be offset from the text editing operations. In particular after word wrapping, or when suppressed characters were present in the text field's value. #313
- Fixed an issue where Windows newline endings (\r\n) would produce an excessive space character.
- Fixed operation of page up/down numpad keys being swapped.
- The input method editor (IME) is now positioned at the caret during text editing on the Windows backend. #303 #305 (thanks @xland)
- Fix slow input handling especially with CJK input on the Win32 backend. #311
- Improve performance on document load and during text editing.
Elements
- Extend the functionality of
Element::ScrollIntoView
. #353 (thanks @eugeneko) <img>
element: Fix wrong dp-scaling being applied when an image is cloned through a parent element. #310<handle>
element: Fix move targets changing size when placed using thetop
/right
/bottom
/left
properties.
Data binding
- Transform functions can now be called using C-like calling conventions, in addition to the previous pipe-syntax. Thus, the data expression
3.625 | format(2)
can now be identically expressed asformat(3.625, 2)
. - Handle null pointers when trying to access data variables. #377 (thanks @Dakror)
- Enable registering a custom data variable definition. #367 (thanks @Dakror)
Context input
- The hover state of any elements under the mouse will now automatically be updated during
Context::Update()
. #220 - Added
Context::ProcessMouseLeave()
which ensures that the hovered state is removed from all elements and stops the context update from automatically hovering elements. - When
Context::ProcessMouseMove()
is called next the context update will start updating hover states again. - Added support for mouse leave events on all backends.
Layout improvements
- Scroll and slider elements now use containing block's height instead of width to calculate height-relative values. #314 #321 (thanks @nimble0)
- Generate warnings when directly nesting flexboxes and other unsupported elements in a top-level formatting context. #320
- In some situations, changing the
top
/right
/bottom
/left
properties may affect the element's size. These situations are now correctly handled so that the layout is updated when needed.
Lua plugin
- Add
QuerySelector
andQuerySelectorAll
to the Lua Element API. #329 (thanks @Dakror) - Add input-related methods and
dp_ratio
to the Lua Context API. #381 #386 (thanks @shubin) - Lua objects representing C++ pointers now compare equal if they point to the same object. #330 (thanks @Dakror)
- Add length to proxy for element children. #315 (thanks @nimble0)
- Fix a crash in the Lua plugin during garbage collection. #340 (thanks @slipher)
Debugger plugin
- Show a more descriptive name for children in the element info window.
- Fixed a crash when the debugger plugin was shutdown manually. #322 #323 (thanks @LoneBoco)
SVG plugin
- Update texture when the
src
attribute changes. #361
General improvements
- Small performance improvement when generating font effects.
- Allow empty values in decorators and font-effects.
- RCSS located within document
<style>
tags can now take comments containing xml tags. #341 - Improve in-source function documentation. #334 (thanks @hobyst)
- Invader sample: Rename event listener and instancer for clarity.
General fixes
- Font textures are no longer being regenerated when encountering new ascii characters, fixes a recent regression.
- Logging a message without an installed system interface will now be written to cout instead of crashing the application.
- Fix several static analyzer warnings and one possible case of undefined behavior.
- SDL renderer: Fix images with no alpha channel not rendering. #239
Build fixes
- Fix compilation on Emscripten CI. #335 (thanks @hobyst)
- Fix compilation with EASTL. #350 (thanks @eugeneko)
Breaking changes
- Changed the signature of the keyboard activation in the system interface, it now passes the caret position and line height:
SystemInterface::ActivateKeyboard(Rml::Vector2f caret_position, float line_height)
. - Mouse and hover behavior may change in some situations as a result of the hover state automatically being updated on
Context::Update()
, even if the mouse is not moved. See above changes to context input. - Removed the boolean result returned from
Rml::Debugger::Shutdown()
. - RCSS selectors will no longer match text elements.
- RCSS structural pseudo selectors are no longer affected by the element's display property.
- Data binding: The signature of transform functions has been changed from
Variant& first_argument_and_result, const VariantList& other_arguments -> bool success
toconst VariantList& arguments -> Variant result
.
New Contributors
- @LoneBoco made their first contribution in #323
- @hobyst made their first contribution in #335
- @slipher made their first contribution in #340
- @eugeneko made their first contribution in #350
- @shubin made their first contribution in #381
Full Changelog: 4.4...5.0