Skip to content

jagprog5/sdl-rust-ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sdl-rust-ui

Video🔗

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

For usage, see the examples and documentation.

What's Special?

Screen Updates

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.

Sizing Information

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).

std-lib

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages