Sample
Here is a simple example program that tracks the current pointer on the screen and prints their location. Access input field, class inherits from @ Siliconstudio.xenko. the class of the script.
Public Override AsyncTask Execute () {varPointerpositions =Newdictionary<int, vector2>(); while(true) { awaitScheduler.nextframe (); foreach(varPointereventinchinput.pointerevents) {Switch(pointerevent.state) { CasePointerstate.down:pointerpositions[pointerevent.pointerid]=pointerevent.position; Break; CasePointerstate.move:pointerpositions[pointerevent.pointerid]=pointerevent.position; Break; Casepointerstate.up: Casepointerstate.out: CasePointerState.Cancel:pointerPositions.Remove (Pointerevent.pointerid); Break; default: Throw NewArgumentOutOfRangeException (); } } varPositionsstr = PointerPositions.Values.Aggregate ("", (current, pointer) = + current + (pointer. ToString () +", ")); Logger. Info ("there is currently {0} pointers on the screens located at {1}", Pointerpositions.count, POSITIONSSTR); } }
View CodeRemarks
- A Pointer Event contains information on only one pointer. If several pointers is modified simultaneously one pointer event was sent for each of the them.
- Pointer Events is listed by chronological order (time of the event).
- A series of pointer event for a given pointer all starts by a down action then followed by 0 or more move< /c3> Actions and ends by a up, out or Cancel action.
- Pointer positions is normalized. (0,0) represents the Left-top corner of the screen and (a) represents the Right-bottom corner of the screen.
- The Association Finger <-> Pointer ID is valid only during an down->move->up sequence of poi Nter events. So a given finger can has different IDs each time it leaves the screen.
- Pointer Events ' delta-values (e.g Deltatime and deltaposition) represent the changes since the last event of the same POI Nter (same pointer ID). The Delta values are all nulls at the beginning a given pointer series of event (e.g. when the pointer was down ). /c0>
Speech
A pointer event contains only one pointer to the information. If there are several pointers at the same time to modify a pointer event to send.
pointer events list events in chronological order (time).
A series of pointer events is always first acted on a given pointer and then followed by 0 or more move operations and ends, or cancel the action.
The pointer position is normalized. (0,0) represents the corner of the tool screen, which represents the corner of the right-bottom screen.
association finger <-> pointer ID is valid only in Descent->-> Moves the sequence of events for the pointer. So the given finger can have a different ID every time you leave the screen.
increment values for pointer events (such as Deltatime and Deltaposition) Represents the same change since the last event pointer (the same pointer id). δ value always starts with a given null pointer to a series of events (for example, when the pointer state).
The
Xenko Base API note 3-pointers the finger touch on the point of the pointing device screen.