Skip to content

Commit

Permalink
Merge pull request #1157 from smoogipoo/stop-clock-update
Browse files Browse the repository at this point in the history
Expose a way to stop clock updates
  • Loading branch information
peppy authored Nov 13, 2017
2 parents 3e85d28 + 44fa87f commit c95b935
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion osu.Framework/Graphics/Drawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public virtual bool UpdateSubTree()
if (isDisposed)
throw new ObjectDisposedException(ToString(), "Disposed Drawables may never be in the scene graph.");

if (Parent != null) //we don't want to update our clock if we are at the top of the stack. it's handled elsewhere for us.
if (ShouldProcessClock)
customClock?.ProcessFrame();

if (loadState < LoadState.Ready)
Expand Down Expand Up @@ -1152,6 +1152,12 @@ public virtual void UpdateClock(IFrameBasedClock clock)
scheduler?.UpdateClock(this.clock);
}

/// <summary>
/// Whether <see cref="IFrameBasedClock.ProcessFrame"/> should be automatically invoked on this <see cref="Drawable"/>'s <see cref="Clock"/>
/// in <see cref="UpdateSubTree"/>. This should only be used in scenarios where <see cref="UpdateSubTree"/> is overridden to perform the functionality itself.
/// </summary>
protected virtual bool ShouldProcessClock => Parent != null; //we don't want to update our clock if we are at the top of the stack. it's handled elsewhere for us.

/// <summary>
/// The time at which this drawable becomes valid (and is considered for drawing).
/// </summary>
Expand Down

0 comments on commit c95b935

Please sign in to comment.