Gamp v0.0.7-36-g24b1eb6
Gamp: Graphics, Audio, Multimedia and Processing
|
Pointer event of type PointerType. More...
#include <PointerEvent.hpp>
Public Member Functions | |
PointerEvent (uint16_t type, const jau::fraction_timespec &when, const WindowRef &source, InputModifier mods, const std::vector< PointerType > &pointerType, const std::vector< uint16_t > &pointerID, const std::vector< jau::math::Vec2i > &pos, const std::vector< float > &pressure, float maxPressure, uint16_t clickCount, InputButton button, const jau::math::Vec3f &rotation, float rotationScale) | |
Constructor for a multiple-pointer event. | |
PointerEvent (uint16_t type, const jau::fraction_timespec &when, const WindowRef &source, InputModifier mods, PointerType ptype, uint16_t id, jau::math::Vec2i pos, uint16_t clickCount, InputButton button, jau::math::Vec3f rotation, float rotationScale) | |
Constructor for traditional one-pointer event. | |
constexpr const std::vector< uint16_t > & | allPointerIDs () const noexcept |
See details for multiple-pointer events. | |
constexpr const std::vector< PointerType > & | allPointerTypes () const noexcept |
See details for multiple-pointer events. | |
constexpr const std::vector< jau::math::Vec2i > & | allPositions () const noexcept |
Returns position of all pointers in pixel units. | |
constexpr const std::vector< float > & | allPressures () const noexcept |
See details for multiple-pointer events. | |
constexpr InputButton | button () const noexcept |
Returns the button number, e.g. | |
constexpr uint16_t | clickCount () const noexcept |
PointerEvent | createVariant (uint16_t newEventType) |
constexpr float | maxPressure () const noexcept |
Returns the maximum pressure known for the input device generating this event. | |
constexpr size_t | pointerCount () const noexcept |
See details for multiple-pointer events. | |
constexpr int | pointerId (size_t index=0) const noexcept |
Return the pointer id for the given index or -1 if index not available. | |
int | pointerIdx (uint16_t id) const |
See details for multiple-pointer events. | |
constexpr PointerType | pointerType (size_t index) const noexcept |
See details for multiple-pointer events. | |
constexpr const jau::math::Vec2i & | position (size_t index=0) const noexcept |
Returns position of given pointer-index in pixel units. | |
constexpr float | pressure (bool normalized) const noexcept |
constexpr float | pressure (size_t index, bool normalized) const noexcept |
See details for multiple-pointer events. | |
constexpr const jau::math::Vec3f & | rotation () const noexcept |
Returns a 3-component float array filled with the values of the rotational axis in the following order: horizontal-, vertical- and z-axis. | |
constexpr float | rotationScale () const noexcept |
Returns the scale used to determine the rotation value , which semantics depends on the pointer type's PointerClass . | |
std::string | toString () const noexcept |
![]() | |
InputEvent (uint16_t type, const jau::fraction_timespec &when, const WindowRef &source, InputModifier mods) noexcept | |
constexpr int | buttonDownCount () const noexcept |
Returns the number of pressed buttons by counting the set bits: | |
std::vector< InputButton > | buttonsDown () const |
See also MouseEvent 's section about Multiple-Pointer Events. | |
constexpr bool | has_any (InputModifier bits) const noexcept |
Use with groups of bits / mask, e.g. | |
constexpr bool | is_set (InputModifier bits) const noexcept |
Use with single bits, e.g. | |
constexpr bool | isAltDown () const noexcept |
Returns true if modifier() contains InputModifier::alt. | |
constexpr bool | isAnyButtonDown () const noexcept |
Returns true if at least one button is pressed, otherwise false: | |
constexpr bool | isAutorepeat () const noexcept |
Returns true if modifier() contains InputModifier::autorepeat. | |
constexpr bool | isButtonDown (InputButton button) const noexcept |
See also MouseEvent 's section about Multiple-Pointer Events. | |
constexpr bool | isConfined () const noexcept |
Returns true if modifier() contains InputModifier::confined. | |
constexpr bool | isControlDown () const noexcept |
Returns true if modifier() contains InputModifier::ctrl. | |
constexpr bool | isInvisible () const noexcept |
Returns true if modifier() contains InputModifier::invisible. | |
constexpr bool | isMetaDown () const noexcept |
Returns true if modifier() contains InputModifier::meta. | |
constexpr bool | isShiftDown () const noexcept |
Returns true if modifier() contains InputModifier::shift. | |
constexpr InputModifier | modifier () const noexcept |
std::string | toString () const noexcept |
![]() | |
WTEvent (uint16_t type, const jau::fraction_timespec &when, const WindowRef &source) noexcept | |
constexpr bool | consumed () const noexcept |
Consumed events will stop traversing through listener. | |
constexpr void | setConsumed (bool v) noexcept |
Consumed events will stop traversing through listener. | |
constexpr const WindowWeakPtr & | source () const noexcept |
std::string | toString () const noexcept |
constexpr uint16_t | type () const noexcept |
constexpr const jau::fraction_timespec & | when () const noexcept |
Static Public Member Functions | |
static constexpr uint16_t | clickTimeout () |
static jau::math::Vec3f | swapRotation (float rotationXorY, InputModifier mods) |
Returns the 3-axis XYZ rotation array by given rotation on Y axis or X axis (if InputModifier::shift is given in mods). | |
![]() | |
static constexpr InputModifier | buttonMask (InputButton button) noexcept |
Returns the corresponding button mask for the given button. | |
Pointer event of type PointerType.
See also W3C pointerevent-interface.
All pointer coordinates of this interface are represented in pixel units, see Surface and Window.
Orientation of coordinate system depends on Window::isPointerBLOriented(), i.e. defaults to bottom-left.
In case an instance represents a multiple-pointer event, i.e. getPointerCount()
is > 1, the first data element of the multiple-pointer fields represents the pointer triggering this event.
For example e.getX(0)
at EVENT_POINTER_PRESSED
returns the data of the pressed pointer, etc.
Multiple-pointer event's button number
is mapped to the first pointer ID
triggering the event and the button mask bits
in the modifiers
field represent the pressed pointer IDs.
Users can query the pressed button and pointer count via InputEvent#getButtonDownCount()
or use the simple query InputEvent#isAnyButtonDown()
.
If representing a single-pointer PointerType#Mouse
event, pointer-ID
is 0
and a button value
of 0
denotes no button activity, i.e. PointerType#Mouse
move.
Definition at line 108 of file PointerEvent.hpp.
|
inline |
Constructor for traditional one-pointer event.
eventType | |
source | |
when | |
modifiers | |
pos | XY-axis |
clickCount | Mouse-button click-count |
button | button number, e.g. [BUTTON1 ..BUTTON_COUNT -1]. A button value of 0 denotes no button activity, i.e. PointerType#Mouse move. |
rotation | Rotation of all axis |
rotationScale | Rotation scale |
Definition at line 137 of file PointerEvent.hpp.
|
inline |
Constructor for a multiple-pointer event.
First element of multiple-pointer arrays represents the pointer which triggered the event!
See details for multiple-pointer events.
eventType | |
source | |
when | |
modifiers | |
pointerType | PointerType for each pointer (multiple pointer) |
pointerID | Pointer ID for each pointer (multiple pointer). IDs start w/ 0 and are consecutive numbers. A pointer-ID of -1 may also denote no pointer/button activity, i.e. PointerType#Mouse move. |
pos | XY-axis for each pointer (multiple pointer) |
pressure | Pressure for each pointer (multiple pointer) |
maxPressure | Maximum pointer pressure for all pointer |
button | Corresponding mouse-button |
clickCount | Mouse-button click-count |
rotation | Rotation of all axis |
rotationScale | Rotation scale |
Definition at line 183 of file PointerEvent.hpp.
|
inlinestatic |
Returns the 3-axis XYZ rotation array by given rotation on Y axis or X axis (if InputModifier::shift is given in mods).
Definition at line 111 of file PointerEvent.hpp.
|
inlinestaticconstexpr |
Definition at line 121 of file PointerEvent.hpp.
|
inline |
Definition at line 209 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
See details for multiple-pointer events.
Definition at line 219 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
See details for multiple-pointer events.
PointerType
for the data at index or null if index not available. Definition at line 225 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
See details for multiple-pointer events.
PointerType
s for all pointers Definition at line 236 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
Return the pointer id for the given index or -1 if index not available.
IDs start w/ 0 and are consecutive numbers.
See details for multiple-pointer events.
Definition at line 247 of file PointerEvent.hpp.
|
inline |
See details for multiple-pointer events.
Definition at line 258 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
See details for multiple-pointer events.
Definition at line 271 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
Returns the button number, e.g.
[BUTTON1
..BUTTON_COUNT
-1].
A button value of 0
denotes no button activity, i.e. PointerType#Mouse
move.
See details for multiple-pointer events.
Definition at line 282 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Returns position of given pointer-index in pixel units.
Orientation depends on Window::isPointerBLOriented().
See details for multiple-pointer events.
index | pointer-index within [0 .. getPointerCount() -1] |
Definition at line 294 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
Returns position of all pointers in pixel units.
Orientation depends on Window::isPointerBLOriented().
See details for multiple-pointer events.
Definition at line 302 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
normalized | if true, method returns the normalized pressure, i.e. pressure / maxPressure |
Definition at line 310 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
See details for multiple-pointer events.
index | pointer-index within [0 .. getPointerCount() -1] |
normalized | if true, method returns the normalized pressure, i.e. pressure / maxPressure |
Definition at line 320 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
See details for multiple-pointer events.
Definition at line 328 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
Returns the maximum pressure known for the input device generating this event.
This value may be self calibrating on devices/OS, where no known maximum pressure is known. Hence subsequent events may return a higher value.
Self calibrating maximum pressure is performed on:
Definition at line 343 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
Returns a 3-component float array filled with the values of the rotational axis in the following order: horizontal-, vertical- and z-axis.
A vertical rotation of > 0.0f is up and < 0.0f is down.
A horizontal rotation of > 0.0f is left and < 0.0f is right.
A z-axis rotation of > 0.0f is back and < 0.0f is front.
However, on some OS this might be flipped due to the OS default behavior. The latter is true for OS X 10.7 (Lion) for example.
On PointerClass onscreen
devices, i.e. touch screens
, rotation events are usually produced by a 2-finger movement, where horizontal and vertical rotation values are filled.
On PointerClass offscreen
devices, i.e. mouse
, either the horizontal or the vertical rotation value is filled.
The InputEvent#SHIFT_MASK
modifier is set in case |horizontal| > |vertical| value.
This can be utilized to implement only one 2d rotation direction, you may use isShiftDown()
to query it.
In case the pointer type is mouse
, events are usually send in steps of one, ie. -1.0f and 1.0f. Higher values may result due to fast scrolling. Fractional values may result due to slow scrolling with high resolution devices.
Here the button number refers to the wheel number.
In case the pointer type is of class PointerClass#Onscreen
, e.g. touch screen
, see getRotationScale()
for semantics.
Definition at line 385 of file PointerEvent.hpp.
|
inlineconstexprnoexcept |
Returns the scale used to determine the rotation value
, which semantics depends on the pointer type's
PointerClass
.
For PointerClass#Offscreen
, the scale is usually 1.0f
and denominates an abstract value without association to a physical value.
For PointerClass#Onscreen
, the scale varies and denominates the divisor of the distance the finger[s] have moved on the screen. Hence scale * rotation
reproduces the screen distance in pixels the finger[s] have moved.
Definition at line 400 of file PointerEvent.hpp.
|
inlinenoexcept |