Skip to content

Latest commit

 

History

History

examples

KAS Examples

Examples are listed below in alphabetical order.

If learning KAS, the Hello, Counter, Calculator, and perhaps Filter-list examples may be the most accessible. Also see the tutorials.

Async event

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

Async-event

Calculator

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

Calculator

Clock

A simple clock. An example of a custom widget using mid-level draw routines and timer updates.

Clock

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

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

Gallery

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

Gallery Gallery

Hello

A message box.

Hello

Layout

Demonstration of complex layout and multi-paragraph text.

Layout

Mandlebrot

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

Mandlebrot

Splitter

Demonstrates resizable panes.

Splitter

Stopwatch

Ready? Set! Go!

Stopwatch

Sync-counter

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

Times-tables

A simple demonstration of the MatrixView widget.

Times-tables

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