Giter VIP home page Giter VIP logo

conrod's Introduction

NOTICE: Original maintainer stepping down

I'll no longer be maintaining conrod for the reasons discussed here. If you're looking for a similar yet nicer replacement GUI library, I recommend egui. If you're interested in taking over maintenance, please express your interest here.


Conrod Actions Status Crates.io

An easy-to-use, 2D GUI library written entirely in Rust.

Guide

  1. What is Conrod?
  2. Getting Started
  3. Hello World
  4. Using and Customising Themes
    • What is a Theme?
    • Custom Themes
    • Serializing Themes
  5. Designing Custom Widgets (using the Widget trait)
    • The Widget trait
    • The widget_style! macro
    • The builder_methods! macro
    • Making a Button widget
  6. Custom Graphics and Window Backends
    • Demonstration of Backend Implementation (using glium and glutin)
  7. Internals
    • The Ui's Widget Graph
    • Ui::set_widgets - How does it work?
  8. FAQ

The Guide is a work-in-progress. If a section is not linked, it is likely not yet implemented.

Crates

Crate Badges Description
conrod_core Crates.io docs.rs The fundamentals for any conrod project.
conrod_derive Crates.io docs.rs Provides the WidgetCommon and WidgetStyle derive macros.
conrod_winit Crates.io docs.rs Simplifies using conrod_core with winit
conrod_gfx Crates.io docs.rs Simplifies using conrod_core with the gfx ecosystem
conrod_wgpu Crates.io docs.rs Simplifies using conrod_core with wgpu
conrod_glium Crates.io docs.rs Simplifies using conrod_core with glium
conrod_piston Crates.io docs.rs Simplifies using conrod_core with piston
conrod_vulkano Crates.io docs.rs Simplifies using conrod_core with vulkano

Current State

We're just starting to reach a stable-ish API pattern! There will still be some large changes, however these are more likely to be new features than API overhauls.

To get a clearer idea of where we're at see the issues and in particular, the 1.0.0 milestone.

Contributing

Want to help out? See Piston's how to contribute guide.

License

Licensed under either of

at your option.

Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Example Assets

conrod's People

Contributors

0e4ef622 avatar abonander avatar adumbidiot avatar alanpoon avatar alexchandel avatar alvinhochun avatar benmch avatar bluebird45 avatar bvssvni avatar christolliday avatar csirkeee avatar daboross avatar davidpartouche avatar dcampbell24 avatar eklavya avatar elrnv avatar esption avatar hyperchaotic avatar indiv0 avatar jarrett avatar jonas-schievink avatar lllshamanlll avatar mitchmindtree avatar pedrocr avatar potpourri avatar psfried avatar sbauer322 avatar shanehandley avatar yutannihilation avatar zummenix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

conrod's Issues

Separate the 'conrodtest' example

I find the project structure used in freetype-rs less confusing.

I suggest we separate the example and use a path = "../../" in the Cargo.toml to build with the local library.

This way we can add more examples.

Boolean algebra search

One idea I would love to see in a user interface framework is the integration with full Boolean algebra search to quickly filter and display subset of the data.

This can be extreme powerful and there is almost no end to what clever things you can do.

This requires a ton of planning and this issue is just a starting point for that direction.

Themes

A Theme could define default widget attributes (i.e. Color, Frame/Margin, etc), and would allow us to add a FromTheme(Theme) variant to enums like Coloring, Framing, etc.

URL navigation widget

  • Remembers history and support auto completion.
  • Can provide suggestions when protocol is not specific (https, http etc.)

Getting rid of black widget bounds

The font in the 'all_widget' example "Dense-Regular" which looks modern and minimalistic.

The first thing that shocked me when seeing it the first time was "where are the bounds of the widgets"? This is because it starts with black background color. Then I started to like it, and was disappointed that by changing the back-ground, there was this black area around the widgets.

The text could flip between white/black if it is hard to read with the background.
This way we would only show bounds when the widget is focused, but not otherwise.

Tag based connections

A "tag" could be used to connect nodes instead of tagging nodes themselves.

The idea is that a "tag" has a local meaning for a group of objects. All objects connected with a tag can be "grabbed", "filtered" etc.

This would make it easier to find relevant information that is non-verbal expressed, such as images.

JSON panel widget

Creates a panel from JSON data.

Can also be used to copy settings between panels or use it with a widget that controls saved/predefined settings.

TextArea Widget

  • Allows for creation and editing of text

Would this be in the scope of conrod?

Auto-assign UIID to `<widget_name>::draw` functions.

At the moment, a unique UI_ID (User Interface ID) must be passed into each unique <widget_name>::draw call. This UI_ID is used by the UIContext to store the state for the associated widget and retrieve that state each time the draw function is called.

Currently, it is up to the user to make sure that they pass in a unique UI_ID for each widget that they draw (see the "all_widgets" example). This can be annoying for the user to keep track of, and makes it difficult to build parent widgets out of several child widgets, as each child may also require their own UI_ID.

