This is a (in progress) library for creating immediate mode user interfaces, built off of rust-sdl2.
For usage, see the examples and documentation.
A widget is a part of the interface. They are composed in a tree hierarchy in which a parent can contain some number of children.
A widget provides sizing information to be used by the parent:
- for both the width and height, each:
- minimum length
- maximum length
- preferred portion (e.g. 50% of parent)
- length failure policies (offset applied if a minimum or maximum can't be fulfilled by parent)
- requested aspect ratio
The parent accumulates sizing information from all the children and determines their positions for this frame. Once the positions are known, they are all updated, then all drawn.
Although sizing information is recalculated each frame, widgets should cache and reuse textures when appropriate.
These default widgets have been implemented:
Layouts:
Widgets
- debug, for testing sizing
- strut, forces spaces
- background, 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
- button
- checkbox
- text input widget
- audio
- (maybe) better default style