MouseStateHistory

public class MouseStateHistory
Maintains a collection of sorted mouse states. This class is not threadsafe, only modify it from the UI thread.

Properties

ContentSpaceDistance

#
public float ContentSpaceDistance { get; }
Gets the distance from the oldest to the youngest state in content space. If there are no states, a distance of zero is returned.

ContentSpaceMaxDistance

#
public float ContentSpaceMaxDistance { get; }
Gets the furthest distance from the oldest state in content space. If there are no states, a distance of zero is returned.

ControlSpaceDistance

#
public float ControlSpaceDistance { get; }
Gets the distance from the oldest to the youngest state in control space. If there are no states, a distance of zero is returned.

ControlSpaceMaxDistance

#
public float ControlSpaceMaxDistance { get; }
Gets the furthest distance from the oldest state in control space. If there are no states, a distance of zero is returned.

Count

#
public int Count { get; }
Gets the number of states stored.

First

#
public MouseState First { get; }
Gets the oldest state in this history, if it exists.

Last

#
public MouseState Last { get; }
Gets the newest state in this history, if it exists.

Indexers

this[]

#
public MouseState this[int index] { get; }
Gets the state at the given index.
index (int)Index of state to get.
Mouse state at given index.

Methods

Add

#
public void Add(MouseState state)
Add a new state to this history.
state (MouseState)

Clear

#
public void Clear()
Remove all states from this history.

Clear

#
public void Clear(DateTime time)
Remove all states (except the oldest one) older than a specific time.
time (DateTime)

Clear

#
public void Clear(int amount)
Remove all states except the N-1 youngest ones and oldest one.
amount (int)Amount of states to keep.

FindIndexAfter

#
public int FindIndexAfter(DateTime time)
Gets the index of the oldest state after a specific time.
time (DateTime)Time to search for (must be in Utc format).
Index of oldest state after the given time, or -1 if no such state exists.

FindIndexBefore

#
public int FindIndexBefore(DateTime time)
Gets the index of the youngest state before a specific time.
time (DateTime)Time to search for (must be in Utc format).
Index of youngest state before the given time, or -1 if no such state exists.