An ideal solution would be to somehow automatically statically assign a unique UI_ID for every <widget_name>::draw call. Perhaps this is possible with a macro of some sort? Maybe one that generates a unique number every time it is called within code (I don't know if this is possible)?

This isn't an issue for retained-mode UI as the state is stored within unique widget structs meaning a UIContext is unnecessary. However, I'd much prefer we managed to solve the UI_ID issue, as in most cases retaining widget structs for every widget's state seems to be overkill, especially when almost all of their state can be procedurally derived from the data and context they are associated with anyway.

Component based system for nodes

The nodes are extensible with any Rust type, using the AnyMap.

This allows one to attach data to the graph.

The panels could be a Rust type that is attached to the graph.

Widget Ideas

Here is a space to collect Widget Type ideas.

This list is taken directly from the ofxUI readme as a basis for ideas. Any more ideas are welcome!

  • Buttons (push, state, toggle, image, label)
  • Button Matrices
  • Dropdown Menus
  • Labels
  • Sliders (rotary, range, vertical, horizontal)
  • Number Dials (aka Spinners)
  • 2D Pads
  • Text Input Areas
  • Image Sliders
  • Image Buttons
  • Image Color Sampler
  • Value Plotters
  • Moving Graphs
  • Waveform & Spectrum Graphs
  • Radio Toggles
  • Text Areas
  • Sortable List

Nodal UI

A 3D, graph-like navigation option for UI layout. Each Node would contain a canvas, on which the widgets would go. Using screen-picking, the 2D canvases would track the 3D nodes. Here's an example of my own 3D node system https://github.com/mitchmindtree/ofxNUI which we could take inspiration from / port across.

NOTE: it would be necessary to get both #6 and #7 done before moving onto this.

Change WidgetState enum name to State to be used as widget::State instead

Perhaps we could harness the beauty of rust's module namespacing for the enum widget state naming?

i.e. instead of NumberDialerState we could just call it State which will make usage easier within the number_dialer module while still remaining easily accessible outside of the module as number_dialer::State.

Missing macro?

When doing

cargo build
make examples

I get the following error:

error: macro undefined: 'impl_get_widget_data!'
examples/canvas.rs:55     impl_get_widget_data!(widget_data)

Slider focused bounds while pressing cursor

When I adjust the padding slider in the 'all_widgets' example, the control looses focus when I move the cursor outside the bounds of the control.

I think the slider should keep focus while the mouse is pressed.

Perhaps there is a state which the widget can set that tells the ui context that the widget is capturing the focus.

Opening URL in default browser

It is very useful to have a command in Conrod that opens up an URL in the default browser. This could work cross platform.

For example, when the user clicks on a "Website" button.

Search syntax

I've been working on a syntax for search that encapsulates Boolean predicates, but feeling more lightweight and without binary operators. It is a small language consisting of (), - and [].

(x y) means search for x or y.

(x -y) means "search for x but not for y.

[x y] means search for both x and y.

(x -y z) is the same as (x z -y).

The operator - is can only appear within () which must contain at least one positive item.

Playback widget

It would be nice to have a widget that could be used to control playback of audio/video streams.

Create a widget_boilerplate_functions! macro.

Currently there's some boilerplate functions that need to be written when designing a new or unique widget module. These include default, get_widget, get_state and set_state which are implemented almost identically for each widget module, with only the types differing. It would be trivial to write a macro that took a couple type arguments and expanded to all four of these functions. I'll do this in the next day or two.

Graph based script languages

Collect some information about existing graph based scripting languages, perhaps we can use some of it to build in a "command line" in the interface.

Unified search bar and command line

Nodes can have predefined "actions" which are exposed to a command line functionality in the search bar. This would allow automated tasks as well.

To make this possible we need a nice syntax, possibly using an existing scripting language.

UI Event System

I've started experimenting with a working Widget trait over here:

https://github.com/mitchmindtree/nui

There's a basic button and slider that are both functioning aesthetically though don't yet have any event system. I'd love to start a discussion on how to best approach setting up an event system for a UI framework like this! @bvssvni maybe you have some ideas after working on rust-event? Maybe we could use rust-event?

Also, there could probably be a more efficient way of passing GameEvents to the Widgets rather than plugging them straight into the Game trait like in the example. Would love to hear ideas on this also!

`label::draw(...)` Causes Huge Lag

Performance now hugely fluctuates when drawing labels or widgets with labels (at the moment only the slider supports an optional label).

I've tried to follow the usage example within the font_with_piston freetype-rs project as close as I can, but I haven't yet been able to fix it. I'm unsure if this is an issue with my implementation or if the problem stems from within freetype-rs itself?

On some occasions the example runs blazingly fast without issues, however most of the time the example will start fine but progressively slow down to an unusable state.

If someone gets a chance to run the example and has some ideas, that'd be great! Otherwise i'll revisit tomorrow and have another stab :-)

(This bug has been introduced with #37.)

"Canvas" and "Widget" Traits.

Summary:
A "Canvas" will be a rectangular face on which we can place "Widgets", where a "Widget" is the core trait for each UI element (such as sliders, dialers, buttons, etc).

Inspiration:

Thoughts:

  • Widgets get placed upon Canvases.
  • A Canvas holds pointers to all of its widgets in a vector.
  • All of the Widget positioning is relative to the Canvas position.
  • The Canvas position is relative to screen width/height.
  • The Canvas has an "add_widget(w: &Widget)" method (or something similar)

Add goals to README

I think we should decide what goals we want to accomplish with the project early so we got a direction to work toward.

v0.2

  • Piston integration
  • Basic widgets

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.