Giter Site home page Giter Site logo

libui-rs's Introduction

Improved User Interface

A cross-platform UI toolkit for Rust based on libui

travis-ci build status libui-rs appveyor build status badge actively developed badge

iui: iui crates.io version badge docs.rs for iui ui-sys: ui-sys crates.io version badge docs.rs for ui-sys

iui is a simple (about 4 kLOC of Rust), small (about 800kb, including libui), easy to distribute (one shared library) GUI library, providing a Rusty user interface library that binds to native APIs via the libui and the ui-sys bindings crate.

iui wraps native retained mode GUI libraries, like Win32API on Windows, Cocoa on Mac OS X, and GTK+ on Linux and elsewhere. Thus all iui apps have a native look and feel and start from a highly performant base which is well integegrated with the native ecosystem on each platform. Because it implements only the least common subset of these platform APIs, your apps will work on all platforms and won't have significant behavioral inconsistencies, with no additional effort on your part.

Using

Add iui to your project with:

iui = "0.3"

Then, in your code, all you have to do is:

  1. create a UI handle, initializing the UI library and guarding against memory unsafety
  2. make a window, or a few, with title and platform-native decorations, into which your app will be drawn
  3. add all your controls, like buttons and text inputs, laid out with both axial and grid layout options
  4. implement some callbacks for user input, taking full advantage of Rust's concurrency protections
  5. call UI::main, or take control over the event processing with an EventLoop, and voíla! A GUI!

Or, you can track the master branch, which may be broken and whose API often changes, with:

iui = { git = "https://github.com/rust-native-ui/libui-rs.git" }

We have documentation on docs.rs for released versions and on github for master.

Examples

Three example GUI applications running on Linux

Check out the examples/ directory from the latest release for these examples and more.

Organization

This repository contains multiple Rust crates:

  • iui is the safe Rust wrapper, to be used by most users.
  • ui-sys is the raw unsafe bindings to the libui C code. Requires cmake so it can build libui. libui is included as a submodule.

Also be sure to look at our changelog and learn how to contribute.

Building ui-sys

ui-sys includes libui as a sub-module and allows it to be built on-the-fly with the default features fetch and build. With fetch disabled, it will simply build the existing sources without updating them, and with build disabled it will build nothing, assuming either a system or local (in ./lib/) version of libui is available.

Note that most of the time, building libui on the fly is what you want. It does however require a copy of cmake, essential build tools, et cetera.

Acknowledgments

Based on work by @pcwalton.

libui-rs's People

Contributors

noracodes avatar masche842 avatar barzamin avatar pcwalton avatar huangjj27 avatar coolreader18 avatar lord avatar jamesmunns avatar mitchhentges avatar killercup avatar ivanceras avatar zakcodes avatar dependabot-support avatar

Watchers

James Cloos 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.