一个 100% Rust GUI 库:Conrod

jopen 10年前

Conrod 是一个超级年青,"immediate-mode",完全采用Rust编写,拥有花哨搜索功能的用户图形界面GUI。

可用的组件

  • Buttons
  • Toggles
  • Envelope Editor
  • Number Dialers
  • Sliders
  • TextBox
  • XYPad

依赖

一个 100% Rust GUI 库:Conrod

// Inside our render loop...    button::draw(&render_args, // Screen width and height.               &mut gl, // The OpenGL instance used to draw the GUI.               &mut ui_context, // A user interface context keeps track of state.               unique_id, // Each widget needs it's own UI_ID.               Point::new(x, y), // Screen location.               width, // Rectangle width f64.               height, // Rectangle height f64.               Frame(frame_width, frame_color), // Or perhaps `NoFrame` if you don't want one.               Color::new(r, g, b, a), // The color of the rectangle.               Label("PRESS", font_size, font_color), // Here you can pass Label(...) or NoLabel.               || {      // Callback closure - Do your things here!  });

项目主页:http://www.open-open.com/lib/view/home/1409476096463