Crates.io | fltk-sys |
lib.rs | fltk-sys |
version | 1.4.35 |
source | src |
created_at | 2020-03-21 00:51:43.146673 |
updated_at | 2024-10-21 20:28:59.447383 |
description | Rust bindings for the FLTK GUI library |
homepage | |
repository | https://github.com/fltk-rs/fltk-rs |
max_upload_size | |
id | 220835 |
size | 25,483,815 |
Raw bindings for FLTK. These are generated using bindgen on the cfltk headers.
[dependencies]
fltk-sys = "1.4"
Example code:
use fltk_sys::*;
use std::os::raw::*;
unsafe extern "C" fn cb(_wid: *mut button::Fl_Widget, data: *mut c_void) {
let frame = data as *mut frame::Fl_Box;
frame::Fl_Box_set_label(frame, "Hello World\0".as_ptr() as *const _);
}
fn main() {
unsafe {
fl::Fl_init_all();
image::Fl_register_images();
fl::Fl_lock();
let win = window::Fl_Window_new(100, 100, 400, 300, "Window\0".as_ptr() as *const _);
let frame = frame::Fl_Box_new(0, 0, 400, 200, std::ptr::null());
let but = button::Fl_Button_new(160, 220, 80, 40, "Click\0".as_ptr() as *const _);
window::Fl_Window_end(win);
window::Fl_Window_show(win);
button::Fl_Button_set_callback(but, Some(cb), frame as *mut _);
fl::Fl_run();
}
}
CMake > 3.14, git and a C++17 compiler. The dev dependencies are basically the same as for fltk-rs.
std::
prefix with the libc
via bindgen (requires adding libc as a dependency).