Class PointerHitbox
Pointer hitbox class
Inheritance
Namespace
Syntax
public class PointerHitbox
Constructors
PointerHitbox(Coordinate, Action<PointerEventContext>?)
Makes a new instance of the pointer hitbox
Declaration
public PointerHitbox(Coordinate point, Action<PointerEventContext>? callback)
Parameters
| Name | Type | Description |
|---|---|---|
| point | Coordinate | Pointer hitbox to process at this point |
| callback | Action<PointerEventContext> | Callback function to run when a mouse event around it is processed |
PointerHitbox(Coordinate, Func<PointerEventContext, object?>?)
Makes a new instance of the pointer hitbox
Declaration
public PointerHitbox(Coordinate point, Func<PointerEventContext, object?>? callback)
Parameters
| Name | Type | Description |
|---|---|---|
| point | Coordinate | Pointer hitbox to process at this point |
| callback | Func<PointerEventContext, object> | Callback function to run when a mouse event around it is processed |
PointerHitbox(Coordinate, Coordinate, Action<PointerEventContext>?)
Makes a new instance of the pointer hitbox
Declaration
public PointerHitbox(Coordinate start, Coordinate end, Action<PointerEventContext>? callback)
Parameters
| Name | Type | Description |
|---|---|---|
| start | Coordinate | Starting position of the pointer hitbox |
| end | Coordinate | Ending position of the pointer hitbox |
| callback | Action<PointerEventContext> | Callback function to run when a mouse event around it is processed |
PointerHitbox(Coordinate, Coordinate, Func<PointerEventContext, object?>?)
Makes a new instance of the pointer hitbox
Declaration
public PointerHitbox(Coordinate start, Coordinate end, Func<PointerEventContext, object?>? callback)
Parameters
| Name | Type | Description |
|---|---|---|
| start | Coordinate | Starting position of the pointer hitbox |
| end | Coordinate | Ending position of the pointer hitbox |
| callback | Func<PointerEventContext, object> | Callback function to run when a mouse event around it is processed |
PointerHitbox(Coordinate, Size, Action<PointerEventContext>?)
Makes a new instance of the pointer hitbox
Declaration
public PointerHitbox(Coordinate start, Size size, Action<PointerEventContext>? callback)
Parameters
| Name | Type | Description |
|---|---|---|
| start | Coordinate | Starting position of the pointer hitbox |
| size | Size | Size of the pointer hitbox |
| callback | Action<PointerEventContext> | Callback function to run when a mouse event around it is processed |
PointerHitbox(Coordinate, Size, Func<PointerEventContext, object?>?)
Makes a new instance of the pointer hitbox
Declaration
public PointerHitbox(Coordinate start, Size size, Func<PointerEventContext, object?>? callback)
Parameters
| Name | Type | Description |
|---|---|---|
| start | Coordinate | Starting position of the pointer hitbox |
| size | Size | Size of the pointer hitbox |
| callback | Func<PointerEventContext, object> | Callback function to run when a mouse event around it is processed |
Properties
Button
Gets the button or the scrolling direction
ButtonPress
Gets the button press state
ClickTier
Specifies whether this is a single-click (1), double-click (2), or more. Only populated in the Released event, and you'll need to populate it when listening to this event via the hitbox instance if ProcessTier is on.
Property Value
Declaration
public int ClickTier { get; set; }
Dragging
Whether the pointer is being dragged or not
Property Value
Declaration
public bool Dragging { get; set; }
End
Gets the position of where the mouse hitbox ends (usually lower right corner of a rectangle)
Modifiers
Gets the modifiers pressed at the time of the event
ProcessTier
Whether to process the click tier or not
Property Value
Declaration
public bool ProcessTier { get; set; }
Size
Gets the size of the hitbox
Start
Gets the position of where the mouse hitbox starts (usually upper left corner of a rectangle)
Methods
IsPointerModifierMatch(PointerEventContext)
Checks to see whether the pointer matches the modifier conditions specified
Returns
True if the pointer meets all modifier conditions; otherwise, false.
Declaration
public bool IsPointerModifierMatch(PointerEventContext context)
Parameters
| Name | Type | Description |
|---|---|---|
| context | PointerEventContext | Pointer event context to use in comparison |
IsPointerWithin(PointerEventContext)
Checks to see whether the pointer is within this hitbox
Returns
True if the pointer is within the hitbox; otherwise, false.
Declaration
public bool IsPointerWithin(PointerEventContext context)
Parameters
| Name | Type | Description |
|---|---|---|
| context | PointerEventContext | Pointer event context to use in comparison |
ProcessPointer(PointerEventContext, out bool)
Processes the pointer with a callback function
Returns
null if status is false or if there is no callback function; otherwise, the callback function return value
Declaration
public object? ProcessPointer(PointerEventContext context, out bool status)
Parameters
| Name | Type | Description |
|---|---|---|
| context | PointerEventContext | Pointer event context to use when processing the pointer |
| status | bool | True if the pointer is within the hitbox and meets all modifier conditions; otherwise, false. |