Skip to content

Commit

Permalink
Attempt to reproduce #292
Browse files Browse the repository at this point in the history
  • Loading branch information
vladbat00 committed Jul 7, 2024
1 parent 6705757 commit 47768b1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/side_panel.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use bevy::{prelude::*, window::PrimaryWindow};
use bevy::winit::WinitSettings;
use bevy_egui::{EguiContexts, EguiPlugin};

#[derive(Default, Resource)]
Expand All @@ -16,6 +17,7 @@ struct OriginalCameraTransform(Transform);

fn main() {
App::new()
.insert_resource(WinitSettings::desktop_app())
.add_plugins(DefaultPlugins)
.add_plugins(EguiPlugin)
.init_resource::<OccupiedScreenSpace>()
Expand All @@ -26,6 +28,7 @@ fn main() {
}

fn ui_example_system(
mut is_last_selected: Local<bool>,
mut contexts: EguiContexts,
mut occupied_screen_space: ResMut<OccupiedScreenSpace>,
) {
Expand All @@ -35,6 +38,12 @@ fn ui_example_system(
.resizable(true)
.show(ctx, |ui| {
ui.label("Left resizeable panel");
if ui.add(egui::widgets::Button::new("A button").selected(!*is_last_selected)).clicked() {
*is_last_selected = false;
}
if ui.add(egui::widgets::Button::new("Another button").selected(*is_last_selected)).clicked() {
*is_last_selected = true;
}
ui.allocate_rect(ui.available_rect_before_wrap(), egui::Sense::hover());
})
.response
Expand Down

0 comments on commit 47768b1

Please sign in to comment.