Struct ViewerInput
- Namespace
- Gym.Environments
- Assembly
- Gym.dll
One input a window reported, in the window's own order. Keys are SDL keycodes (pygame's event.key): a
printable key is its unshifted character ('a' is 97), any other is its scancode with bit 30 set
(K_LEFT is 1073741904); Gym.Rendering.KeyCode names them. The mouse is reported as GLFW reports it
to MuJoCo's viewer (DR-70): the pointer in the client area's units from its top-left corner, buttons numbered as
GLFW's (LeftButton, RightButton, MiddleButton), the wheel in notches with
a positive ScrollY away from the user.
public readonly record struct ViewerInput : IEquatable<ViewerInput>
- Implements
- Inherited Members
- Extension Methods
Constructors
ViewerInput(ViewerInputKind, int, int, int, double, double, int, double, double)
One input a window reported, in the window's own order. Keys are SDL keycodes (pygame's event.key): a
printable key is its unshifted character ('a' is 97), any other is its scancode with bit 30 set
(K_LEFT is 1073741904); Gym.Rendering.KeyCode names them. The mouse is reported as GLFW reports it
to MuJoCo's viewer (DR-70): the pointer in the client area's units from its top-left corner, buttons numbered as
GLFW's (LeftButton, RightButton, MiddleButton), the wheel in notches with
a positive ScrollY away from the user.
public ViewerInput(ViewerInputKind Kind, int Key = 0, int Width = 0, int Height = 0, double X = 0, double Y = 0, int Button = 0, double ScrollX = 0, double ScrollY = 0)
Parameters
KindViewerInputKindWhat happened.
KeyintWidthintThe new client width for Resized, else 0.
HeightintThe new client height for Resized, else 0.
XdoubleThe pointer's x for the mouse kinds, from the client area's left edge, else 0.
YdoubleThe pointer's y for the mouse kinds, from the client area's top edge, else 0.
ButtonintScrollXdoubleThe horizontal turn for Scroll, in notches, else 0.
ScrollYdoubleThe vertical turn for Scroll, in notches (positive away from the user), else 0.
Fields
LeftButton
The left mouse button (GLFW's MOUSE_BUTTON_LEFT).
public const int LeftButton = 0
Field Value
MiddleButton
The middle mouse button (GLFW's MOUSE_BUTTON_MIDDLE).
public const int MiddleButton = 2
Field Value
RightButton
The right mouse button (GLFW's MOUSE_BUTTON_RIGHT).
public const int RightButton = 1
Field Value
Properties
Button
public int Button { get; init; }
Property Value
Height
The new client height for Resized, else 0.
public int Height { get; init; }
Property Value
Key
public int Key { get; init; }
Property Value
Kind
What happened.
public ViewerInputKind Kind { get; init; }
Property Value
ScrollX
The horizontal turn for Scroll, in notches, else 0.
public double ScrollX { get; init; }
Property Value
ScrollY
The vertical turn for Scroll, in notches (positive away from the user), else 0.
public double ScrollY { get; init; }
Property Value
Width
The new client width for Resized, else 0.
public int Width { get; init; }
Property Value
X
The pointer's x for the mouse kinds, from the client area's left edge, else 0.
public double X { get; init; }
Property Value
Y
The pointer's y for the mouse kinds, from the client area's top edge, else 0.
public double Y { get; init; }
Property Value
Methods
Close()
A press of the window's close button.
public static ViewerInput Close()
Returns
- ViewerInput
The input.
KeyDown(int)
A key press.
public static ViewerInput KeyDown(int key)
Parameters
keyintThe SDL keycode.
Returns
- ViewerInput
The input.
KeyUp(int)
A key release.
public static ViewerInput KeyUp(int key)
Parameters
keyintThe SDL keycode.
Returns
- ViewerInput
The input.
MouseDown(int, double, double)
A mouse button press.
public static ViewerInput MouseDown(int button, double x, double y)
Parameters
Returns
- ViewerInput
The input.
MouseMove(double, double)
A pointer move.
public static ViewerInput MouseMove(double x, double y)
Parameters
Returns
- ViewerInput
The input.
MouseUp(int, double, double)
A mouse button release.
public static ViewerInput MouseUp(int button, double x, double y)
Parameters
Returns
- ViewerInput
The input.
Resized(int, int)
A new client size.
public static ViewerInput Resized(int width, int height)
Parameters
Returns
- ViewerInput
The input.
Scroll(double, double, double, double)
A turn of the wheel.
public static ViewerInput Scroll(double scrollX, double scrollY, double x, double y)
Parameters
scrollXdoubleThe horizontal turn in notches.
scrollYdoubleThe vertical turn in notches, positive away from the user.
xdoubleThe pointer's x.
ydoubleThe pointer's y.
Returns
- ViewerInput
The input.