Expand description
This is the Winit backend for the Masonry GUI framework.
See Masonry’s documentation for more details, examples and resources.
§Example
use masonry::core::{ErasedAction, NewWidget, Widget, WidgetId, WidgetPod};
use masonry::dpi::LogicalSize;
use masonry::theme::default_property_set;
use masonry_winit::app::{AppDriver, DriverCtx, NewWindow, WindowId};
use masonry_winit::winit::window::Window;
struct Driver {
// ...
}
impl AppDriver for Driver {
fn on_action(
&mut self,
window_id: WindowId,
ctx: &mut DriverCtx<'_, '_>,
widget_id: WidgetId,
action: ErasedAction,
) {
// ...
}
}
fn main() {
let main_widget = {
// ...
};
let window_size = LogicalSize::new(400.0, 400.0);
let window_attributes = Window::default_attributes()
.with_title("My Masonry App")
.with_resizable(true)
.with_min_inner_size(window_size);
let driver = Driver {
// ...
};
let event_loop = masonry_winit::app::EventLoop::with_user_event()
.build()
.unwrap();
masonry_winit::app::run_with(
event_loop,
vec![NewWindow::new(
window_attributes,
NewWidget::new(main_widget).erased(),
)],
driver,
default_property_set(),
)
.unwrap();
}(See the Masonry documentation for more detailed examples.)
Re-exports§
pub use winit;
Modules§
- app
- Types needed for running a Masonry app.