PrimaryClick

Introduction

The PrimaryClick property returns whether the Cursor has been clicked this frame. A click is defined as:

  • PrimaryDown was true last frame and…
  • PrimaryDown is false this frame

This occurs if the user pushes and releases the left moue button or touches and lifts on the touch screen.

If developing games which may use a touch screen, you should consider PrimaryClickNoSlide to differentiate between when the user touches and releases in the same spot vs. when the user touches, slides, then releases.

Example

The cursor can be checked to see if a click occurred in any CustomActivity code. The following code creates a Circle wherever the user clicks:

if(GuiManager.Cursor.PrimaryClick)
{
    var circle = new Circle();
    circle.X = GuiManager.Cursor.WorldXAt(0);
    circle.Y = GuiManager.Cursor.WorldYAt(0);
}