reckfellENGINE

InputEventKey

A keyboard event: codes, side, Unicode and repetition.

On this page
class InputEventKeyReckfellSharpInherits InputEventWithModifiers

Keep field purposes separate. Keycode describes a logical key, PhysicalKeycode its position for gameplay, KeyLabel its label and Unicode an event character code point. Editing one field neither derives the others nor injects a press into Input.

An InputMap binding should use one selector: Keycode, PhysicalKeycode or KeyLabel. A nonzero Keycode is the only selector compared: a mismatch does not fall back to PhysicalKeycode. PhysicalKeycode is used when Keycode = 0; KeyLabel is used when the first two are zero. A Unicode-only binding does not match a key press in the current engine. Binding matching is not equality of every event field.

Filter Echo for a one-time action. The complete example requires an already registered action; pass it an event from your input handler. Do not attach the static helper to an Entity.

C#
using System;
using Reckfell;

public static class KeyboardEventExample
{
    // Register the action in InputMap before calling this from an input handler.
    public static bool IsInitialPress(InputEvent inputEvent, StringName action)
    {
        if (!InputMap.HasAction(action))
            throw new ArgumentException("The action must already exist.", nameof(action));
        return inputEvent is InputEventKey key && !key.Echo && key.IsActionPressed(action);
    }
}

For text input, do not treat every key as a committed character: Unicode contains neither the whole string nor a replacement for composition/IME handling. Actual layout data depends on the platform.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

InputEventKeyConstructor
# InputEventKey
C#
public InputEventKey();

Creates an event without submitting input. Key codes, Unicode and Location are 0; Pressed and Echo are false. Fields are independent: assigning PhysicalKeycode does not derive Keycode or Unicode.

Properties7

EchoProperty
# Echo
C#
public bool Echo { get; set; }

Repeat marker for a held key. IsActionPressed filters such repeats by default; allowEcho permits them. Setting Echo neither creates a repeating timer nor controls the OS repeat rate.

KeyLabelProperty
# KeyLabel
C#
public Key KeyLabel { get; set; }

Platform-provided key label represented as a Key/character code. Used for binding matching only when both Keycode and PhysicalKeycode are 0. It is not the same concept as an entered character's Unicode.

KeycodeProperty
# Keycode
C#
public Key Keycode { get; set; }

Logical Key code for shortcuts and bindings. Has priority over PhysicalKeycode and KeyLabel when matching a binding. Zero means unset. Does not contain committed text input.

LocationProperty
# Location
C#
public KeyLocation Location { get; set; }

Key side: Left, Right or unspecified. A physical-key binding checks it when the binding specifies a side. Does not describe mouse position or change PhysicalKeycode itself.

PhysicalKeycodeProperty
# PhysicalKeycode
C#
public Key PhysicalKeycode { get; set; }

Physical key-position code using the US QWERTY reference, useful for gameplay independent of the logical letter. Used by a binding when Keycode = 0; Location can additionally constrain the side. Assigning it does not press a key.

PressedProperty
# Pressed
C#
public bool Pressed { get; set; }

Event press state. Neither creates a physical press nor computes Echo. For a one-time action distinguish initial presses from repeats; check the event or action state for release.

UnicodeProperty
# Unicode
C#
public long Unicode { get; set; }

Event character code point when available; 0 means absent. This is neither a string nor a fallback InputMap action selector. The C# long type does not make every 64-bit value valid: supply valid Unicode code points. A non-BMP value such as U+1F600 does not fit in one C# char.

Methods19

AsTextKeyLabelstring
# AsTextKeyLabel
C#
public string AsTextKeyLabel();

Formats KeyLabel and modifiers for display. An unset code uses a textual marker. Does not turn the event into committed text and is unsuitable as a stable stored binding key.

Returns string

Readable representation of the selected field and modifiers; text may depend on localization.

AsTextKeycodestring
# AsTextKeycode
C#
public string AsTextKeycode();

Formats Keycode and modifiers for display. An unset code uses a textual marker. Does not turn the event into committed text and is unsuitable as a stable stored binding key.

Returns string

Readable representation of the selected field and modifiers; text may depend on localization.

AsTextLocationstring
# AsTextLocation
C#
public string AsTextLocation();

The current implementation returns left for Location.Left, right for Location.Right, otherwise an empty string. Represents Location, not the key name.

Returns string

