Show / Hide Table of Contents

Class Input

Handles and manages all input devices. Input is a staticton (a singleton with an additional static interface).

Inheritance
System.Object
Input
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Fusee.Engine.Core
Assembly: Fusee.Engine.Core.dll
Syntax
public class Input : IDisposable
Remarks

Use the input instance in cases where you actually need an object to pass around (although there is no such use case in FUSEE code at all). Use the static access in all other cases to reduce typing Input.Instance over and over again. Use

using static Fusee.Engine.Core.Input
to directly access Keyboard, Mouse, Touch, without even typing a namespace or class name.

Fields

SpaceMouseInput

The input of the space mouse.

Declaration
public readonly SixDOFDevice SpaceMouseInput
Field Value
Type Description
SixDOFDevice

Properties

Devices

Returns the input device values.

Declaration
public static IEnumerable<InputDevice> Devices { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<InputDevice>

Drivers

Retrieves the input driver implementations currently registered.

Declaration
public static IEnumerable<IInputDriverImp> Drivers { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<IInputDriverImp>

The input driver implementations.

Remarks

This is a static method. Use InputDrivers for an instance method to the same functionality.

InputDevices

Returns the values of an input device.

Declaration
public IEnumerable<InputDevice> InputDevices { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<InputDevice>

InputDrivers

Retrieves the input driver implementations currently registered.

Declaration
public IEnumerable<IInputDriverImp> InputDrivers { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<IInputDriverImp>

The input driver implementations.

Remarks

This is an instance method. Use Drivers for a static-over-singleton access to the same functionality.

Instance

Provides the singleton Instance of the Input Class.

Declaration
public static Input Instance { get; }
Property Value
Type Description
Input

Keyboard

Retrieves the first keyboard device (if present).

Declaration
public static KeyboardDevice Keyboard { get; }
Property Value
Type Description
KeyboardDevice

The keyboard (or null).

Remarks

This is a static property. Use KeyboardInput for an instance property to the same functionality.

KeyboardInput

Retrieves the first keyboard device (if present).

Declaration
public KeyboardDevice KeyboardInput { get; }
Property Value
Type Description
KeyboardDevice

The keyboard (or null).

Remarks

This is an instance property. Use Keyboard for a static-over-singleton access to the same functionality.

Mouse

Retrieves the first mouse device (if present).

Declaration
public static MouseDevice Mouse { get; }
Property Value
Type Description
MouseDevice

The mouse (or null).

Remarks

This is a static property. Use MouseInput for an instance property to the same functionality.

MouseInput

Retrieves the first mouse device (if present).

Declaration
public MouseDevice MouseInput { get; }
Property Value
Type Description
MouseDevice

The mouse (or null).

Remarks

This is an instance property. Use Mouse for a static-over-singleton access to the same functionality.

Touch

Retrieves the first touch device (if present).

Declaration
public static TouchDevice Touch { get; }
Property Value
Type Description
TouchDevice

The touch device (or null).

Remarks

This is a static property. Use TouchInput for an instance property to the same functionality.

TouchInput

Retrieves the first touch device (if present).

Declaration
public TouchDevice TouchInput { get; }
Property Value
Type Description
TouchDevice

The touch device (or null).

Remarks

This is an instance property. Use Touch for a static-over-singleton access to the same functionality.

Methods

AddDriverImp(IInputDriverImp)

Adds an input driver implementation to the internal list. The input driver is queried about connected devices. All new devices will then show up in the Devices (or InputDevices). list (in addition to the already listed devices.

Declaration
public static void AddDriverImp(IInputDriverImp inputDriver)
Parameters
Type Name Description
IInputDriverImp inputDriver

The new input driver to add.

Remarks

This is a static method. Use AddInputDriverImp(IInputDriverImp) for an instance property to the same functionality.

AddInputDriverImp(IInputDriverImp)

Adds an input driver implementation to the internal list. The input driver is queried about connected devices. All new devices will then show up in the Devices (or InputDevices). list (in addition to the already listed devices.

Declaration
public void AddInputDriverImp(IInputDriverImp inputDriver)
Parameters
Type Name Description
IInputDriverImp inputDriver

The new input driver to add.

Remarks

This is an instance method. Use AddDriverImp(IInputDriverImp) for a static-over-singleton access to the same functionality.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()

Dispose(Boolean)

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. If disposing equals false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.

Finalize()

Finalizers (historically referred to as destructors) are used to perform any necessary final clean-up when a class instance is being collected by the garbage collector.

Declaration
protected void Finalize()

GetDevice<TDevice>(Int32)

Gets the first input device of a certain type. Shortcut for

InputDevices.OfType<TDevice>().FirstOrDefault()
Declaration
public static TDevice GetDevice<TDevice>(int deviceid = 0)
    where TDevice : InputDevice
Parameters
Type Name Description
System.Int32 deviceid
Returns
Type Description
TDevice

The first device matching the given type, or null if no such device is currently present.

Type Parameters
Name Description
TDevice

The type of the device to find.

Remarks

This is a static method. Use GetInputDevice<TDevice>(Int32) for an instance method to the same functionality.

GetDevices<TDevice>()

Gets the input devices of a certain type. Shortcut for

InputDevices.OfType<TDevice>()
Declaration
public static IEnumerable<TDevice> GetDevices<TDevice>()
    where TDevice : InputDevice
Returns
Type Description
System.Collections.Generic.IEnumerable<TDevice>

The input devices of the specified type

Type Parameters
Name Description
TDevice

The type of the devices to find.

Remarks

This is a static method. Use GetInputDevices<TDevice>() for an instance method to the same functionality.

GetInputDevice<TDevice>(Int32)

Gets the first input device of a certain type. Shortcut for

InputDevices.OfType<TDevice>().FirstOrDefault()
Declaration
public TDevice GetInputDevice<TDevice>(int id = 0)
    where TDevice : InputDevice
Parameters
Type Name Description
System.Int32 id
Returns
Type Description
TDevice

The first device matching the given type, or null if no such device is currently present.

Type Parameters
Name Description
TDevice

The type of the device to find.

Remarks

This is an instance method. Use GetDevice<TDevice>(Int32) for a static-over-singleton access to the same functionality.

GetInputDevices<TDevice>()

Gets the input devices of a certain type. Shortcut for

InputDevices.OfType<TDevice>()
Declaration
public IEnumerable<TDevice> GetInputDevices<TDevice>()
    where TDevice : InputDevice
Returns
Type Description
System.Collections.Generic.IEnumerable<TDevice>

The input devices of the specified type

Type Parameters
Name Description
TDevice

The type of the devices to find.

Remarks

This is an instance method. Use GetDevices<TDevice>() for a static-over-singleton access to the same functionality.

PostUpdate()

Should be called from the main (update-) loop. Typically not to be called by user code unless users implement their own rendering/application loop.

Declaration
public void PostUpdate()

PreUpdate()

Should be called from the main (update-) loop. Typically not to be called by user code unless users implement their own rendering/application loop.

Declaration
public void PreUpdate()

RegisterInputDeviceType(MatchFunc, CreatorFunc)

Registers the type of input device available.

Declaration
public void RegisterInputDeviceType(MatchFunc match, CreatorFunc creator)
Parameters
Type Name Description
MatchFunc match
CreatorFunc creator

Events

DeviceConnected

Occurs when a device such as a gamepad is connected.

Declaration
public static event EventHandler<DeviceConnectionArgs> DeviceConnected
Event Type
Type Description
System.EventHandler<DeviceConnectionArgs>
Remarks

This is a static event. Use DeviceConnected for an instance property to the same functionality.

DeviceDisconnected

Occurs when a device such as a gamepad is disconnected.

Declaration
public static event EventHandler<DeviceConnectionArgs> DeviceDisconnected
Event Type
Type Description
System.EventHandler<DeviceConnectionArgs>
Remarks

This is a static event. Use DeviceConnected for an instance property to the same functionality.

InputDeviceConnected

Occurs when a device such as a gamepad is connected.

Declaration
public event EventHandler<DeviceConnectionArgs> InputDeviceConnected
Event Type
Type Description
System.EventHandler<DeviceConnectionArgs>
Remarks

This is an instance event. Use DeviceConnected for a static-over-singleton access to the same functionality.

InputDeviceDisconnected

Occurs when a device such as a gamepad is disconnected.

Declaration
public event EventHandler<DeviceConnectionArgs> InputDeviceDisconnected
Event Type
Type Description
System.EventHandler<DeviceConnectionArgs>
Remarks

This is an instance event. Use DeviceConnected for a static-over-singleton access to the same functionality.

Implements

System.IDisposable
Generated by DocFX
GitHub Repo
Back to top