Pixel-widgets
pixel-widgets is a component based user interface library focused on integratability in graphical applications.
Features
- Very compact and easy API
- API agnostic rendering
Component
based workflow- CSS like styling
- Many built in widgets
- wgpu based renderer included
Overview
User interfaces in pixel-widgets are composed of Component
s. These components manage their own state, and generate ui elements when that state is mutated. Each component implements some methods:
view
- this method renders the ui elements for the current component state. When the state is updated, the view will be rendered again. method:update
- ui elements generate messages that will be passed to the update method. In here, a component will update it's internal state based on these messages.
Quick start
This example shows how to define a component and run it in the included sandbox. More work is required if you want to use pixel-widgets in your own game engine.
use *;
// The main component for our simple application
Then, we have to define a message type. The message type should be able to tell us what happend in the ui.
// The message type that will be used in our `Counter` component.
And finally, we must implement Component
use *;
// The main component for our simple application
// The message type that will be used in our `Counter` component.
async
Examples
If you want more examples, check out the examples directory in the git repository.