left, right or an empty string.

AsTextPhysicalKeycodestring
# AsTextPhysicalKeycode
C#
public string AsTextPhysicalKeycode();

Formats PhysicalKeycode and modifiers for display. An unset code uses a textual marker. Does not turn the event into committed text and is unsuitable as a stable stored binding key.

Returns string

Readable representation of the selected field and modifiers; text may depend on localization.

GetKeyLabelKey
# GetKeyLabel
C#
public Key GetKeyLabel();

Returns KeyLabel from the event without polling the keyboard again.

Returns Key

Stored KeyLabel value under the property contract.

GetKeyLabelWithModifiersKey
# GetKeyLabelWithModifiers
C#
public Key GetKeyLabelWithModifiers();

Combines KeyLabel and the current GetModifiersMask using bitwise OR. Does not select a fallback code from other fields or return text.

Returns Key

A Key value containing KeyLabel and modifier bits.

GetKeycodeKey
# GetKeycode
C#
public Key GetKeycode();

Returns Keycode from the event without polling the keyboard again.

Returns Key

Stored Keycode value under the property contract.

GetKeycodeWithModifiersKey
# GetKeycodeWithModifiers
C#
public Key GetKeycodeWithModifiers();

Combines Keycode and the current GetModifiersMask using bitwise OR. Does not select a fallback code from other fields or return text.

Returns Key

A Key value containing Keycode and modifier bits.

GetLocationKeyLocation
# GetLocation
C#
public KeyLocation GetLocation();

Returns Location from the event without polling the keyboard again.

Returns KeyLocation

Stored Location value under the property contract.

GetPhysicalKeycodeKey
# GetPhysicalKeycode
C#
public Key GetPhysicalKeycode();

Returns PhysicalKeycode from the event without polling the keyboard again.

Returns Key

Stored PhysicalKeycode value under the property contract.

GetPhysicalKeycodeWithModifiersKey
# GetPhysicalKeycodeWithModifiers
C#
public Key GetPhysicalKeycodeWithModifiers();

Combines PhysicalKeycode and the current GetModifiersMask using bitwise OR. Does not select a fallback code from other fields or return text.

Returns Key

A Key value containing PhysicalKeycode and modifier bits.

GetUnicodelong
# GetUnicode
C#
public long GetUnicode();

Returns Unicode from the event without polling the keyboard again.

Returns long

Stored Unicode value under the property contract.

SetEchovoid
# SetEcho
C#
public void SetEcho(bool echo);

Sets Echo using the property contract. Does not submit the event or derive the other key fields.

Parameters
NameTypeDefault
echobool—
echo

New Echo value in the property's format.

SetKeyLabelvoid
# SetKeyLabel
C#
public void SetKeyLabel(Key keyLabel);

Sets KeyLabel using the property contract. Does not submit the event or derive the other key fields.

Parameters
NameTypeDefault
keyLabelKey—
keyLabel

New KeyLabel value in the property's format.

SetKeycodevoid
# SetKeycode
C#
public void SetKeycode(Key keycode);

Sets Keycode using the property contract. Does not submit the event or derive the other key fields.

Parameters
NameTypeDefault
keycodeKey—
keycode

New Keycode value in the property's format.

SetLocationvoid
# SetLocation
C#
public void SetLocation(KeyLocation location);

Sets Location using the property contract. Does not submit the event or derive the other key fields.

Parameters
NameTypeDefault
locationKeyLocation—
location

New Location value in the property's format.

SetPhysicalKeycodevoid
# SetPhysicalKeycode
C#
public void SetPhysicalKeycode(Key physicalKeycode);

Sets PhysicalKeycode using the property contract. Does not submit the event or derive the other key fields.

Parameters
NameTypeDefault
physicalKeycodeKey—
physicalKeycode

New PhysicalKeycode value in the property's format.

SetPressedvoid
# SetPressed
C#
public void SetPressed(bool pressed);

Sets Pressed using the property contract. Does not submit the event or derive the other key fields.

Parameters
NameTypeDefault
pressedbool—
pressed

New Pressed value in the property's format.

SetUnicodevoid
# SetUnicode
C#
public void SetUnicode(long unicode);

Sets Unicode using the property contract. Does not submit the event or derive the other key fields.

Parameters
NameTypeDefault
unicodelong—
unicode

New Unicode value in the property's format.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.