This is a (in progress) library for creating immediate mode user interfaces, built off of rust-sdl2.
For usage, see the examples and documentation.
Some GUI frameworks assume that the screen updates all the time, e.g. 60fps. Especially immediate mode GUIs. This makes the update order pretty lenient. If A depends on B, and A is updated before B, then A will be drawn with B's state from one frame behind. For most frameworks this doesn't matter, since once the next frame comes around it will get back in sync with the underlying data.
With this framework, the screen only needs to be updated once something happens. Everything will look as it should within that same frame. For the provided examples, the idle CPU usage is very near 0.
Widgets compose a tree hierarchy. Parent widgets receive sizing information from the children and layout appropriately.
I haven't seen sizing or layouts expressed in this specific way; most frameworks use a preferred size. Here, a preferred portion is used instead. This works well for letting the UI scale with the window size. There's also support for aspect ratios and "length failure" policies (what happens if a minimum or maximum can't be fulfilled by the parent).
- vertical layout
- horizontal layout
- scroll area
- clipper
- debug, for testing sizing
- strut, forces spaces
- background, solid color or parallel software rendering of a background texture
- border, contains a widget in a border with a border style
- texture, generic texture display with sizing control
- single and multiline labels
- single line text input
- button
- checkbox