Skip to content

Latest commit

 

History

History

README.md

KAS Examples

Examples are grouped by complexity.

Simplest examples

Hello

A simple custom message box.

Hello

Counter

(Almost) the simplest interactive example possible: a counter with push-buttons.

Variant: sync-counter opens two windows with a synchronised counter.

Counter

Cursors

Curious what each mouse cursor available on your desktop (via winit) looks like?

Cursors

Layout

Demonstration of complex layout and multi-paragraph text.

Layout

Splitter

Demonstrates resizable panes.

Splitter

More complex examples

Calculator

A simple calculator show-casing the grid layout and keyboard support.

Calculator

Stopwatch

Ready? Set! Go!

Stopwatch

Sync-counter

A variant of Counter, demonstrating multiple windows and the SingleView widget (the simplest shared data widget).

Clock

A simple clock. This is example uses mid-level drawing routines over a transparent window.

Clock

Times-tables

A simple demonstration of the GridView widget.

Times-tables

Data list

This example demonstrates an interface over a list data structure of user-defined length. It has two implementations, both with (approximately) the same UI, but different internals:

  • data-list directly allocates a widget for each data entry and stores data within the widgets; it can scale to hundreds of entries or potentially tens of thousands when using release optimisations and tolerating some delays
  • data-list-view uses a dynamic view over a lazily-allocated data structure; performance is thus independent of the number of entries (though length is still limited by the maximum possible scroll offset; see issue #222)

Data list

Proxy

Demonstrates updating the UI in response to events from a background thread.

Async-event

Most-complex examples

Gallery

A testbed demoing most widgets, animations, data models, canvas and configuration.

Gallery Gallery

Mandlebrot

GPU-accelerated fractals via a custom embedded WGPU graphics pipeline.

Mandlebrot

Tools

Reformat Id

A kas::Id is a path. This tool can decode both an Id displayed with a leading # (as below) and codes converted to a u64 (where this is a compressed full path, not where this is a hash of a longer stack-allocated path).

$ cargo run --example reformat-id '#1001970'
[1, 0, 0, 1, 15, 0]

Copyright and Licence

The file includes a list of contributors who claim copyright on this project. This list may be incomplete; new contributors may optionally add themselves to this list.

The KAS library is published under the terms of the Apache License, Version 2.0. You may obtain a copy of this licence from the file or on the following webpage: https://www.apache.org/licenses/LICENSE-2.0