Crate hui

source ·
Expand description

Simple UI library for games and other interactive applications

§Features

  • derive (enabled by default) — Enable derive macros
  • image (enabled by default) — Enable image loading support using the image crate
  • builtin_font (enabled by default) — Enable the built-in font (ProggyTiny, adds 35kb to the executable)
§Pixel-perfect rendering:
  • pixel_perfect — Round all vertex positions to nearest integer coordinates (not recommended)
  • pixel_perfect_text (enabled by default) — Apply pixel-perfect rendering hack to text (fixes blurry text rendering)

Make sure to disable both features if you are not rendering UI “as-is” at 1:1 scale
For exmaple, you should disable them if using DPI (or any other form of) scaling while passing the virtual resolution to the ui or rendering it in 3d space

§Built-in elements:
  • el_all (enabled by default) — Enable all built-in elements
  • el_container — Enable the built-in Container element
  • el_fill_rect — Enable the built-in FillRect element
  • el_spacer — Enable the built-in Spacer element
  • el_br — Enable the built-in Break element
  • el_text — Enable the built-in Text element
  • el_image — Enable the built-in Image element
  • el_progress_bar — Enable the built-in ProgressBar element
  • el_slider — Enable the built-in Slider element
  • el_transformer — Enable the built-in Transformer element
  • el_interactable — Enable the built-in Interactable element

Modules§

  • various predefined color constants and helper functions
  • draw commands, tesselation and UI rendering.
  • element API and built-in elements like Container, Button, Text, etc.
  • input, window events and event handling
  • modular procedural background system
  • keyboard, mouse, and touch input handling
  • element layout, alignment and sizing
  • element measurement, hints and responses
  • contains types which represent the sides and corners of a rectangular shape.
  • signal handling for UI events
  • state managment for stateful elements
  • text rendering, styling, measuring

Macros§

  • Helper macro for constructing a FrameRect
  • Constructs a Size or Size2d from a literal or expression

Structs§