The Rust UI-Toolkit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Florian Blasius 6567553c0e Clean up project. Fix web issues: 9 hours ago
.vscode Finish pathfinder preview. 1 month ago
crates Clean up project. Fix web issues: 9 hours ago
examples Clean up project. Fix web issues: 9 hours ago
res Clean up project. Fix web issues: 9 hours ago
resources Initial implementation of pathfinder render. 2 months ago
src [#117] setup render crate. 3 months ago
.gitignore Clean up project. Fix web issues: 9 hours ago
.gitlab-ci.yml Update .gitlab-ci.yml 1 month ago
CHANGELOG.md Update CHANGELOG.md 9 months ago
Cargo.lock CI fix. 1 month ago
Cargo.toml Finish pathfinder preview. 1 month ago
LICENSE Add first rev of orbtk 3 years ago
Node.toml Clean up project. Fix web issues: 9 hours ago
README.md Fix typos in README 1 week ago

README.md

OrbTk

Build status MIT licensed crates.io docs.rs

OrbTk 0.3.0 is under heavy development and is not compatible with earlier releases.

The Orbital Widget Toolkit is a multi platform (G)UI toolkit for building scalable user interfaces with the programming language Rust. It’s based on the Entity Component System Pattern and provides a functional-reactive like API.

The main goals of OrbTk are speed, ease of use, and being cross platform.

Calculator

Features:

  • Modern lightweight API
  • Uses the Entity Component System library DCES for widget and properties handling
  • Updating instead of rebuilding sub-trees
  • Flexible event system
  • Widget state management
  • Cross platform: Redox OS, Linux, macOS, Windows
  • CSS theming

Usage

To include OrbTk in your project, just add the dependency line to your Cargo.toml file:

orbtk = "0.2.27"

To use OrbTk 0.3, just add the dependency line to your Cargo.toml file:

orbtk = { git = "https://gitlab.redox-os.org/redox-os/orbtk.git" }

Note: You also need to have the SDL2 libraries installed on your system. The best way to do this is documented by the SDL2 crate.

Use OrbTk with cairo

  • With Ubuntu, execute sudo apt-get install libcairo2-dev in your console.
  • With macOS and homebrew, execute brew install cairo in your console.
  • With macOS and macports, execute sudo port install cairo in your console.

Minimal Example

use orbtk::prelude::*;

fn main() {
      Application::new()
        .window(|ctx| {
            Window::create()
                .title("OrbTk - minimal example")
                .position((100.0, 100.0))
                .size(420.0, 730.0)
                .child(TextBlock::create().text("OrbTk").build(ctx))
                .build(ctx)
        })
        .run();
}

Additional Examples

You can find examples in the examples/ directory.

You can start the widgets example by executing the following command:

cargo run --example widgets --release

Additional Examples on Web

To run the examples on a browser you have to install

cargo install -f cargo-web

Run

You can start the widgets example by executing the following command:

  • Compile to WebAssembly using Rust’s native WebAssembly backend:
cargo web start --target=wasm32-unknown-unknown --auto-reload --example widgets
  • Compile to asm.js using Emscripten:
cargo web start --target=asmjs-unknown-emscripten --auto-reload --example widgets
  • Compile to WebAssembly using Emscripten:
cargo web start --target=wasm32-unknown-emscripten --auto-reload --example widgets

Run examples with Glutin and Pathfinder

OrbTk includes a preview with Glutin and Pathfinder. To start the preview mode you have to use the feature preview.

If you have problems running OrbTk with cairo on Windows you should try the preview feature.

Pathfinder is currently not available for the web.

cargo run --example widgets --release --features preview

Build and run documentation

You can build and run the latest documentation by executing the following command:

cargo doc --no-deps --open

Planned features

  • Style guide
  • More default widgets
  • More examples
  • Book
  • Animations
  • Exchange views / widgets / screens on runtime
  • Split application in modules
  • Theme update
  • Support for Android, iOS, Ubuntu Touch and WebAssembly
  • Vulkan / OpenGL Support

Sub Crates

  • api: base api elements of OrbTk e.g. widget and application parts
  • css-engine: parse and read values from a css file
  • shell: cross platform window and event handling
  • theme: OrbTk’s default theme (light and dark)
  • tree: Tree structure based on DCES
  • utils: Helper structs and traits
  • widgets: Base widget library

Dependencies

Inspirations