Skip to content

jagprog5/sdl-rust-ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sdl-rust-ui

This is a (in progress) library for creating immediate mode user interfaces, built off of rust-sdl2.

For usage, see the examples and documentation.

Widget

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.

Sizing Information

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

Drawing

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.

std-lib

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

TODO

  • text input widget
  • audio
  • (maybe) better default style

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages