Struct PenState
Default state layout for pen devices.
Implements
Namespace: UnityEngine.InputSystem.LowLevel
Assembly: Unity.InputSystem.dll
Syntax
public struct PenState : IInputStateTypeInfo
Fields
buttons
Button mask for which buttons on the pen are active.
Declaration
public ushort buttons
Field Value
Type | Description |
---|---|
ushort | Bitmask for buttons on the pen. |
delta
Screen-space motion delta.
Declaration
public Vector2 delta
Field Value
Type | Description |
---|---|
Vector2 | Screen-space motion delta. |
See Also
position
Current screen-space position of the pen.
Declaration
public Vector2 position
Field Value
Type | Description |
---|---|
Vector2 | Screen-space position. |
See Also
pressure
Pressure with which the pen is pressed against the surface. 0 is none, 1 is full pressure.
Declaration
public float pressure
Field Value
Type | Description |
---|---|
float | Pressure with which the pen is pressed. |
Remarks
May go beyond 1 depending on pressure calibration on the system. The maximum pressure point may be set to less than the physical maximum pressure point determined by the hardware.
See Also
tilt
The way the pen is leaned over perpendicular to the tablet surface. X goes [-1..1] left to right (with -1 and 1 being completely flush to the surface) and Y goes [-1..1] bottom to top.
Declaration
public Vector2 tilt
Field Value
Type | Description |
---|---|
Vector2 | Amount pen is leaning over. |
See Also
twist
Amount by which the pen is rotated around itself.
Declaration
public float twist
Field Value
Type | Description |
---|---|
float | Rotation of the pen around itself. |
See Also
Properties
Format
Format code for PenState.
Declaration
public static FourCC Format { get; }
Property Value
Type | Description |
---|---|
FourCC | Returns "PEN ". |
See Also
format
Declaration
public FourCC format { get; }
Property Value
Type | Description |
---|---|
FourCC |
Methods
WithButton(PenButton, bool)
Set or unset the bit in buttons for the given button
.
Declaration
public PenState WithButton(PenButton button, bool state = true)
Parameters
Type | Name | Description |
---|---|---|
PenButton | button | Button whose state to set. |
bool | state | Whether the button is on or off. |
Returns
Type | Description |
---|---|
PenState | Same PenState with an updated buttons mask. |