Compare commits
No commits in common. "a6c12a986c49143fbb9fc51737cd77eaabec1b98" and "3a00497942e9c3dd132461f7cbdc554f02f82a4d" have entirely different histories.
a6c12a986c
...
3a00497942
|
|
@ -467,9 +467,6 @@ impl ApplicationHandler<UserEvent> for Application {
|
||||||
self.controllers.handle_gamepad_event(&event);
|
self.controllers.handle_gamepad_event(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UserEvent::LowBattery(sim_id, pwr) => {
|
|
||||||
self.controllers.handle_low_battery(sim_id, pwr);
|
|
||||||
}
|
|
||||||
UserEvent::Quit(sim_id) => match sim_id {
|
UserEvent::Quit(sim_id) => match sim_id {
|
||||||
SimId::Player1 => event_loop.exit(),
|
SimId::Player1 => event_loop.exit(),
|
||||||
SimId::Player2 => self.app.close(ChildWindow::Player2),
|
SimId::Player2 => self.app.close(ChildWindow::Player2),
|
||||||
|
|
@ -676,7 +673,6 @@ impl ViewportManager {
|
||||||
pub enum UserEvent {
|
pub enum UserEvent {
|
||||||
GamepadEvent(gilrs::Event),
|
GamepadEvent(gilrs::Event),
|
||||||
Quit(SimId),
|
Quit(SimId),
|
||||||
LowBattery(SimId, bool),
|
|
||||||
RequestRedraw(ViewportId, Instant),
|
RequestRedraw(ViewportId, Instant),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,10 +141,6 @@ pub struct SimConfig {
|
||||||
#[serde(default = "default_audio_enabled")]
|
#[serde(default = "default_audio_enabled")]
|
||||||
pub audio_enabled: bool,
|
pub audio_enabled: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub low_battery: bool,
|
|
||||||
#[serde(default)]
|
|
||||||
pub watch_rom: bool,
|
|
||||||
#[serde(default)]
|
|
||||||
pub position: Option<Pos2>,
|
pub position: Option<Pos2>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -158,8 +154,6 @@ impl SimConfig {
|
||||||
colors: COLOR_PRESETS[0],
|
colors: COLOR_PRESETS[0],
|
||||||
dimensions: DisplayMode::Anaglyph.proportions() + Vec2::new(0.0, 22.0),
|
dimensions: DisplayMode::Anaglyph.proportions() + Vec2::new(0.0, 22.0),
|
||||||
audio_enabled: true,
|
audio_enabled: true,
|
||||||
low_battery: false,
|
|
||||||
watch_rom: false,
|
|
||||||
position: None,
|
position: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,15 +77,6 @@ impl Controller {
|
||||||
self.update_state(pressed, released)
|
self.update_state(pressed, released)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn low_battery(&mut self, pwr: bool) -> Option<VBKey> {
|
|
||||||
let (pressed, released) = if pwr {
|
|
||||||
(VBKey::PWR, VBKey::empty())
|
|
||||||
} else {
|
|
||||||
(VBKey::empty(), VBKey::PWR)
|
|
||||||
};
|
|
||||||
self.update_state(pressed, released)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_state(&mut self, pressed: VBKey, released: VBKey) -> Option<VBKey> {
|
fn update_state(&mut self, pressed: VBKey, released: VBKey) -> Option<VBKey> {
|
||||||
let old_state = self.state;
|
let old_state = self.state;
|
||||||
self.state = self.state.union(pressed).difference(released);
|
self.state = self.state.union(pressed).difference(released);
|
||||||
|
|
@ -142,14 +133,6 @@ impl ControllerManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_low_battery(&mut self, sim_id: SimId, pwr: bool) {
|
|
||||||
let controller = &mut self.controllers[sim_id.to_index()];
|
|
||||||
if let Some(pressed) = controller.low_battery(pwr) {
|
|
||||||
self.client
|
|
||||||
.send_command(EmulatorCommand::SetKeys(controller.sim_id, pressed));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn axis_presses(value: f32, pair_value: f32, neg: VBKey, pos: VBKey) -> (VBKey, VBKey) {
|
fn axis_presses(value: f32, pair_value: f32, neg: VBKey, pos: VBKey) -> (VBKey, VBKey) {
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,6 @@ impl GameWindow {
|
||||||
sim_id: SimId,
|
sim_id: SimId,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let config = SimConfig::load(&persistence, sim_id);
|
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()
|
let toasts = Toasts::new()
|
||||||
.with_anchor(Anchor::BottomLeft)
|
.with_anchor(Anchor::BottomLeft)
|
||||||
.with_margin((10.0, 10.0).into())
|
.with_margin((10.0, 10.0).into())
|
||||||
|
|
@ -334,7 +332,6 @@ impl GameWindow {
|
||||||
}
|
}
|
||||||
let watch_rom = self.client.is_rom_watched(self.sim_id);
|
let watch_rom = self.client.is_rom_watched(self.sim_id);
|
||||||
if ui.selectable_button(watch_rom, "Watch ROM").clicked() {
|
if ui.selectable_button(watch_rom, "Watch ROM").clicked() {
|
||||||
self.update_config(|c| c.watch_rom = !watch_rom);
|
|
||||||
self.client
|
self.client
|
||||||
.send_command(EmulatorCommand::WatchRom(self.sim_id, !watch_rom));
|
.send_command(EmulatorCommand::WatchRom(self.sim_id, !watch_rom));
|
||||||
}
|
}
|
||||||
|
|
@ -392,14 +389,6 @@ impl GameWindow {
|
||||||
{
|
{
|
||||||
pollster::block_on(self.take_screenshot());
|
pollster::block_on(self.take_screenshot());
|
||||||
}
|
}
|
||||||
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);
|
|
||||||
let _ = self
|
|
||||||
.proxy
|
|
||||||
.send_event(UserEvent::LowBattery(self.sim_id, !low_battery));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
ui.menu_button("Options", |ui| self.show_options_menu(ui));
|
ui.menu_button("Options", |ui| self.show_options_menu(ui));
|
||||||
ui.menu_button("Multiplayer", |ui| {
|
ui.menu_button("Multiplayer", |ui| {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue