public TestCaseIntroSequence() { OsuLogo logo; var rateAdjustClock = new StopwatchClock(true); var framedClock = new FramedClock(rateAdjustClock); framedClock.ProcessFrame(); Add(new Container { RelativeSizeAxes = Axes.Both, Clock = framedClock, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, logo = new OsuLogo { Anchor = Anchor.Centre, } } }); AddStep(@"Restart", logo.PlayIntro); AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v); }
private void load(RulesetStore rulesets) { var rateAdjustClock = new StopwatchClock(true); framedClock = new FramedClock(rateAdjustClock); AddStep(@"KaraokeObject_Demo001", () => loadHitobjects(DemoKaraokeObject.GenerateDemo001())); AddStep(@"ResetPosition", () => { appearPosition = new Vector2(0, -200); }); framedClock.ProcessFrame(); var clockAdjustContainer = new Container { RelativeSizeAxes = Axes.Both, Clock = framedClock, Children = new[] { playfieldContainer = new KaraokeInputManager(rulesets.GetRuleset(0)) { RelativeSizeAxes = Axes.Both }, } }; Add(clockAdjustContainer); }
public override void ProcessFrame() { base.ProcessFrame(); decoupledStopwatch.Rate = adjustableSource?.Rate ?? 1; decoupledClock.ProcessFrame(); bool sourceRunning = SourceClock?.IsRunning ?? false; if (IsCoupled || sourceRunning) { if (sourceRunning) { decoupledStopwatch.Start(); } else { decoupledStopwatch.Stop(); } decoupledStopwatch.Seek(CurrentTime); } else { if (decoupledClock.IsRunning) { //if we're running but our source isn't, we should try a seek to see if it's capable to switch to it for the current value. if (adjustableSource?.Seek(CurrentTime) == true) { Start(); } } } }
private void load(RulesetStore rulesets) { var rateAdjustClock = new StopwatchClock(true); framedClock = new FramedClock(rateAdjustClock); AddStep(@"circles", () => loadHitobjects(HitObjectType.Circle)); AddStep(@"slider", () => loadHitobjects(HitObjectType.Slider)); AddStep(@"spinner", () => loadHitobjects(HitObjectType.Spinner)); AddToggleStep("Auto", state => { auto = state; loadHitobjects(mode); }); AddSliderStep("Playback speed", 0.0, 2.0, 0.5, v => rateAdjustClock.Rate = v); framedClock.ProcessFrame(); var clockAdjustContainer = new Container { RelativeSizeAxes = Axes.Both, Clock = framedClock, Children = new[] { playfieldContainer = new OsuInputManager(rulesets.GetRuleset(0)) { RelativeSizeAxes = Axes.Both }, approachContainer = new Container { RelativeSizeAxes = Axes.Both } } }; Add(clockAdjustContainer); }
protected override void Update() { base.Update(); realtimeClock.ProcessFrame(); if (clock != null) { clock.CurrentTime += realtimeClock.ElapsedFrameTime; } if (video != null) { int newSecond = (int)(video.PlaybackPosition / 1000.0); if (newSecond != currentSecond) { currentSecond = newSecond; fps = video.FramesProcessed - lastFramesProcessed; lastFramesProcessed = video.FramesProcessed; } if (timeText != null) { timeText.Text = $"aim time: {video.PlaybackPosition:N2}\n" + $"video time: {video.CurrentFrameTime:N2}\n" + $"duration: {video.Duration:N2}\n" + $"buffered {video.AvailableFrames}\n" + $"FPS: {fps}\n" + $"State: {video.State}"; } didDecode |= video.State == VideoDecoder.DecoderState.Running; } }
public override void ProcessFrame() { base.ProcessFrame(); decoupledStopwatch.Rate = adjustableSource?.Rate ?? 1; decoupledClock.ProcessFrame(); bool sourceRunning = SourceClock?.IsRunning ?? false; if (IsRunning) { if (IsCoupled) { // when coupled, we want to stop when our source clock stops. if (sourceRunning) { decoupledStopwatch.Seek(CurrentTime); } else { Stop(); } } else { // when decoupled, if we're running but our source isn't, we should try a seek to see if it's capable to handle the current time. if (!sourceRunning) { Start(); } } } }
public TestCaseHitObjects() { var rateAdjustClock = new StopwatchClock(true); framedClock = new FramedClock(rateAdjustClock); playbackSpeed.ValueChanged += delegate { rateAdjustClock.Rate = playbackSpeed.Value; }; playbackSpeed.TriggerChange(); AddStep(@"circles", () => loadHitobjects(HitObjectType.Circle)); AddStep(@"slider", () => loadHitobjects(HitObjectType.Slider)); AddStep(@"spinner", () => loadHitobjects(HitObjectType.Spinner)); AddToggleStep(@"auto", state => { auto = state; loadHitobjects(mode); }); BasicSliderBar <double> sliderBar; Add(new Container { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new SpriteText { Text = "Playback Speed" }, sliderBar = new BasicSliderBar <double> { Width = 150, Height = 10, SelectionColor = Color4.Orange, } } }); sliderBar.Current.BindTo(playbackSpeed); framedClock.ProcessFrame(); var clockAdjustContainer = new Container { RelativeSizeAxes = Axes.Both, Clock = framedClock, Children = new[] { playfieldContainer = new Container { RelativeSizeAxes = Axes.Both }, approachContainer = new Container { RelativeSizeAxes = Axes.Both } } }; Add(clockAdjustContainer); }
public TestManageFontPreview() { Clock = new FramedClock(); Clock.ProcessFrame(); Add(np = new NowPlayingOverlay { Origin = Anchor.TopRight, Anchor = Anchor.TopRight, }); }
public override void Reset() { base.Reset(); playbackSpeed.TriggerChange(); AddStep(@"circles", () => load(HitObjectType.Circle)); AddStep(@"slider", () => load(HitObjectType.Slider)); AddStep(@"spinner", () => load(HitObjectType.Spinner)); AddToggleStep(@"auto", state => { auto = state; load(mode); }); Add(new Container { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new SpriteText { Text = "Playback Speed" }, new BasicSliderBar <double> { Width = 150, Height = 10, SelectionColor = Color4.Orange, Bindable = playbackSpeed } } }); framedClock.ProcessFrame(); var clockAdjustContainer = new Container { RelativeSizeAxes = Axes.Both, Clock = framedClock, Children = new[] { playfieldContainer = new Container { RelativeSizeAxes = Axes.Both }, approachContainer = new Container { RelativeSizeAxes = Axes.Both } } }; Add(clockAdjustContainer); load(mode); }
private void updateClock() { if (parentGameplayClock == null) { setClock(); // LoadComplete may not be run yet, but we still want the clock. } validState = true; manualClock.Rate = parentGameplayClock.Rate; manualClock.IsRunning = parentGameplayClock.IsRunning; var newProposedTime = parentGameplayClock.CurrentTime; try { if (Math.Abs(manualClock.CurrentTime - newProposedTime) > sixty_frame_time * 1.2f) { newProposedTime = manualClock.Rate > 0 ? Math.Min(newProposedTime, manualClock.CurrentTime + sixty_frame_time) : Math.Max(newProposedTime, manualClock.CurrentTime - sixty_frame_time); } if (!isAttached) { manualClock.CurrentTime = newProposedTime; } else { double?newTime = ReplayInputHandler.SetFrameFromTime(newProposedTime); if (newTime == null) { // we shouldn't execute for this time value. probably waiting on more replay data. validState = false; requireMoreUpdateLoops = true; manualClock.CurrentTime = newProposedTime; return; } manualClock.CurrentTime = newTime.Value; } requireMoreUpdateLoops = manualClock.CurrentTime != parentGameplayClock.CurrentTime; } finally { // The manual clock time has changed in the above code. The framed clock now needs to be updated // to ensure that the its time is valid for our children before input is processed framedClock.ProcessFrame(); } }
private void load(RulesetStore rulesets) { var rateAdjustClock = new StopwatchClock(true); framedClock = new FramedClock(rateAdjustClock); framedClock.ProcessFrame(); playField = new RpPlayfield(); //TODO : 增加物件 Add(playField); }
protected virtual void OnApplicationIdle() { inputPerformanceCollectionPeriod?.Dispose(); InputMonitor.NewFrame(); using (InputMonitor.BeginCollecting(PerformanceCollectionType.Scheduler)) InputScheduler.Update(); using (InputMonitor.BeginCollecting(PerformanceCollectionType.Sleep)) InputClock.ProcessFrame(); inputPerformanceCollectionPeriod = InputMonitor.BeginCollecting(PerformanceCollectionType.WndProc); }
public TestCaseBeatSyncedContainer() { Clock = new FramedClock(); Clock.ProcessFrame(); Add(new BeatContainer { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, }); Add(mc = new MusicController { Origin = Anchor.TopRight, Anchor = Anchor.TopRight, }); }
public TestCaseOsuGame() { var rateAdjustClock = new StopwatchClock(true); var framedClock = new FramedClock(rateAdjustClock); framedClock.ProcessFrame(); Add(new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }); Add(new Loader()); AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v); }
public TestSceneBeatSyncedContainer() { Clock = new FramedClock(); Clock.ProcessFrame(); AddRange(new Drawable[] { new BeatContainer { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, }, np = new NowPlayingOverlay { Origin = Anchor.TopRight, Anchor = Anchor.TopRight, } }); }
public TestSceneScanLine() { Clock = new FramedClock(); Clock.ProcessFrame(); AddRange(new Drawable[] { musicController, new ScanLine { RelativeSizeAxes = Axes.Both }, np = new NowPlayingOverlay { Origin = Anchor.TopRight, Anchor = Anchor.TopRight, } }); }
private void updateClock() { if (parentGameplayClock == null) { setClock(); // LoadComplete may not be run yet, but we still want the clock. } validState = true; manualClock.Rate = parentGameplayClock.Rate; manualClock.IsRunning = parentGameplayClock.IsRunning; var newProposedTime = parentGameplayClock.CurrentTime; try { if (!FrameStablePlayback) { manualClock.CurrentTime = newProposedTime; requireMoreUpdateLoops = false; return; } else if (firstConsumption) { // On the first update, frame-stability seeking would result in unexpected/unwanted behaviour. // Instead we perform an initial seek to the proposed time. manualClock.CurrentTime = newProposedTime; // do a second process to clear out ElapsedTime framedClock.ProcessFrame(); firstConsumption = false; } else if (manualClock.CurrentTime < gameplayStartTime) { manualClock.CurrentTime = newProposedTime = Math.Min(gameplayStartTime, newProposedTime); } else if (Math.Abs(manualClock.CurrentTime - newProposedTime) > sixty_frame_time * 1.2f) { newProposedTime = newProposedTime > manualClock.CurrentTime ? Math.Min(newProposedTime, manualClock.CurrentTime + sixty_frame_time) : Math.Max(newProposedTime, manualClock.CurrentTime - sixty_frame_time); } if (!isAttached) { manualClock.CurrentTime = newProposedTime; } else { double?newTime = ReplayInputHandler.SetFrameFromTime(newProposedTime); if (newTime == null) { // we shouldn't execute for this time value. probably waiting on more replay data. validState = false; requireMoreUpdateLoops = true; manualClock.CurrentTime = newProposedTime; return; } manualClock.CurrentTime = newTime.Value; } requireMoreUpdateLoops = manualClock.CurrentTime != parentGameplayClock.CurrentTime; } finally { // The manual clock time has changed in the above code. The framed clock now needs to be updated // to ensure that the its time is valid for our children before input is processed framedClock.ProcessFrame(); } }
protected override void Update() { base.Update(); localClock.ProcessFrame(); }