All Projects → hecrj → Iced

hecrj / Iced

Licence: mit
A cross-platform GUI library for Rust, inspired by Elm

Programming Languages

rust
11053 projects
GLSL
2045 projects

Projects that are alternatives of or similar to Iced

Libs Gui
The GNUstep gui library is a library of graphical user interface classes written completely in the Objective-C language; the classes are based upon Apple's Cocoa framework (which came from the OpenStep specification). *** Larger patches require copyright assignment to FSF. please file bugs here. ***
Stars: ✭ 148 (-98.78%)
Mutual labels:  graphics, gui, widgets
Horus ui
HorusUI Immediate Mode Graphical User Interface
Stars: ✭ 106 (-99.13%)
Mutual labels:  gui, user-interface, widgets
Fltk Rs
Rust bindings for the FLTK GUI library.
Stars: ✭ 241 (-98.02%)
Mutual labels:  graphics, gui, widgets
Libagar
Cross-Platform GUI Toolkit (stable)
Stars: ✭ 212 (-98.26%)
Mutual labels:  toolkit, gui, interface
Dearpygui
Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
Stars: ✭ 6,631 (-45.54%)
Mutual labels:  graphics, toolkit, gui
Vim Quickui
The missing UI extensions for Vim 8.2 (and NeoVim 0.4) !! 😎
Stars: ✭ 714 (-94.14%)
Mutual labels:  gui, widgets
Haproxy Wi
Web interface for managing Haproxy, Nginx and Keepalived servers
Stars: ✭ 823 (-93.24%)
Mutual labels:  gui, interface
Xtd forms
Modern c++17 library to create native gui for Microsoft Windows, Apple macOS and Linux.
Stars: ✭ 25 (-99.79%)
Mutual labels:  toolkit, gui
Gi
Native Go (golang) Graphical Interface system (2D and 3D), built on GoKi tree framework
Stars: ✭ 864 (-92.9%)
Mutual labels:  graphics, gui
Macroid
A modular functional UI language for Android
Stars: ✭ 537 (-95.59%)
Mutual labels:  gui, user-interface
Gwen Nolegacy Opentk Renderer
A C# port of the GWEN GUI library, with an OpenTK renderer
Stars: ✭ 26 (-99.79%)
Mutual labels:  toolkit, gui
Patternfly Design
Use this repo to file all new feature or design change requests for the PatternFly project
Stars: ✭ 82 (-99.33%)
Mutual labels:  gui, user-interface
Gui.cs
Console-based user interface toolkit for .NET applications.
Stars: ✭ 5,879 (-51.72%)
Mutual labels:  toolkit, gui
Axiom
An FFmpeg GUI for Windows
Stars: ✭ 560 (-95.4%)
Mutual labels:  gui, interface
Flaui
UI automation library for .Net
Stars: ✭ 892 (-92.67%)
Mutual labels:  gui, user-interface
Clui
Command Line User Interface (Console UI inspired by TurboVision)
Stars: ✭ 561 (-95.39%)
Mutual labels:  gui, widgets
Element
Programmatic UI for macOS
Stars: ✭ 855 (-92.98%)
Mutual labels:  gui, interface
Toothyprogress
A polyline determinated ProgressBar written in Kotlin
Stars: ✭ 56 (-99.54%)
Mutual labels:  widget, widgets
Bogue
GUI library for ocaml based on SDL2
Stars: ✭ 48 (-99.61%)
Mutual labels:  gui, widgets
Ttkwidgets
A collection of widgets for Tkinter's ttk extensions by various authors
Stars: ✭ 57 (-99.53%)
Mutual labels:  gui, widgets

iced

Documentation Crates.io License Downloads Test Status Discord Server

A cross-platform GUI library for Rust focused on simplicity and type-safety. Inspired by Elm.

Features

iced is currently experimental software. Take a look at the roadmap, check out the issues, and feel free to contribute!

Installation

Add iced as a dependency in your Cargo.toml:

iced = "0.3"

iced moves fast and the master branch can contain breaking changes! If you want to learn about a specific release, check out the release list.

Overview

Inspired by The Elm Architecture, iced expects you to split user interfaces into four different concepts:

  • State — the state of your application
  • Messages — user interactions or meaningful events that you care about
  • View logic — a way to display your state as widgets that may produce messages on user interaction
  • Update logic — a way to react to messages and update your state

We can build something to see how this works! Let's say we want a simple counter that can be incremented and decremented using two buttons.

We start by modelling the state of our application:

use iced::button;

struct Counter {
    // The counter value
    value: i32,

    // The local state of the two buttons
    increment_button: button::State,
    decrement_button: button::State,
}

Next, we need to define the possible user interactions of our counter: the button presses. These interactions are our messages:

#[derive(Debug, Clone, Copy)]
pub enum Message {
    IncrementPressed,
    DecrementPressed,
}

Now, let's show the actual counter by putting it all together in our view logic:

use iced::{Button, Column, Text};

impl Counter {
    pub fn view(&mut self) -> Column<Message> {
        // We use a column: a simple vertical layout
        Column::new()
            .push(
                // The increment button. We tell it to produce an
                // `IncrementPressed` message when pressed
                Button::new(&mut self.increment_button, Text::new("+"))
                    .on_press(Message::IncrementPressed),
            )
            .push(
                // We show the value of the counter here
                Text::new(self.value.to_string()).size(50),
            )
            .push(
                // The decrement button. We tell it to produce a
                // `DecrementPressed` message when pressed
                Button::new(&mut self.decrement_button, Text::new("-"))
                    .on_press(Message::DecrementPressed),
            )
    }
}

Finally, we need to be able to react to any produced messages and change our state accordingly in our update logic:

impl Counter {
    // ...

    pub fn update(&mut self, message: Message) {
        match message {
            Message::IncrementPressed => {
                self.value += 1;
            }
            Message::DecrementPressed => {
                self.value -= 1;
            }
        }
    }
}

And that's everything! We just wrote a whole user interface. iced is now able to:

  1. Take the result of our view logic and layout its widgets.
  2. Process events from our system and produce messages for our update logic.
  3. Draw the resulting user interface.

Browse the documentation and the examples to learn more!

Implementation details

iced was originally born as an attempt at bringing the simplicity of Elm and The Elm Architecture into Coffee, a 2D game engine I am working on.

The core of the library was implemented during May 2019 in this pull request. The first alpha version was eventually released as a renderer-agnostic GUI library. The library did not provide a renderer and implemented the current tour example on top of ggez, a game library.

Since then, the focus has shifted towards providing a batteries-included, end-user-oriented GUI library, while keeping the ecosystem modular:

iced ecosystem

Contributing / Feedback

Contributions are greatly appreciated! If you want to contribute, please read our contributing guidelines for more details.

Feedback is also welcome! You can open an issue or, if you want to talk, come chat to our Discord server. Moreover, you can find me (and a bunch of awesome folks) over the #games-and-graphics and #gui-and-ui channels in the Rust Community Discord. I go by lone_scientist#9554 there.

Sponsors

The development of iced is sponsored by the Cryptowatch team at Kraken.com

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].