Skip to content

Commit

Permalink
egui demo: Add button to resize the window to 720p
Browse files Browse the repository at this point in the history
An alternative to the "Phone Size" button useful for testing
`ViewportCommand::InnerSize`.
  • Loading branch information
ColinKinloch committed Mar 20, 2024
1 parent cd1ed73 commit 47954f8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/egui_demo_app/src/backend_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,20 @@ fn integration_ui(ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
}
}

if ui
.button("🖵 Desktop Size")
.on_hover_text("Resize the window to be 720p.")
.clicked()
{
let size = egui::vec2(1280.0, 720.0);

ui.ctx()
.send_viewport_cmd(egui::ViewportCommand::InnerSize(size));
ui.ctx()
.send_viewport_cmd(egui::ViewportCommand::Fullscreen(false));
ui.close_menu();
}

if ui
.button("📱 Phone Size")
.on_hover_text("Resize the window to be small like a phone.")
Expand Down

0 comments on commit 47954f8

Please sign in to comment.