Crate tuig_ui

source ·
Expand description

The text UI system built for tuig, but usable outside of it.

There are three main ways to use this crate.

When rendering a UI, you’ll probably use Adapter to start out, since it encapsulates most of the required logic and just leaves you with the UI to write. You might find it doesn’t meet your needs, though, in which case its code can serve as a starting point. If there’s some obvious shortfall, please open a feature request, or even make your own crate with a more advanced one, since it’s only hitting public APIs.

When writing a UI, you’ll get a Region, possibly because you implemented Attachment. You can split it in a variety of ways – with anything that implements Splitter – and put more Attachments in the resulting child regions.

When making a totally new UI element, you’ll implement RawAttachment. But try to minimize how complex your raw attachments are – keeping them simple makes them easy to compose and adjust later.

There are a couple of basic examples in the repo that you may find useful.

Re-exports

Modules

Macros

  • Create a splitter for a Region which divides it into optionally separated columns.
  • Create a splitter for a Region which divides it into optionally separated rows.

Structs

  • A convenience wrapper to make it easier to manage screens, actions, and input in simple cases.
  • Tracks and presents the current state of inputs, based on past ones.
  • Something you can put an Attachment in.
  • A text framebuffer.
  • A mutable view into a region of a Screen.

Traits