Interface IMouseComponent
Interace for getting mouse input and setting mouse position.
Inherited Members
Namespace: OpenTK.Platform
Assembly: OpenTK.Platform.dll
Syntax
public interface IMouseComponent : IPalComponent
Properties
CanSetMousePosition
If it's possible to set the position of the mouse using SetGlobalPosition(Vector2).
Declaration
bool CanSetMousePosition { get; }
Property Value
Type | Description |
---|---|
bool |
See Also
SupportsRawMouseMotion
If raw mouse motion is supported on this platform. If this is falseIsRawMouseMotionEnabled(WindowHandle) and EnableRawMouseMotion(WindowHandle, bool) should not be used.
Declaration
bool SupportsRawMouseMotion { get; }
Property Value
Type | Description |
---|---|
bool |
See Also
Methods
EnableRawMouseMotion(WindowHandle, bool)
Enables or disables raw mouse motion for a specific window. When raw mouse motion is enabled the window will receive RawMouseMoveEventArgs events, in addition to the normal MouseMoveEventArgs events. Check that SupportsRawMouseMotion is true before using this.
Declaration
void EnableRawMouseMotion(WindowHandle window, bool enable)
Parameters
Type | Name | Description |
---|---|---|
WindowHandle | window | The window to enable or disable raw mouse motion for. |
bool | enable | Whether to enable or disable raw mouse motion. |
See Also
GetGlobalMouseState(out MouseState)
Fills the state
struct with the current mouse state.
This function may query the mouse state outside of event processing to get the position of the mouse at the time this function is called.
The Position will be the screen mouse position and not virtual coordinates described by Locked.
The Position is in window screen coordinates.
Declaration
void GetGlobalMouseState(out MouseState state)
Parameters
Type | Name | Description |
---|---|---|
MouseState | state | The current mouse state. |
See Also
GetGlobalPosition(out Vector2)
Get the global mouse cursor position. This function may query the mouse position outside of event processing to get the position of the mouse at the time this function is called. The mouse position returned is the mouse position as it is on screen, it will not return virtual coordinates when using Locked.
Declaration
void GetGlobalPosition(out Vector2 globalPosition)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | globalPosition | Coordinate of the mouse in screen coordinates. |
See Also
GetMouseState(WindowHandle, out MouseState)
Fills the state
struct with the current mouse state for the specified window.
This function takes into consideration only the mouse events that the specified window has received and does not represent global state.
If the window has locked the cursor using Locked, this function will return virtual coordinates (unlike GetGlobalMouseState(out MouseState)).
The Position is in window relative coordinates.
Declaration
void GetMouseState(WindowHandle window, out MouseState state)
Parameters
Type | Name | Description |
---|---|---|
WindowHandle | window | The window to get the mouse state from. |
MouseState | state | The current mouse state. |
See Also
GetPosition(WindowHandle, out Vector2)
Gets the mouse position as seen from the specified window. This function takes into consideration only the mouse events that the specified window has received and does not represent global state. If the window has locked the cursor using Locked, this function will return virtual coordinates (unlike GetGlobalPosition(out Vector2i)).
Declaration
void GetPosition(WindowHandle window, out Vector2 position)
Parameters
Type | Name | Description |
---|---|---|
WindowHandle | window | The window to get the mouse position for. |
Vector2 | position | Coordinate of the mouse in client coordinates. |
See Also
IsRawMouseMotionEnabled(WindowHandle)
Returns whether raw mouse motion is enabled for the given window or not. Check that SupportsRawMouseMotion is true before using this.
Declaration
bool IsRawMouseMotionEnabled(WindowHandle window)
Parameters
Type | Name | Description |
---|---|---|
WindowHandle | window | The window to query. |
Returns
Type | Description |
---|---|
bool | If raw mouse motion is enabled. |
See Also
SetGlobalPosition(Vector2)
Set the global mouse cursor position. Check that CanSetMousePosition is true before using this.
Declaration
void SetGlobalPosition(Vector2 newGlobalPosition)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | newGlobalPosition | New coordinate of the mouse in screen space. |