Dummy second window
This commit is contained in:
parent
492c04316d
commit
ae7ab1e204
|
@ -21,7 +21,8 @@ use crate::{
|
|||
persistence::Persistence,
|
||||
vram::VramLoader,
|
||||
window::{
|
||||
AboutWindow, AppWindow, CharacterDataWindow, GameWindow, GdbServerWindow, InputWindow,
|
||||
AboutWindow, AppWindow, BgMapWindow, CharacterDataWindow, GameWindow, GdbServerWindow,
|
||||
InputWindow,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -203,6 +204,10 @@ impl ApplicationHandler<UserEvent> for Application {
|
|||
let vram = CharacterDataWindow::new(sim_id);
|
||||
self.open(event_loop, Box::new(vram));
|
||||
}
|
||||
UserEvent::OpenBgMap(sim_id) => {
|
||||
let bgmap = BgMapWindow::new(sim_id);
|
||||
self.open(event_loop, Box::new(bgmap));
|
||||
}
|
||||
UserEvent::OpenDebugger(sim_id) => {
|
||||
let debugger =
|
||||
GdbServerWindow::new(sim_id, self.client.clone(), self.proxy.clone());
|
||||
|
@ -415,6 +420,7 @@ pub enum UserEvent {
|
|||
GamepadEvent(gilrs::Event),
|
||||
OpenAbout,
|
||||
OpenCharacterData(SimId),
|
||||
OpenBgMap(SimId),
|
||||
OpenDebugger(SimId),
|
||||
OpenInput,
|
||||
OpenPlayer2,
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
pub use about::AboutWindow;
|
||||
pub use character_data::CharacterDataWindow;
|
||||
use egui::{Context, ViewportBuilder, ViewportId};
|
||||
pub use game::GameWindow;
|
||||
pub use gdb::GdbServerWindow;
|
||||
pub use input::InputWindow;
|
||||
pub use vram::{BgMapWindow, CharacterDataWindow};
|
||||
use winit::event::KeyEvent;
|
||||
|
||||
use crate::emulator::SimId;
|
||||
|
||||
mod about;
|
||||
mod character_data;
|
||||
mod game;
|
||||
mod game_screen;
|
||||
mod gdb;
|
||||
mod input;
|
||||
mod vram;
|
||||
|
||||
pub trait AppWindow {
|
||||
fn viewport_id(&self) -> ViewportId;
|
||||
|
|
|
@ -138,6 +138,12 @@ impl GameWindow {
|
|||
.unwrap();
|
||||
ui.close_menu();
|
||||
}
|
||||
if ui.button("Background Maps").clicked() {
|
||||
self.proxy
|
||||
.send_event(UserEvent::OpenBgMap(self.sim_id))
|
||||
.unwrap();
|
||||
ui.close_menu();
|
||||
}
|
||||
});
|
||||
ui.menu_button("About", |ui| {
|
||||
self.proxy.send_event(UserEvent::OpenAbout).unwrap();
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
mod bgmap;
|
||||
mod chardata;
|
||||
|
||||
pub use bgmap::*;
|
||||
pub use chardata::*;
|
|
@ -0,0 +1,29 @@
|
|||
use egui::{CentralPanel, Context, ViewportBuilder, ViewportId};
|
||||
|
||||
use crate::{emulator::SimId, window::AppWindow};
|
||||
|
||||
pub struct BgMapWindow {
|
||||
sim_id: SimId,
|
||||
}
|
||||
|
||||
impl BgMapWindow {
|
||||
pub fn new(sim_id: SimId) -> Self {
|
||||
Self { sim_id }
|
||||
}
|
||||
}
|
||||
|
||||
impl AppWindow for BgMapWindow {
|
||||
fn viewport_id(&self) -> ViewportId {
|
||||
ViewportId::from_hash_of(format!("bgmap-{}", self.sim_id))
|
||||
}
|
||||
|
||||
fn initial_viewport(&self) -> ViewportBuilder {
|
||||
ViewportBuilder::default()
|
||||
.with_title(format!("BG Map Data ({})", self.sim_id))
|
||||
.with_inner_size((640.0, 480.0))
|
||||
}
|
||||
|
||||
fn show(&mut self, ctx: &Context) {
|
||||
CentralPanel::default().show(ctx, |ui| ui.label("TODO"));
|
||||
}
|
||||
}
|
|
@ -7,10 +7,9 @@ use egui_extras::{Column, Size, StripBuilder, TableBuilder};
|
|||
use crate::{
|
||||
emulator::SimId,
|
||||
vram::{VramPalette, VramResource},
|
||||
window::AppWindow,
|
||||
};
|
||||
|
||||
use super::AppWindow;
|
||||
|
||||
pub struct CharacterDataWindow {
|
||||
sim_id: SimId,
|
||||
palette: VramPalette,
|
Loading…
Reference in New Issue