remove lazy_static dependency
This commit is contained in:
@@ -3,6 +3,3 @@ name = "rosu-pp"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["MaxOhn <ohn.m@hotmail.de>"]
|
authors = ["MaxOhn <ohn.m@hotmail.de>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies.lazy_static]
|
|
||||||
version = "1.4"
|
|
||||||
@@ -2,21 +2,44 @@ use crate::HitObject;
|
|||||||
|
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
static COMMON_RHYTHMS: [HitObjectRhythm; 9] = [
|
||||||
/// lazy_static required for `f32` division's
|
HitObjectRhythm {
|
||||||
/// lack of const-ness as of now.
|
ratio: 1.0 / 1.0,
|
||||||
static ref COMMON_RHYTHMS: Vec<HitObjectRhythm> = vec![
|
difficulty: 0.0,
|
||||||
HitObjectRhythm::new(1.0, 1.0, 0.0),
|
},
|
||||||
HitObjectRhythm::new(2.0, 1.0, 0.3),
|
HitObjectRhythm {
|
||||||
HitObjectRhythm::new(1.0, 2.0, 0.5),
|
ratio: 2.0 / 1.0,
|
||||||
HitObjectRhythm::new(3.0, 1.0, 0.3),
|
difficulty: 0.3,
|
||||||
HitObjectRhythm::new(1.0, 3.0, 0.35),
|
},
|
||||||
HitObjectRhythm::new(3.0, 2.0, 0.6),
|
HitObjectRhythm {
|
||||||
HitObjectRhythm::new(2.0, 3.0, 0.4),
|
ratio: 1.0 / 2.0,
|
||||||
HitObjectRhythm::new(5.0, 4.0, 0.5),
|
difficulty: 0.5,
|
||||||
HitObjectRhythm::new(4.0, 5.0, 0.7),
|
},
|
||||||
|
HitObjectRhythm {
|
||||||
|
ratio: 3.0 / 1.0,
|
||||||
|
difficulty: 0.3,
|
||||||
|
},
|
||||||
|
HitObjectRhythm {
|
||||||
|
ratio: 1.0 / 3.0,
|
||||||
|
difficulty: 0.35,
|
||||||
|
},
|
||||||
|
HitObjectRhythm {
|
||||||
|
ratio: 3.0 / 2.0,
|
||||||
|
difficulty: 0.6,
|
||||||
|
},
|
||||||
|
HitObjectRhythm {
|
||||||
|
ratio: 2.0 / 3.0,
|
||||||
|
difficulty: 0.4,
|
||||||
|
},
|
||||||
|
HitObjectRhythm {
|
||||||
|
ratio: 5.0 / 4.0,
|
||||||
|
difficulty: 0.5,
|
||||||
|
},
|
||||||
|
HitObjectRhythm {
|
||||||
|
ratio: 4.0 / 5.0,
|
||||||
|
difficulty: 0.7,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub(crate) struct HitObjectRhythm {
|
pub(crate) struct HitObjectRhythm {
|
||||||
@@ -34,16 +57,6 @@ impl PartialEq for HitObjectRhythm {
|
|||||||
|
|
||||||
impl Eq for HitObjectRhythm {}
|
impl Eq for HitObjectRhythm {}
|
||||||
|
|
||||||
impl HitObjectRhythm {
|
|
||||||
#[inline]
|
|
||||||
fn new(numerator: f32, denominator: f32, difficulty: f32) -> Self {
|
|
||||||
Self {
|
|
||||||
ratio: numerator / denominator,
|
|
||||||
difficulty,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) fn closest_rhythm(
|
pub(crate) fn closest_rhythm(
|
||||||
delta_time: f32,
|
delta_time: f32,
|
||||||
|
|||||||
Reference in New Issue
Block a user