the Fiddler's picture

[NativeWindow] Add ability to hide/show/modify the mouse cursor

Project:The Open Toolkit library
Category:feature request
Assigned:the Fiddler

Currently, the only way to do this is to set System.Windows.Forms.Cursor.Current to an empty cursor (Cursor.Hide() is not supported on Mono).

OpenTK applications should not need to rely on WinForms for this functionality.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
swiftcoder's picture



These methods don't hide the cursor globally - once the cursor leaves the window, it becomes visible again.

I think this is generally desirable - one often wants to hide the cursor during a splash screen, but would like the user to be able to mouse out of the program if they want to do somethign else while they wait.

A separate CaptureCursor flag would be nice to disassociate cursor movement, to prevent the user from unintentionally mousing outside while actually playing a game.

migueltk's picture


For the first-person control is desirable to position the cursor (mouse pointer) in the center of the window, then it is necessary to indicate the position as "System.Windows.Forms.Cursor.Position."

Regards, ...

jdomnitz's picture


RawInput IIRC can be used to alter the value before the WM_Mouse is generated, which allows you to change the value an application receives. Basically you keep changing relative position change to 0 so the OS and Cursor think the mouse isn't moving while you process the data. Clipping the rectangle to the renderingwindow is fine too though.

the Fiddler's picture


mayhem's picture


If this is completed am I correct in assuming that OpenTK is the only Open Source, C#, Cross Platform, OpenGL framework that allows capture of the mouse? And that this would be the only way to write an FPS engine?

the Fiddler's picture


Pretty much, yes.

It is possible to hack relative mouse motions through WinForms but this is not as nice as real support.

the Fiddler's picture


Version:1.1-dev» 1.1.0-stable
Status:in progress» closed

This is part of opentk-1.1.0.