Skip to content

Commit

Permalink
fix: fix scroll issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lukexor committed Jun 28, 2024
1 parent 46b3d94 commit 218d786
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 171 deletions.
52 changes: 26 additions & 26 deletions tetanes/src/nes/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ impl AsRef<str> for Action {
Ui::LoadReplay => "Load Replay",
},
Action::Menu(menu) => match menu {
Menu::About => "Toggle About Window",
Menu::Keybinds => "Toggle Keybinds Menu",
Menu::PerfStats => "Toggle Performance Stats Window",
Menu::About => "Toggle About",
Menu::Keybinds => "Toggle Keybinds",
Menu::PerfStats => "Toggle Performance Stats",
Menu::PpuViewer => "Toggle PPU Viewer",
Menu::Preferences => "Toggle Preferences Menu",
Menu::Preferences => "Toggle Preferences",
},
Action::Feature(feature) => match feature {
Feature::ToggleReplayRecording => "Toggle Replay Recording",
Expand All @@ -214,10 +214,10 @@ impl AsRef<str> for Action {
Setting::ToggleScreenReader => "Toggle Screen Reader",
Setting::ToggleFps => "Toggle FPS",
Setting::FastForward => "Fast Forward",
Setting::IncrementScale => "Increment Scale",
Setting::DecrementScale => "Decrement Scale",
Setting::IncrementSpeed => "Increment Speed",
Setting::DecrementSpeed => "Decrement Speed",
Setting::IncrementScale => "Scale Increment",
Setting::DecrementScale => "Scale Decrement",
Setting::IncrementSpeed => "Speed Increment",
Setting::DecrementSpeed => "Speed Increment",
},
Action::Deck(deck) => match deck {
DeckAction::Reset(kind) => match kind {
Expand All @@ -236,13 +236,13 @@ impl AsRef<str> for Action {
JoypadBtn::Select => "Joypad Select",
JoypadBtn::Start => "Joypad Start",
},
DeckAction::ToggleZapperConnected => "Toggle Zapper Connected",
DeckAction::ToggleZapperConnected => "Zapper Gun Toggle",
DeckAction::ZapperAim(_) => "Zapper Aim",
DeckAction::ZapperAimOffscreen => "Zapper Aim Offscreen (Hold)",
DeckAction::ZapperTrigger => "Zapper Trigger",
DeckAction::FourPlayer(FourPlayer::Disabled) => "Disable Four Player Mode",
DeckAction::FourPlayer(FourPlayer::FourScore) => "Enable Four Player (FourScore)",
DeckAction::FourPlayer(FourPlayer::Satellite) => "Enable Four Player (Satellite)",
DeckAction::FourPlayer(FourPlayer::Disabled) => "4-Player Disable",
DeckAction::FourPlayer(FourPlayer::FourScore) => "4-Player Enable (FourScore)",
DeckAction::FourPlayer(FourPlayer::Satellite) => "4-Player Enable (Satellite)",
DeckAction::SetSaveSlot(1) => "Set Save Slot 1",
DeckAction::SetSaveSlot(2) => "Set Save Slot 2",
DeckAction::SetSaveSlot(3) => "Set Save Slot 3",
Expand All @@ -264,17 +264,17 @@ impl AsRef<str> for Action {
},
DeckAction::MapperRevision(rev) => match rev {
MapperRevision::Mmc3(mmc3) => match mmc3 {
Mmc3Revision::A => "Set Mapper Rev. to MMC3A",
Mmc3Revision::BC => "Set Mapper Rev. to MMC3B/C",
Mmc3Revision::Acc => "Set Mapper Rev. to MC-ACC",
Mmc3Revision::A => "Set Mapper to MMC3A",
Mmc3Revision::BC => "Set Mapper to MMC3B/C",
Mmc3Revision::Acc => "Set Mapper to MC-ACC",
},
MapperRevision::Bf909(bf909) => match bf909 {
Bf909Revision::Bf909x => "Set Mapper Rev. to BF909x",
Bf909Revision::Bf9097 => "Set Mapper Rev. to BF9097",
Bf909Revision::Bf909x => "Set Mapper to BF909x",
Bf909Revision::Bf9097 => "Set Mapper to BF9097",
},
},
DeckAction::SetNesRegion(region) => match region {
NesRegion::Auto => "Set Region to Auto-Detect",
NesRegion::Auto => "Set Region to Auto",
NesRegion::Ntsc => "Set Region to NTSC",
NesRegion::Pal => "Set Region to PAL",
NesRegion::Dendy => "Set Region to Dendy",
Expand All @@ -286,16 +286,16 @@ impl AsRef<str> for Action {
},
Action::Debug(debug) => match debug {
Debug::Toggle(debugger) => match debugger {
Debugger::Cpu => "Toggle CPU Debugger",
Debugger::Ppu => "Toggle PPU Debugger",
Debugger::Apu => "Toggle APU Debugger",
Debugger::Cpu => "Toggle Debugger",
Debugger::Ppu => "Toggle PPU Viewer",
Debugger::Apu => "Toggle APU Mixer",
},
Debug::Step(step) => match step {
DebugStep::Into => "Step Into (CPU Debugger)",
DebugStep::Out => "Step Out (CPU Debugger)",
DebugStep::Over => "Step Over (CPU Debugger)",
DebugStep::Scanline => "Step Scanline (CPU Debugger)",
DebugStep::Frame => "Step Frame (CPU Debugger)",
DebugStep::Into => "Debug Step",
DebugStep::Out => "Debug Step Out",
DebugStep::Over => "Debug Step Over",
DebugStep::Scanline => "Debug Step Scanline",
DebugStep::Frame => "Debug Step Frame",
},
},
}
Expand Down
6 changes: 6 additions & 0 deletions tetanes/src/nes/renderer/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ impl Gui {
Self::light_theme()
};
ctx.set_visuals(theme);
ctx.style_mut(|ctx| {
let scroll = &mut ctx.spacing.scroll;
scroll.floating = false;
scroll.foreground_color = false;
scroll.bar_width = 8.0;
});

const FONT: (&str, &[u8]) = (
"pixeloid-sans",
Expand Down
10 changes: 5 additions & 5 deletions tetanes/src/nes/renderer/gui/keybinds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,18 @@ impl State {
#[cfg(feature = "profiling")]
puffin::profile_function!();

ui.set_min_height(ui.available_height());

if let Some(player) = player {
self.player_gamepad_combo(ui, player, connected_gamepads);

ui.separator();
}

ScrollArea::both().show(ui, |ui| {
ui.set_width(ui.available_width()); // Pushes scrollbar to the right of the window

ScrollArea::both().auto_shrink(false).show(ui, |ui| {
let grid = Grid::new("keybind_list")
.num_columns(3)
.spacing([40.0, 6.0]);
.num_columns(4)
.spacing([10.0, 6.0]);
grid.show(ui, |ui| {
ui.heading("Action");
ui.heading("Binding #1");
Expand Down
Loading

0 comments on commit 218d786

Please sign in to comment.