private void RenderGame(SKCanvas canvas, int width, int height) { if (beatmap == null) { return; } // filter visible objects bool ObjectIsVisible(HitObject obj) { switch (obj) { case HitCircle c: return(gameTime > (c.StartTime - c.TimePreempt) && gameTime < (c.StartTime + 250)); case Slider s: var mul1 = beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier; var mul2 = beatmap.ControlPointInfo.DifficultyPointAt(s.StartTime).SpeedMultiplier; double sliderMultiplier = mul1 * mul2; double velocity = 100 * sliderMultiplier / beatmap.ControlPointInfo.TimingPointAt(s.StartTime).BeatLength; double slideDuration = s.Path.Distance / velocity; double totalSlideDuration = slideDuration * (s.RepeatCount + 1); return(gameTime > (s.StartTime - s.TimePreempt) && gameTime < (s.StartTime + totalSlideDuration + 250)); default: return(false); } } var visibleObjects = beatmap.HitObjects.Where(ObjectIsVisible); // draw objects foreach (OsuHitObject obj in visibleObjects.AsEnumerable().Reverse()) { switch (obj) { case HitCircle c: DrawFunctions.DrawHitCircle(canvas, gameTime, c); break; case Slider s: var mul1 = beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier; var mul2 = beatmap.ControlPointInfo.DifficultyPointAt(s.StartTime).SpeedMultiplier; double sliderMultiplier = mul1 * mul2; double velocity = 100 * sliderMultiplier / beatmap.ControlPointInfo.TimingPointAt(s.StartTime).BeatLength; DrawFunctions.DrawSlider(canvas, gameTime, s, velocity); break; } } // draw approach circles on top of everything foreach (OsuHitObject obj in visibleObjects.Where(o => gameTime <= o.StartTime).Reverse()) { DrawFunctions.DrawApproachCircle(canvas, gameTime, obj); } }
// Skin elements public Form1() { InitializeComponent(); DrawFunctions.LoadSkin(); //LoadBeatmapFromFile(@"C:\Program Files\osu!\Songs\1091022 Minase Inori - brave climber\Minase Inori - brave climber (-Brethia) [courage 1.32x (250bpm) AR10].osu"); //LoadBeatmapFromFile(@"C:\Program Files\osu!\Songs\1200218 The Living Tombstone - Goodbye Moonmen- Rick and Morty Remix\The Living Tombstone - Goodbye Moonmen- Rick and Morty Remix (Kyrian) [Pog].osu"); LoadBeatmapFromFile(@"C:\Program Files\osu!\Songs\919187 765 MILLION ALLSTARS - UNION!!\765 MILLION ALLSTARS - UNION!! (Fu3ya_) [We are all MILLION!! 1.48x (255bpm) AR10 OD10].osu"); plotter.InitAimStrainMeter(aimStrainMeter.plt); plotter.InitSortedPeaksPlot(sortedPeaksPlot.plt); aimStrainMeter.Render(); sortedPeaksPlot.Render(); stopwatch.Start(); gameTimer.Start(); }