Persist watch rom setting
This commit is contained in:
parent
762f43fd42
commit
a6c12a986c
|
|
@ -143,6 +143,8 @@ pub struct SimConfig {
|
|||
#[serde(default)]
|
||||
pub low_battery: bool,
|
||||
#[serde(default)]
|
||||
pub watch_rom: bool,
|
||||
#[serde(default)]
|
||||
pub position: Option<Pos2>,
|
||||
}
|
||||
|
||||
|
|
@ -157,6 +159,7 @@ impl SimConfig {
|
|||
dimensions: DisplayMode::Anaglyph.proportions() + Vec2::new(0.0, 22.0),
|
||||
audio_enabled: true,
|
||||
low_battery: false,
|
||||
watch_rom: false,
|
||||
position: None,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ impl GameWindow {
|
|||
) -> Self {
|
||||
let config = SimConfig::load(&persistence, sim_id);
|
||||
let _ = proxy.send_event(UserEvent::LowBattery(sim_id, config.low_battery));
|
||||
client.send_command(EmulatorCommand::WatchRom(sim_id, config.watch_rom));
|
||||
let toasts = Toasts::new()
|
||||
.with_anchor(Anchor::BottomLeft)
|
||||
.with_margin((10.0, 10.0).into())
|
||||
|
|
@ -333,6 +334,7 @@ impl GameWindow {
|
|||
}
|
||||
let watch_rom = self.client.is_rom_watched(self.sim_id);
|
||||
if ui.selectable_button(watch_rom, "Watch ROM").clicked() {
|
||||
self.update_config(|c| c.watch_rom = !watch_rom);
|
||||
self.client
|
||||
.send_command(EmulatorCommand::WatchRom(self.sim_id, !watch_rom));
|
||||
}
|
||||
|
|
@ -393,9 +395,7 @@ impl GameWindow {
|
|||
ui.separator();
|
||||
let low_battery = self.config.low_battery;
|
||||
if ui.selectable_button(low_battery, "Low Battery").clicked() {
|
||||
self.update_config(|c| {
|
||||
c.low_battery = !low_battery;
|
||||
});
|
||||
self.update_config(|c| c.low_battery = !low_battery);
|
||||
let _ = self
|
||||
.proxy
|
||||
.send_event(UserEvent::LowBattery(self.sim_id, !low_battery));
|
||||
|
|
|
|||
Loading…
Reference in New Issue