mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 06:10:06 -04:00
* Part of https://github.com/emilk/egui/issues/3556 This PR replaces a bunch of options in `eframe::NativeOptions` with `egui::ViewportBuilder`. For instance: ``` diff let options = eframe::NativeOptions { - initial_window_size: Some(egui::vec2(320.0, 240.0)), - drag_and_drop_support: true, + viewport: egui::ViewportBuilder::default() + .with_inner_size([320.0, 240.0]) + .with_drag_and_drop(true), centered: true, ..Default::default() }; ```
36 lines
1.1 KiB
Rust
36 lines
1.1 KiB
Rust
//! Demo app for egui
|
|
|
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
|
|
|
// When compiling natively:
|
|
fn main() -> Result<(), eframe::Error> {
|
|
{
|
|
// Silence wgpu log spam (https://github.com/gfx-rs/wgpu/issues/3206)
|
|
let mut rust_log = std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_owned());
|
|
for loud_crate in ["naga", "wgpu_core", "wgpu_hal"] {
|
|
if !rust_log.contains(&format!("{loud_crate}=")) {
|
|
rust_log += &format!(",{loud_crate}=warn");
|
|
}
|
|
}
|
|
std::env::set_var("RUST_LOG", rust_log);
|
|
}
|
|
|
|
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
|
|
|
|
let options = eframe::NativeOptions {
|
|
viewport: egui::ViewportBuilder::default()
|
|
.with_inner_size([1280.0, 1024.0])
|
|
.with_drag_and_drop(true),
|
|
|
|
#[cfg(feature = "wgpu")]
|
|
renderer: eframe::Renderer::Wgpu,
|
|
|
|
..Default::default()
|
|
};
|
|
eframe::run_native(
|
|
"egui demo app",
|
|
options,
|
|
Box::new(|cc| Box::new(egui_demo_app::WrapApp::new(cc))),
|
|
)
|
|
}
|