Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add Left / Right hand information for pianos #172

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fa4c9c3
Update mod.rs
captainerd May 13, 2024
446e7dd
Adding a (Left/Right Hand) information card column
captainerd May 13, 2024
c3735a5
Utilizing the hand information in card + reverse iteration to display…
captainerd May 13, 2024
e6e6b8a
Fixes bug of jumping/ignoring non-pressed notes, adding accuracy to s…
captainerd May 14, 2024
96668c3
Merge branch 'PolyMeilex:master' into master
captainerd May 14, 2024
912f7b3
cargo fmt + hand_info non-piano column hide
captainerd May 14, 2024
8345978
Fix Percussion getting hand_info
captainerd May 14, 2024
ee83097
Merge branch 'PolyMeilex:master' into master
captainerd May 16, 2024
ca4317b
Gameplay accuracy+stats
captainerd May 16, 2024
06223cd
Added Game Stats screen, Added Folder select/song list, prepairing ic…
captainerd May 20, 2024
324d0ba
gamestats adjustments
captainerd May 21, 2024
def57e7
New screens UI Resposiveness+themeing
captainerd May 21, 2024
5379603
fmt
captainerd May 21, 2024
7673337
Scenes Refinements, track icons
captainerd May 22, 2024
1e9fddd
Refinements
captainerd May 22, 2024
2fe60a7
minor corrections
captainerd May 23, 2024
453d3d1
minor corrections
captainerd May 23, 2024
9198375
cargo fmt
captainerd May 23, 2024
18ba27c
After-test debugging
captainerd May 24, 2024
2379e39
After-tests debugging
captainerd May 24, 2024
8205bb4
Update neothesia/src/scene/playing_scene/midi_player.rs
captainerd May 24, 2024
09219e0
Refracted unessesary double-ended queues, removed unused enumerates
captainerd May 24, 2024
f9abb7a
Refract to Some(None) unsetted key up times, inclease a little the no…
captainerd May 25, 2024
bac6608
Clear leftovers from old 'wrong_notes -= x' there is no subtracting
captainerd May 25, 2024
bfe2b2a
After-tests debugging: correct the score shorting logic to match, ign…
captainerd May 26, 2024
ae0d444
After-tests debugging: correct the score shorting logic to match, ign…
captainerd May 26, 2024
ffd0ce0
Remove unnecessary if's and repeated code
captainerd May 26, 2024
307de70
Remove unnecessary if's and repeated code
captainerd May 26, 2024
520b0ed
mopping the floor
captainerd May 26, 2024
5ae11ff
case insensitive clean songname
captainerd May 26, 2024
4030a3a
Update README.md
captainerd Nov 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 89 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ iced_graphics = "0.12"
iced_core = "0.12"
iced_runtime = "0.12"
iced_wgpu = { version = "0.12", features = ["image"] }
iced_widget = { version = "0.12", features = ["image"] }
iced_widget = { version = "0.12", features = ["image"] }
2 changes: 1 addition & 1 deletion midi-io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl std::fmt::Display for MidiInputPort {
write!(f, "{}", self.0)
}
}

#[allow(dead_code)]
pub struct MidiInputConnection(midir::MidiInputConnection<()>);
pub struct MidiOutputConnection(midir::MidiOutputConnection);

Expand Down
2 changes: 2 additions & 0 deletions neothesia-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub struct Config {

pub soundfont_path: Option<PathBuf>,
pub last_opened_song: Option<PathBuf>,
pub song_directory: Option<PathBuf>,

#[serde(default = "default_piano_range")]
pub piano_range: (u8, u8),
Expand Down Expand Up @@ -78,6 +79,7 @@ impl Config {
input: None,
soundfont_path: None,
last_opened_song: None,
song_directory: None,
piano_range: default_piano_range(),
})
}
Expand Down
53 changes: 53 additions & 0 deletions neothesia-core/src/gamesave.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
use serde::{Deserialize, Serialize};
use std::time::SystemTime;

#[derive(Serialize, Deserialize, Debug)]
pub struct SavedStats {
pub songs: Vec<SongStats>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct SongStats {
pub song_name: String,
pub correct_note_times: u32,
pub wrong_note_times: u32,
pub notes_missed: u32,
pub notes_hit: u32,
pub wrong_notes: u32,
pub date: SystemTime,
}

impl SavedStats {
pub fn load() -> Option<SavedStats> {
if let Some(path) = crate::utils::resources::gamestats_ron() {
if let Ok(file) = std::fs::read_to_string(&path) {
match ron::from_str(&file) {
Ok(stats) => Some(stats),
Err(err) => {
log::error!("Error loading game stats: {:#?}", err);
None
}
}
} else {
None
}
} else {
None
}
}

pub fn save(&self) {
if let Ok(s) = ron::ser::to_string_pretty(self, Default::default()) {
if let Some(path) = crate::utils::resources::gamestats_ron() {
std::fs::create_dir_all(path.parent().unwrap()).ok();
std::fs::write(path, s).ok();
}
}
}
}

impl Default for SavedStats {
fn default() -> Self {
SavedStats { songs: Vec::new() }
}
}
1 change: 1 addition & 0 deletions neothesia-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
pub use wgpu_jumpstart::{Color, Gpu, TransformUniform, Uniform};

pub mod config;
pub mod gamesave;
pub mod render;
pub mod utils;
11 changes: 11 additions & 0 deletions neothesia-core/src/utils/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ pub fn settings_ron() -> Option<PathBuf> {
return bundled_resource_path("settings", "ron").map(PathBuf::from);
}

pub fn gamestats_ron() -> Option<PathBuf> {
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
return xdg_config().map(|p| p.join("gamestats.ron"));

#[cfg(target_os = "windows")]
return Some(PathBuf::from("./gamestats.ron"));

#[cfg(target_os = "macos")]
return bundled_resource_path("gamestats", "ron").map(PathBuf::from);
}

#[cfg(target_os = "macos")]
fn bundled_resource_path(name: &str, extension: &str) -> Option<String> {
use objc::runtime::{Class, Object};
Expand Down
3 changes: 2 additions & 1 deletion neothesia-iced-widgets/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "neothesia-iced-widgets"
version = "0.1.0"
version = "0.1.1"
edition = "2021"

[dependencies]
Expand All @@ -10,4 +10,5 @@ iced_core.workspace = true
iced_wgpu.workspace = true
iced_widget.workspace = true


piano-math = { workspace = true }
2 changes: 2 additions & 0 deletions neothesia-iced-widgets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub mod piano_range;
pub mod preferences_group;
pub mod scroll_listener;
pub mod segment_button;
pub mod stats_container;
pub mod track_card;
pub mod wrap;

Expand All @@ -13,6 +14,7 @@ pub use piano_range::PianoRange;
pub use preferences_group::{ActionRow, PreferencesGroup};
pub use scroll_listener::ScrollListener;
pub use segment_button::SegmentButton;
pub use stats_container::StatsContainer;
pub use track_card::TrackCard;
pub use wrap::Wrap;

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading