-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
351 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// SPDX-FileCopyrightText: 2024 sevonj | ||
// | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
//! | ||
//! | ||
|
||
use eframe::epaint::Color32; | ||
use egui::{Button, RichText, Ui}; | ||
use crate::emulator::emu_debug::CtrlMSG; | ||
use crate::TitoApp; | ||
|
||
impl TitoApp { | ||
pub fn emulator_toolbar(&mut self, ui: &mut Ui) { | ||
// Power button | ||
let text_onoff = match self.emu_running { | ||
true => RichText::new("⏼on/off").color(Color32::WHITE), | ||
false => RichText::new("⏼on/off"), | ||
}; | ||
if ui.selectable_label(self.emu_running, text_onoff).clicked() { | ||
self.emu_playing = false; | ||
let _ = self.tx_ctrl.send(CtrlMSG::PlaybackPlayPause(false)); | ||
if self.emu_running { | ||
self.stop_emulation(); | ||
} else { | ||
self.emu_running = true; | ||
let _ = self.tx_ctrl.send(CtrlMSG::EnableBreakpoints(self.config.memview_breakpoints_enabled)); | ||
let _ = self.tx_ctrl.send(CtrlMSG::PlaybackStart); | ||
} | ||
} | ||
|
||
ui.add_enabled_ui(self.emu_running, |ui| { | ||
// PlayPause Button | ||
let text_play; | ||
match self.emu_playing { | ||
true => text_play = RichText::new("⏸").color(Color32::WHITE), | ||
false => text_play = RichText::new("▶"), | ||
} | ||
if ui.add(Button::new(text_play).min_size(egui::vec2(24.0, 0.0))).clicked() { | ||
self.emu_playing = !self.emu_playing; | ||
let _ = self.tx_ctrl | ||
.send(CtrlMSG::PlaybackPlayPause(self.emu_playing)); | ||
} | ||
// Step Button | ||
ui.add_enabled_ui(!self.emu_playing, |ui| { | ||
if ui.add(Button::new(RichText::new("|▶")).min_size(egui::vec2(24.0, 0.0))).clicked() { | ||
let _ = self.tx_ctrl.send(CtrlMSG::PlaybackTick); | ||
if self.config.memview_follow_pc { | ||
self.memoryview.jump_to_pc(); | ||
} | ||
} | ||
}) | ||
}); | ||
|
||
ui.separator(); | ||
|
||
if ui.button("Reset").clicked() { | ||
let _ = self.tx_ctrl.send(CtrlMSG::Reset()); | ||
self.legacytermview.clear(); | ||
self.graphicsview.clear(); | ||
} | ||
ui.separator(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.