Giter Site home page Giter Site logo

vizia's Introduction

Vizia


Vizia is a declarative GUI framework for the Rust programming language.



At a Glance

A simple counter application. Run with cargo run --example counter.

use vizia::prelude::*;

// Define some model data
#[derive(Lens)]
pub struct AppData {
    count: i32,
}

// Define events to mutate the data
pub enum AppEvent {
    Increment,
}

// Describe how the data can be mutated
impl Model for AppData {
    fn event(&mut self, _: &mut EventContext, event: &mut Event) {
        event.map(|app_event, _| match app_event {
            AppEvent::Increment => {
                self.count += 1;
            }
        });
    }
}
fn main() {
    Application::new(|cx| {
        // Build the model data into the tree
        AppData { count: 0 }.build(cx);

        HStack::new(cx, |cx| {
            // Declare a button which emits an event
            Button::new(cx, |cx| cx.emit(AppEvent::Increment), |cx| Label::new(cx, "Increment"));

            // Declare a label which is bound to part of the model, updating if it changes
            Label::new(cx, AppData::count).width(Pixels(50.0));
        })
        .child_space(Stretch(1.0))
        .col_between(Pixels(50.0));
    })
    .title("Counter")
    .inner_size((400, 100))
    .run();
}

Features

  • Multiplatform (Windows, Linux, MacOS, Web)
  • Declarative API
  • Reactive event-driven data system
  • Flexible layout engine, powered by morphorm
  • GPU rendering, powered by femtovg
  • CSS styling with hot reloading
  • Property animations
  • Audio plugin GUI development

Running the Examples

A full list of examples is included in the repository.

To run an example with the winit (default) windowing backend:

cargo run --release --example name_of_example

To run an example with the baseview windowing backend:

cargo run --release --example name_of_example --no-default-features --features baseview

Web

To run an example as a web application, first ensure that the wasm32-unknown-unknown toolchain is installed:

rustup target add wasm32-unknown-unknown

Then run an example with the following:

cargo run-wasm --release --example name_of_example

NOTE - Some examples are not compatible with the web target.

Contributing and Community

For help with vizia, or to get involved with contributing to the project, come join us on our discord.

License and Attribution

Vizia is licensed under MIT.

Fonts used in Vizia:

Vizia logo designed by Lunae Somnia.

vizia's People

Contributors

0hypercube avatar adriannic avatar artemist avatar daslixou avatar dgriffin91 avatar frando avatar fredemus avatar freefull avatar geom3trik avatar iwoithe avatar ollpu avatar piedoom avatar rhelmot avatar robbert-vdh avatar sky1e avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.