Struct rosu_pp::osu::OsuGradualPerformanceAttributes[][src]

pub struct OsuGradualPerformanceAttributes<'map> { /* fields omitted */ }
Expand description

Gradually calculate the performance attributes of an osu!standard map.

After each hit object you can call process_next_object and it will return the resulting current OsuPerformanceAttributes. To process multiple objects at once, use process_next_n_objects instead.

Both methods require an OsuScoreState that contains the current hitresults as well as the maximum combo so far.

If you only want to calculate difficulty attributes use OsuGradualDifficultyAttributes instead.

Example

use rosu_pp::{Beatmap, osu::{OsuGradualPerformanceAttributes, OsuScoreState}};

let map: Beatmap = ...

let mods = 64; // DT
let mut gradual_perf = OsuGradualPerformanceAttributes::new(&map, mods);
let mut state = OsuScoreState::new(); // empty state, everything is on 0.

// The first 10 hitresults are 300s and there are no sliders for additional combo
for _ in 0..10 {
    state.n300 += 1;
    state.max_combo += 1;

    let performance = gradual_perf.process_next_object(state.clone()).unwrap();
    println!("PP: {}", performance.pp);
}

// Then comes a miss.
// Note that state's max combo won't be incremented for
// the next few objects because the combo is reset.
state.misses += 1;
let performance = gradual_perf.process_next_object(state.clone()).unwrap();
println!("PP: {}", performance.pp);

// The next 10 objects will be a mixture of 300s, 100s, and 50s.
// Notice how all 10 objects will be processed in one go.
state.n300 += 2;
state.n100 += 7;
state.n50 += 1;
let performance = gradual_perf.process_next_n_objects(state.clone(), 10).unwrap();
println!("PP: {}", performance.pp);

// Now comes another 300. Note that the max combo gets incremented again.
state.n300 += 1;
state.max_combo += 1;
let performance = gradual_perf.process_next_object(state.clone()).unwrap();
println!("PP: {}", performance.pp);

// Skip to the end
state.max_combo = ...
state.n300 = ...
state.n100 = ...
state.n50 = ...
state.misses = ...
let final_performance = gradual_perf.process_next_n_objects(state.clone(), usize::MAX).unwrap();
println!("PP: {}", performance.pp);

// Once the final performance was calculated,
// attempting to process further objects will return `None`.
assert!(gradual_perf.process_next_object(state).is_none());

Implementations

Create a new gradual performance calculator for osu!standard maps.

Process the next hit object and calculate the performance attributes for the resulting score state.

Same as process_next_object but instead of processing only one object it process n many.

If n is 0 it will be considered as 1. If there are still objects to be processed but n is larger than the amount of remaining objects, n will be considered as the amount of remaining objects.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.