InputEventMouseButton
A mouse button or wheel-step event.
Check ButtonIndex and the transition: press, release or cancellation. DoubleClick is a separate marker and does not replace checking Pressed. Constructing an event does not press a physical button.
The complete example detects a double left press while rejecting release and cancellation. The second method demonstrates separate gamepad-device filtering. Pass an event from your input handler; do not attach the static helper to an Entity.
using Reckfell;
public static class ButtonEventExample
{
public static bool IsDoubleLeftPress(InputEvent inputEvent)
{
return inputEvent is InputEventMouseButton button
&& button.ButtonIndex == MouseButton.Left
&& button.Pressed && button.DoubleClick && !button.Canceled;
}
public static bool IsSelectedPadPress(InputEvent inputEvent, int device, JoyButton index)
{
return inputEvent is InputEventJoypadButton button
&& button.Device == device && button.ButtonIndex == index && button.Pressed;
}
}Wheel directions use MouseButton.WheelUp, WheelDown, WheelLeft and WheelRight. Factor stores scroll amount but does not promise identical hardware units on every device.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
InputEventMouseButtonConstructor
public InputEventMouseButton();Creates an event without submitting input: ButtonIndex = MouseButton.None, Factor = 1; Pressed, DoubleClick and Canceled are false. Position, GlobalPosition and ButtonMask are inherited from InputEventMouse.
Properties5
ButtonIndexProperty
public MouseButton ButtonIndex { get; set; }MouseButton button or wheel direction for this event. This is one index, not a bitmask of simultaneously held buttons; use ButtonMask for that.
CanceledProperty
public bool Canceled { get; set; }Cancellation flag. When true, IsPressed() and IsReleased() both return false. The setter does not erase the stored press flag: clearing Canceled can expose Pressed = true again.
DoubleClickProperty
public bool DoubleClick { get; set; }Double-click marker for this event. Does not compute time between events and does not alone imply a press: also check Pressed, ButtonIndex and Canceled.
FactorProperty
public float Factor { get; set; }Scroll amount for a wheel event; normally 1 for an ordinary step. The setter does not clamp to 0..1; 2.5 remains 2.5. Units and precision depend on platform and device. Factor neither changes ButtonIndex nor supplies GetActionStrength.
PressedProperty
public bool Pressed { get; set; }Event press state. The getter accounts for Canceled: cancellation makes it false even if true was previously assigned. Do not treat !Pressed alone as an ordinary release check; inspect Canceled first.
Methods8
GetButtonIndexMouseButton
public MouseButton GetButtonIndex();Returns ButtonIndex without submitting input or polling the mouse again.
MouseButtonMouseButton button or wheel-direction index.
GetFactorfloat
public float GetFactor();Returns Factor without submitting input or polling the mouse again.
floatStored Factor value.
IsDoubleClickbool
public bool IsDoubleClick();Returns DoubleClick without submitting input or polling the mouse again.
boolDoubleClick flag, separate from the press-state check.
SetButtonIndexvoid
public void SetButtonIndex(MouseButton buttonIndex);Sets ButtonIndex using the property rules. Changes event data, not device state.
| Name | Type | Default |
|---|---|---|
buttonIndex | MouseButton | — |
buttonIndexNew ButtonIndex value; see the property for its limits.
SetCanceledvoid
public void SetCanceled(bool canceled);Sets Canceled using the property rules. Changes event data, not device state.
| Name | Type | Default |
|---|---|---|
canceled | bool | — |
canceledNew Canceled value; see the property for its limits.
SetDoubleClickvoid
public void SetDoubleClick(bool doubleClick);Sets DoubleClick using the property rules. Changes event data, not device state.
| Name | Type | Default |
|---|---|---|
doubleClick | bool | — |
doubleClickNew DoubleClick value; see the property for its limits.
SetFactorvoid
public void SetFactor(float factor);Sets Factor using the property rules. Changes event data, not device state.
| Name | Type | Default |
|---|---|---|
factor | float | — |
factorNew Factor value; see the property for its limits.
SetPressedvoid
public void SetPressed(bool pressed);Sets Pressed using the property rules. Changes event data, not device state.
| Name | Type | Default |
|---|---|---|
pressed | bool | — |
pressedNew Pressed value; see the property for its limits.