Struct PenState
Default state layout for pen devices.
Namespace: UnityEngine.InputSystem.LowLevel
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 |
---|---|
UInt16 | 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 |
---|---|
Single | 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 |
---|---|
Single | Rotation of the pen around itself. |
See Also
Properties
format
Declaration
public readonly FourCC format { get; }
Property Value
Type | Description |
---|---|
FourCC |
Implements
Format
Format code for PenState.
Declaration
public static readonly FourCC Format { get; }
Property Value
Type | Description |
---|---|
FourCC | Returns "PEN ". |
See Also
Methods
WithButton(PenButton, Boolean)
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. |
Boolean | state | Whether the button is on or off. |
Returns
Type | Description |
---|---|
PenState | Same PenState with an updated buttons mask. |