Avoid egui feature unsupported on wayland

This commit is contained in:
Simon Gellis 2025-02-14 16:56:36 -05:00
parent 1cae0c8e54
commit a87fce102d
1 changed files with 3 additions and 7 deletions

View File

@ -142,8 +142,7 @@ impl GameWindow {
fn show_options_menu(&mut self, ctx: &Context, ui: &mut Ui) { fn show_options_menu(&mut self, ctx: &Context, ui: &mut Ui) {
ui.menu_button("Video", |ui| { ui.menu_button("Video", |ui| {
ui.menu_button("Screen Size", |ui| { ui.menu_button("Screen Size", |ui| {
let current_dims = ctx.input(|i| i.viewport().inner_rect.unwrap()); let current_dims = self.config.dimensions;
let current_dims = current_dims.max - current_dims.min;
for scale in 1..=4 { for scale in 1..=4 {
let label = format!("x{scale}"); let label = format!("x{scale}");
@ -183,10 +182,7 @@ impl GameWindow {
return; return;
} }
let current_dims = { let current_dims = self.config.dimensions;
let viewport = ctx.input(|i| i.viewport().inner_rect.unwrap());
viewport.max - viewport.min
};
let new_proportions = display_mode.proportions(); let new_proportions = display_mode.proportions();
let scale = new_proportions / old_proportions; let scale = new_proportions / old_proportions;
if scale != Vec2::new(1.0, 1.0) { if scale != Vec2::new(1.0, 1.0) {
@ -330,7 +326,7 @@ impl AppWindow for GameWindow {
fn show(&mut self, ctx: &Context) { fn show(&mut self, ctx: &Context) {
let dimensions = { let dimensions = {
let bounds = ctx.input(|i| i.viewport().inner_rect.unwrap()); let bounds = ctx.available_rect();
bounds.max - bounds.min bounds.max - bounds.min
}; };
self.update_config(|c| c.dimensions = dimensions); self.update_config(|c| c.dimensions = dimensions);