Skip to content

Commit

Permalink
feat(tja): support bpm with decimal
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobLinCool committed Apr 29, 2024
1 parent 1bd5b6d commit 3ae34a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions tja/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ impl TJAParser {
let mut course: Option<TJACourse> = None;
let mut balloons = Vec::new();
let mut time_ms = 0.0;
let mut bpm = 60;
let mut bpm = 60.0;
let mut scroll = 1.0;
let mut measure = (4, 4);
let mut segments: Vec<(i32, f32, Vec<char>)> = Vec::new();
let mut segments: Vec<(f32, f32, Vec<char>)> = Vec::new();
let mut current_combo: Option<TaikoNote> = None;

for line in tja_content.as_ref().lines() {
Expand Down Expand Up @@ -56,7 +56,7 @@ impl TJAParser {
course = Some(TJACourse::new(parse_course(value)));
balloons.clear();
time_ms = 0.0;
bpm = tja.header.bpm.unwrap_or(60);
bpm = tja.header.bpm.unwrap_or(60.0);
scroll = 1.0;
measure = (4, 4);
segments.clear();
Expand Down Expand Up @@ -111,7 +111,7 @@ impl TJAParser {
bpm = value
.unwrap()
.parse()
.unwrap_or(tja.header.bpm.unwrap_or(0));
.unwrap_or(tja.header.bpm.unwrap_or(0.0));
}
"MEASURE" => {
let (beat, note) = value.unwrap().split_once('/').unwrap();
Expand Down
2 changes: 1 addition & 1 deletion tja/src/tja.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct TJAHeader {
/// The subtitle of the song.
pub subtitle: Option<String>,
/// The BPM of the song.
pub bpm: Option<i32>,
pub bpm: Option<f32>,
/// The wave file of the song.
pub wave: Option<String>,
/// The offset of the song.
Expand Down

0 comments on commit 3ae34a3

Please sign in to comment.