pub struct SliderPath { /* private fields */ }Expand description
The path of a HitObjectSlider.
Implementations§
Source§impl SliderPath
impl SliderPath
Sourcepub const fn new(
mode: GameMode,
control_points: Vec<PathControlPoint>,
expected_dist: Option<f64>,
) -> Self
pub const fn new( mode: GameMode, control_points: Vec<PathControlPoint>, expected_dist: Option<f64>, ) -> Self
Creates a new SliderPath.
The contained Curve will not necessarily be calculated yet, only
when accessing it with methods such as SliderPath::curve.
Sourcepub fn control_points(&self) -> &[PathControlPoint]
pub fn control_points(&self) -> &[PathControlPoint]
Returns an immutable reference to the control points.
Sourcepub const fn expected_dist(&self) -> Option<f64>
pub const fn expected_dist(&self) -> Option<f64>
Returns the expected distance.
Sourcepub fn curve(&mut self) -> &Curve
pub fn curve(&mut self) -> &Curve
Returns a reference to the Curve.
If the curve has not yet been accessed, it needs to be calculated first.
In case curves of multiple slider paths are being calculated, it is
recommended to initialize CurveBuffers and pass a mutable reference
of it to SliderPath::curve_with_bufs so the buffers are re-used for
all sliders.
Alternatively, to avoid storing the curve altogether because it will be
accessed only once, using SliderPath::borrowed_curve should be
preferred.
Sourcepub fn curve_with_bufs(&mut self, bufs: &mut CurveBuffers) -> &Curve
pub fn curve_with_bufs(&mut self, bufs: &mut CurveBuffers) -> &Curve
Returns a reference to the Curve.
If the curve has not yet been accessed, it needs to be calculated first.
In case the curve will be accessed only once, using
SliderPath::borrowed_curve should be preferred.
Sourcepub fn borrowed_curve<'a, 'b: 'a>(
&'a self,
bufs: &'b mut CurveBuffers,
) -> BorrowedCurve<'a>
pub fn borrowed_curve<'a, 'b: 'a>( &'a self, bufs: &'b mut CurveBuffers, ) -> BorrowedCurve<'a>
Returns a BorrowedCurve.
If the curve has been calculated before, the returned curve will borrow
from it. Otherwise, it will be calculated and returned without
storing it by borrowing from the given CurveBuffers.
This should be preferred over SliderPath::curve_with_bufs if the
curve will be accessed only once.
Sourcepub fn control_points_mut(&mut self) -> &mut Vec<PathControlPoint>
pub fn control_points_mut(&mut self) -> &mut Vec<PathControlPoint>
Returns a mutable reference to the control points.
Note that calling this method will invalidate the stored curve so it must be recalculated on its next access.
Sourcepub fn expected_dist_mut(&mut self) -> &mut Option<f64>
pub fn expected_dist_mut(&mut self) -> &mut Option<f64>
Returns a mutable reference to the expected distance.
Note that calling this method will invalidate the stored curve so it must be recalculated on its next access.
Sourcepub fn clear_curve(&mut self)
pub fn clear_curve(&mut self)
Remove the stored curve so that it has to be re-calculated when accessing it the next time.
Trait Implementations§
Source§impl Clone for SliderPath
impl Clone for SliderPath
Source§fn clone(&self) -> SliderPath
fn clone(&self) -> SliderPath
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more