| Crates.io | luigi-rs |
| lib.rs | luigi-rs |
| version | 1.0.0 |
| created_at | 2025-02-14 15:13:48.760828+00 |
| updated_at | 2025-02-14 15:13:48.760828+00 |
| description | Rust bindings for Luigi - a simple C GUI library |
| homepage | https://github.com/ankddev/luigi-rs |
| repository | https://github.com/ankddev/luigi-rs |
| max_upload_size | |
| id | 1555692 |
| size | 250,684 |
Add this to your Cargo.toml:
[dependencies]
luigi-rs = "1.0.0"
or run this command:
cargo add luigi-rs
Here's a simple counter application:
use luigi_rs::{self as ui, Button, Label, Panel, Window};
use std::cell::RefCell;
use std::rc::Rc;
fn main() {
ui::init();
let window = Window::new("Counter", 200, 150, 0).expect("Failed to create window");
let panel = Panel::new(&window, ui::UI_PANEL_WHITE).expect("Failed to create panel");
let label = Rc::new(RefCell::new(Label::new(&panel, 0, "0").expect("Failed to create label")));
let count = Rc::new(RefCell::new(0));
let buttons = Panel::new(&panel, ui::UI_PANEL_HORIZONTAL).expect("Failed to create buttons panel");
// Create minus button
let label_clone = label.clone();
let count_clone = count.clone();
let minus = Button::new(&buttons, 0, "-").expect("Failed to create minus button");
minus.invoke(Box::new(move || {
*count_clone.borrow_mut() -= 1;
label_clone.borrow_mut().set_content(&count_clone.borrow().to_string());
}));
// Create plus button
let plus = Button::new(&buttons, 0, "+").expect("Failed to create plus button");
plus.invoke(Box::new(move || {
*count.borrow_mut() += 1;
label.borrow_mut().set_content(&count.borrow().to_string());
}));
ui::message_loop();
}
Documentation can be found at docs.rs
First, ensure you have the bindgen requirements installed.
On Linux, install required X11 development packages:
sudo apt-get install libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev
git clone https://github.com/ankddev/luigi-rs
cd luigi-rs
cargo build
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/something)git commit -am 'Add something')git push origin feature/something)This project is licensed under the MIT License - see the LICENSE file for details.