Table of Contents

Class FrameInput

Namespace
TileWorld.Engine.Input
Assembly
TileWorld.Engine.dll

Represents the host input snapshot for a single frame.

public sealed class FrameInput
Inheritance
FrameInput
Inherited Members

Constructors

FrameInput(Int2, bool, MouseButtonSnapshot, MouseButtonSnapshot, MouseButtonSnapshot, int, IEnumerable<InputKey>, IEnumerable<InputKey>, IEnumerable<InputKey>)

Creates a frame input snapshot.

public FrameInput(Int2 mouseScreenPositionPixels, bool isMouseInsideViewport, MouseButtonSnapshot leftButton, MouseButtonSnapshot middleButton, MouseButtonSnapshot rightButton, int mouseWheelDelta, IEnumerable<InputKey> keysDown = null, IEnumerable<InputKey> keysWentDown = null, IEnumerable<InputKey> keysWentUp = null)

Parameters

mouseScreenPositionPixels Int2

The mouse position in screen pixels.

isMouseInsideViewport bool

Whether the mouse is currently inside the viewport.

leftButton MouseButtonSnapshot

The left mouse button state.

middleButton MouseButtonSnapshot

The middle mouse button state.

rightButton MouseButtonSnapshot

The right mouse button state.

mouseWheelDelta int

The wheel delta since the previous frame.

keysDown IEnumerable<InputKey>

The keys that are currently down.

keysWentDown IEnumerable<InputKey>

The keys that transitioned to down this frame.

keysWentUp IEnumerable<InputKey>

The keys that transitioned to up this frame.

Properties

Empty

Gets a reusable empty input snapshot.

public static FrameInput Empty { get; }

Property Value

FrameInput

IsMouseInsideViewport

Gets a value indicating whether the mouse is currently inside the viewport.

public bool IsMouseInsideViewport { get; }

Property Value

bool

LeftButton

Gets the left mouse-button state snapshot.

public MouseButtonSnapshot LeftButton { get; }

Property Value

MouseButtonSnapshot

MiddleButton

Gets the middle mouse-button state snapshot.

public MouseButtonSnapshot MiddleButton { get; }

Property Value

MouseButtonSnapshot

MouseScreenPositionPixels

Gets the mouse position in screen pixels.

public Int2 MouseScreenPositionPixels { get; }

Property Value

Int2

MouseWheelDelta

Gets the mouse wheel delta since the previous frame.

public int MouseWheelDelta { get; }

Property Value

int

RightButton

Gets the right mouse-button state snapshot.

public MouseButtonSnapshot RightButton { get; }

Property Value

MouseButtonSnapshot

Methods

IsKeyDown(InputKey)

Returns whether a key is currently pressed.

public bool IsKeyDown(InputKey key)

Parameters

key InputKey

The key to test.

Returns

bool

true when the key is currently pressed.

KeyWentDown(InputKey)

Returns whether a key transitioned to down on the current frame.

public bool KeyWentDown(InputKey key)

Parameters

key InputKey

The key to test.

Returns

bool

true when the key transitioned to down on the current frame.

KeyWentUp(InputKey)

Returns whether a key transitioned to up on the current frame.

public bool KeyWentUp(InputKey key)

Parameters

key InputKey

The key to test.

Returns

bool

true when the key transitioned to up on the current frame.