render hitobjects with earlier ones on top

This commit is contained in:
Michael Zhang 2021-01-08 07:38:22 -06:00
parent aef8e2e6c6
commit ce7c14c1c9
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
3 changed files with 6 additions and 6 deletions

View file

@ -10,7 +10,6 @@ use ggez::{
self, Color, DrawMode, DrawParam, FillOptions, FilterMode, Mesh, Rect, StrokeOptions, Text, self, Color, DrawMode, DrawParam, FillOptions, FilterMode, Mesh, Rect, StrokeOptions, Text,
WHITE, WHITE,
}, },
nalgebra::Point2,
Context, GameError, GameResult, Context, GameError, GameResult,
}; };
use libosu::{Beatmap, HitObject, HitObjectKind, Point, SpinnerInfo}; use libosu::{Beatmap, HitObject, HitObjectKind, Point, SpinnerInfo};
@ -61,7 +60,7 @@ impl Game {
let dir = path.parent().unwrap(); let dir = path.parent().unwrap();
let song = Sound::create(dir.join(&self.beatmap.audio_filename))?; let song = Sound::create(dir.join(&self.beatmap.audio_filename))?;
song.set_position(36.5)?; // song.set_position(36.5)?;
self.song = Some(song); self.song = Some(song);
Ok(()) Ok(())
@ -139,7 +138,7 @@ impl Game {
let cs_osupx = self.beatmap.difficulty.circle_size_osupx(); let cs_osupx = self.beatmap.difficulty.circle_size_osupx();
let cs_real = cs_osupx * cs_scale; let cs_real = cs_osupx * cs_scale;
for draw_info in visible_hitobjects.iter() { for draw_info in visible_hitobjects.iter().rev() {
let ho = draw_info.hit_object; let ho = draw_info.hit_object;
let ho_time = (ho.start_time.0 as f64) / 1000.0; let ho_time = (ho.start_time.0 as f64) / 1000.0;
let pos = [ let pos = [
@ -171,7 +170,7 @@ impl Game {
travel_percent = 1.0 - travel_percent; travel_percent = 1.0 - travel_percent;
} }
let travel_length = travel_percent * info.pixel_length; let travel_length = travel_percent * info.pixel_length;
print!("ho={:.3} ", ho_time); // print!("ho={:.3} ", ho_time);
let pos = spline.point_at_length(travel_length); let pos = spline.point_at_length(travel_length);
let ball_pos = [ let ball_pos = [
PLAYFIELD_BOUNDS.x + osupx_scale_x * pos.0 as f32, PLAYFIELD_BOUNDS.x + osupx_scale_x * pos.0 as f32,

View file

@ -227,9 +227,11 @@ impl Spline {
match self.cumulative_lengths.binary_search(&length_notnan) { match self.cumulative_lengths.binary_search(&length_notnan) {
Ok(idx) => self.spline_points[idx], Ok(idx) => self.spline_points[idx],
Err(idx) => { Err(idx) => {
let n = self.spline_points.len() - 1; let n = self.spline_points.len();
if idx == 0 && self.spline_points.len() > 2 { if idx == 0 && self.spline_points.len() > 2 {
return self.spline_points[0]; return self.spline_points[0];
} else if idx == n {
return self.spline_points[n - 1];
} }
let (len1, len2) = ( let (len1, len2) = (

View file

@ -1,5 +1,4 @@
- stacking - stacking
- fix straight slider segment teleportation
- don't draw overlaps between slider segments - don't draw overlaps between slider segments
- use skin components - use skin components
- timeline - timeline