summaryrefslogtreecommitdiffstats
path: root/src/window.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.rs')
-rw-r--r--src/window.rs43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/window.rs b/src/window.rs
index 3c395d5..18021f4 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -94,7 +94,7 @@ impl GameWindow
pub fn render(
&mut self,
game_state: &RefCell<GameState>,
- egui_event_resp: egui_winit::EventResponse)
+ _egui_event_resp: egui_winit::EventResponse)
-> Result<(), wgpu::CurrentSurfaceTexture> {
if !self.wgpuctx.is_ready() {
return Ok(());
@@ -116,30 +116,39 @@ impl GameWindow
.title_bar(false)
.interactable(false)
.frame(egui::Frame::NONE)
- .show(self.eguictx.context(), |ui| {
+ .show(self.eguictx.context(),
+ |ui| {
self.ui_state.paint(game_state, ui);
-
+
if self.ui_state.topbar_sate.current_system.is_some() {
let game_state = game_state.borrow();
let fleets_manager = game_state.fleets();
let current_system = &game_state.solar_systems()[self.ui_state.topbar_sate.current_system.unwrap()];
- match self.tactical_map.prepare(
- &mut scene,
- &self.wgpuctx,
- fleets_manager,
- current_system,
- game_state.timeman())
- {
- Ok(_) => {},
- Err(_) => {
- println!("Error in tactical map prepare");
- panic!();
+ egui::CentralPanel::no_frame().show_inside(ui, |central_panel| {
+ let panel_rect = central_panel.max_rect();
+
+ self.tactical_map.resize(
+ panel_rect.width() as u32,
+ panel_rect.height() as u32);
+
+ match self.tactical_map.prepare(
+ panel_rect,
+ &self.wgpuctx,
+ fleets_manager,
+ current_system,
+ game_state.timeman())
+ {
+ Ok(_) => {},
+ Err(_) => {
+ println!("Error in tactical map prepare");
+ panic!();
+ }
}
- }
-
+ });
+
let mut pass = RenderPassBuilder::new(Some("Systemic window render pass"), &view)
- .clear_color(wgpu::Color { r: 0.0, g: 0.0, b: 0.1, a: 1.0 })
+ .clear_color(wgpu::Color { r: 0.0, g: 0.0, b: 0.0, a: 1.0 })
.build_from_scene(&mut scene);
//Draw the tactical map canvas.