一个 100% Rust GUI 库:Conrod
Conrod 是一个超级年青,"immediate-mode",完全采用Rust编写,拥有花哨搜索功能的用户图形界面GUI。
可用的组件
- Buttons
- Toggles
- Envelope Editor
- Number Dialers
- Sliders
- TextBox
- XYPad
依赖
- rustc - we try to keep up to date with the latest nightly build.
- cargo - for handling other rust dependencies and building the project.
- freetype - at the moment, Conrod uses freetype-rs for its font rendering, which means you'll need to have the freetype library installed on your system. You can download and install the freetype library here.
// 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! });
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!