1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

eframe: add function to set, query and toggle fullscreen mode (#1866)

Closes https://github.com/emilk/egui/pull/674

Adds `NativeOptions:fullscreen`, `Frame::set_fullscreen` and `WindowInfo::fullscreen`.
This commit is contained in:
Emil Ernerfeldt
2022-07-29 14:21:23 +02:00
committed by GitHub
parent c6c6d2dc5d
commit 105cb4b8f2
6 changed files with 63 additions and 14 deletions

View File

@@ -174,15 +174,25 @@ impl BackendPanel {
}
}
if !frame.is_web()
&& ui
.button("📱 Phone Size")
.on_hover_text("Resize the window to be small like a phone.")
.clicked()
{
// frame.set_window_size(egui::Vec2::new(375.0, 812.0)); // iPhone 12 mini
frame.set_window_size(egui::Vec2::new(375.0, 667.0)); // iPhone SE 2nd gen
ui.close_menu();
if !frame.is_web() {
ui.horizontal(|ui| {
if let Some(window_info) = &frame.info().window_info {
let mut fullscreen = window_info.fullscreen;
ui.checkbox(&mut fullscreen, "🗖 Fullscreen")
.on_hover_text("Fullscreen the window");
frame.set_fullscreen(fullscreen);
}
if ui
.button("📱 Phone Size")
.on_hover_text("Resize the window to be small like a phone.")
.clicked()
{
// frame.set_window_size(egui::Vec2::new(375.0, 812.0)); // iPhone 12 mini
frame.set_window_size(egui::Vec2::new(375.0, 667.0)); // iPhone SE 2nd gen
ui.close_menu();
}
});
}
}