Difference between revisions of "Input Pointers"

From PowerUI
Jump to: navigation, search
(Mouse Input)
Line 14: Line 14:
  
 
PowerUI has a custom input pointer, a [http://powerui.kulestar.com/powerdocs-2_0/classPowerUI_1_1CameraPointer.html CameraPointer], for virtual reality. See [[Virtual Reality Cameras|the article]] relating to virtual reality camera's.
 
PowerUI has a custom input pointer, a [http://powerui.kulestar.com/powerdocs-2_0/classPowerUI_1_1CameraPointer.html CameraPointer], for virtual reality. See [[Virtual Reality Cameras|the article]] relating to virtual reality camera's.
 +
 +
== Accessing all pointers ==
 +
 +
PowerUI implements various standard API's for accessing pointers:
 +
 +
* [http://powerui.kulestar.com/powerdocs-2_0/classPowerUI_1_1TouchEvent.html TouchEvent].touches
 +
* TouchEvent.targetTouches
 +
* TouchEvent.changedTouches
 +
* TouchEvent.identifier
 +
* ''More!''
 +
 +
The non-standard internal ones:
 +
 +
* [http://powerui.kulestar.com/powerdocs-2_0/classPowerUI_1_1UIEvent.html#a2daa44fbceddd8510bc2791340a432b4 UIEvent.trigger] - ''MouseEvent, TouchEvent etc; The InputPointer instance this event came from''
 +
* [http://powerui.kulestar.com/powerdocs-2_0/classPowerUI_1_1InputPointer.html#a77189cd51fedf33c73759f641c8380ef InputPointer.All] - ''All active pointers (array created on use; Use AllRaw and PointerCount for better performance)''
 +
* [http://powerui.kulestar.com/powerdocs-2_0/classPowerUI_1_1InputPointer.html#a731d759f87ece43622fb497b5e3d88b3 InputPointer.PointerCount] - ''The number of actual pointers in the AllRaw pointer set''
 +
* [http://powerui.kulestar.com/powerdocs-2_0/classPowerUI_1_1InputPointer.html#aa76092f569304c8fcf6c3bea1f9612e3 InputPointer.AllRaw] - ''The raw set of pointers. Entries beyond PointerCount are random noise/ undefined.''
 +
  
 
== Source locations ==
 
== Source locations ==

Revision as of 22:22, 7 March 2017

An input pointer is any kind of pointing device which presses, hovers, or both. A mouse, a finger and a stylus are the three main ones. They are related to the (draft) W3C Pointer Events specification. Here's some specific notes about the input pointers available in PowerUI.

Mouse Input

PowerUI assumes that only a desktop platform will have a mouse. A MousePointer is created when it's running on a desktop and PowerUI.Input.CreateSystemMouse is true (the default). If your project doesn't use a mouse pointer on a desktop platform (it's virtual reality for example), you'd remove it by setting CreateSystemMouse to false in an Awake method.

Touch and Stylus Input

PowerUI handles multi-touch input by default on any platform which supports it. It will automatically stack with a mouse input on desktops which also have touchscreens. Each time a new touch is detected, a FingerPointer or a StylusPointer is created. They fire the various touch events as well as mouse events.

All pointers are primary (which means they all fire those mouse events too).

Virtual Reality

PowerUI has a custom input pointer, a CameraPointer, for virtual reality. See the article relating to virtual reality camera's.

Accessing all pointers

PowerUI implements various standard API's for accessing pointers:

  • TouchEvent.touches
  • TouchEvent.targetTouches
  • TouchEvent.changedTouches
  • TouchEvent.identifier
  • More!

The non-standard internal ones:

  • UIEvent.trigger - MouseEvent, TouchEvent etc; The InputPointer instance this event came from
  • InputPointer.All - All active pointers (array created on use; Use AllRaw and PointerCount for better performance)
  • InputPointer.PointerCount - The number of actual pointers in the AllRaw pointer set
  • InputPointer.AllRaw - The raw set of pointers. Entries beyond PointerCount are random noise/ undefined.


Source locations

You'll find the implementations of MousePointer, FingerPointer etc here:

  • PowerUI/Source/Engine/Input/