30 releases (16 breaking)

0.17.0 Sep 26, 2024
0.16.0 Mar 26, 2024
0.15.0 Feb 5, 2024
0.13.0 Nov 24, 2023
0.4.0 Oct 26, 2021

#977 in GUI

Download history 66/week @ 2024-07-22 35/week @ 2024-07-29 32/week @ 2024-08-05 28/week @ 2024-08-12 25/week @ 2024-08-19 24/week @ 2024-08-26 27/week @ 2024-09-02 33/week @ 2024-09-09 25/week @ 2024-09-16 228/week @ 2024-09-23 62/week @ 2024-09-30 44/week @ 2024-10-07 14/week @ 2024-10-14 9/week @ 2024-10-21 18/week @ 2024-10-28 22/week @ 2024-11-04

67 downloads per month
Used in fe-image-widget

MIT license

59KB
713 lines

fltk-egui

An FLTK backend for Egui using a GlWindow.

To use on Linux

Install FLTK deps:

sudo apt-get update && sudo apt-get install -y libpango1.0-dev libx11-dev libxext-dev libxft-dev libxinerama-dev libxcursor-dev libxrender-dev libxfixes-dev libgl1-mesa-dev libglu1-mesa-dev libmpv-dev

and then install egui deps:

sudo apt-get update && sudo apt-get install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev

Usage

Add to your Cargo.toml:

[dependencies]
fltk-egui = "0.16" # targets egui 0.27
egui_glow = "0.27"
egui = "0.27"

On wayland desktop enable feature:

[dependencies]
fltk-egui = { version = "0.16",  features = ["wayland"] }
egui_glow = "0.27"
egui = "0.27"

Note: on xwayland based desktop (like gnome 41+) doesn't require to enable the "wayland" features.

The basic premise is that egui is an immediate mode gui, while FLTK is retained. To be able to run Egui code, events and redrawing would need to be handled/done in the FLTK event loop. The events are those of the GlWindow, which are sent to egui's event handlers. Other FLTK widgets can function also normally since there is no interference from Egui. Please check the basic example.

Examples

To run the examples, just run:

cargo run --example basic
cargo run --example demo_windows
cargo run --example embedded
cargo run --example triangle

A demo app can be found here: https://github.com/fltk-rs/demos/tree/master/egui-demo

Dependencies

~19–32MB
~585K SLoC