Table of Contents

Class DoubleClickDetector

Namespace
BSGameLib.Game.Input
Assembly
BSGameLib.Game.dll

Decides whether a click is the second half of a double-click: close enough in time and in place to the click before it.

public sealed class DoubleClickDetector
Inheritance
DoubleClickDetector
Inherited Members

Remarks

Worked out from the clicks themselves rather than taken from SDL's per-event click count, because MouseManager polls the button state once a frame and never sees the events -- and because an injected pointer (BSGameLib.Game.Hooks.PointerOverride) has no events at all, so an automated double-click would otherwise be impossible.

A third quick click does not make a second double-click: the pair is used up, and the third starts a new one. That is how every desktop treats a triple-click on something that only knows about doubles.

Fields

DefaultInterval

SDL's own default for SDL_HINT_MOUSE_DOUBLE_CLICK_TIME.

public static readonly TimeSpan DefaultInterval

Field Value

TimeSpan

DefaultRadius

SDL's own default for SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS, in pixels.

public const float DefaultRadius = 32

Field Value

float

Properties

Interval

How long after a click the next one may come and still count as a double-click. Defaults to 500 ms.

public TimeSpan Interval { get; set; }

Property Value

TimeSpan

Radius

How far apart the two clicks may be, in whatever space the positions are given in.

public float Radius { get; set; }

Property Value

float

Methods

Click(TimeSpan, Vector2)

Records a click at now and position, and says whether it completes a double-click.

public bool Click(TimeSpan now, Vector2 position)

Parameters

now TimeSpan
position Vector2

Returns

bool