Skip to content

Commit

Permalink
Remove play_along checkbox (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyMeilex authored Dec 14, 2023
1 parent ab66260 commit 02458f3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 30 deletions.
9 changes: 0 additions & 9 deletions neothesia-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ pub struct Config {
#[serde(default = "default_playback_offset")]
pub playback_offset: f32,

#[serde(default = "default_play_along")]
#[serde(skip_serializing)]
pub play_along: bool,

#[serde(default = "default_vertical_guidelines")]
pub vertical_guidelines: bool,

Expand Down Expand Up @@ -68,7 +64,6 @@ impl Config {
speed_multiplier: default_speed_multiplier(),
animation_speed: default_animation_speed(),
playback_offset: default_playback_offset(),
play_along: default_play_along(),
vertical_guidelines: default_vertical_guidelines(),
color_schema: default_color_schema(),
background_color: Default::default(),
Expand Down Expand Up @@ -111,10 +106,6 @@ fn default_playback_offset() -> f32 {
0.0
}

fn default_play_along() -> bool {
false
}

fn default_vertical_guidelines() -> bool {
false
}
Expand Down
22 changes: 3 additions & 19 deletions neothesia/src/scene/menu_scene/iced_menu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use iced_core::{
};
use iced_runtime::Command;
use iced_widget::{
button, checkbox, column as col, container, image, pick_list, row, text, toggler,
vertical_space,
button, column as col, container, image, pick_list, row, text, toggler, vertical_space,
};

use crate::{
Expand Down Expand Up @@ -44,7 +43,6 @@ pub enum Message {

Play,

PlayAlongCheckbox(bool),
TrackPlayerConfig(usize, PlayerConfig),
TrackVisibilityConfig(usize, bool),

Expand Down Expand Up @@ -155,9 +153,6 @@ impl Program for AppUi {
target.config.set_input(Some(&input));
self.data.selected_input = Some(input);
}
Message::PlayAlongCheckbox(v) => {
target.config.play_along = v;
}
Message::TrackPlayerConfig(track, config) => {
if let Some(song) = target.song.as_mut() {
song.config.tracks[track].player = config;
Expand Down Expand Up @@ -212,7 +207,7 @@ impl Program for AppUi {
fn keyboard_input(
&self,
event: &iced_runtime::keyboard::Event,
target: &Target,
_target: &Target,
) -> Option<Message> {
use iced_runtime::keyboard::{Event, KeyCode};

Expand All @@ -227,10 +222,6 @@ impl Program for AppUi {
Step::Main => Some(Message::GoToPage(Step::Settings)),
_ => None,
},
KeyCode::A => match self.current {
Step::Main => Some(Message::PlayAlongCheckbox(!target.config.play_along)),
_ => None,
},
KeyCode::Enter => match self.current {
Step::Exit => Some(Message::ExitApp),
Step::Main => Some(Message::Play),
Expand Down Expand Up @@ -336,13 +327,6 @@ impl<'a> Step {
let mut content = top_padded(column);

if target.song.is_some() {
let play_along = checkbox(
"PlayAlong",
target.config.play_along,
Message::PlayAlongCheckbox,
)
.style(theme::checkbox());

let tracks = button(centered_text("Tracks"))
.on_press(Message::GoToPage(Step::TrackSelection))
.style(theme::button());
Expand All @@ -352,7 +336,7 @@ impl<'a> Step {
.min_width(80.0)
.on_press(Message::Play);

let row = row![tracks, play_along, play]
let row = row![tracks, play]
.spacing(20)
.align_items(Alignment::Center);

Expand Down
2 changes: 1 addition & 1 deletion neothesia/src/scene/menu_scene/iced_menu/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl iced_style::button::StyleSheet for ButtonStyle {
}
}

pub fn checkbox() -> iced_style::theme::Checkbox {
pub fn _checkbox() -> iced_style::theme::Checkbox {
iced_style::theme::Checkbox::Custom(Box::new(CheckboxStyle))
}

Expand Down
2 changes: 1 addition & 1 deletion neothesia/src/scene/playing_scene/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl Scene for PlayingScene {
fn update(&mut self, target: &mut Target, delta: Duration) {
self.rewind_controler.update(&mut self.player, target);

if self.player.play_along().are_required_keys_pressed() || !target.config.play_along {
if self.player.play_along().are_required_keys_pressed() {
let midi_events = self.player.update(target, delta);
self.keyboard.file_midi_events(&target.config, &midi_events);
}
Expand Down

0 comments on commit 02458f3

Please sign in to comment.