Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

How to use Input in OpenTK 1.0? There is not much info around, some classes are unfinished.

What I want to achieve, is to be able to use input not only in OnUpdate function, but also in other classes created by myself.

share|improve this question
1  
This might not answer your specific question but take a look at MonoGame monogame.codeplex.com an open source project that uses OpenTK under the hood. You can probably look at the source code as a reference. –  craftworkgames Nov 23 '12 at 4:21
add comment

1 Answer

Check out OpenTK.Input.

From there you can get access to OpenTK.Input.Mouse and

Some examples from the page include:

To check whether a button is pressed:

using OpenTK.Input;

var mouse = Mouse.GetState();
if (mouse[MouseButton.Left])
{
    // Left mouse button is pressed
}

To check whether a mouse button is not pressed:

using OpenTK.Input;`

var mouse = Mouse.GetState();
if (!mouse[MouseButton.Left])
{
    // Left mouse button is not pressed
}
share|improve this answer
1  
Note that the above is for 1.1, which is available through the SVN repository. As far as I know, OpenTK 1.0 doesn't have support for this. –  Byte56 Sep 20 '13 at 22:14
    
As a side note, mouse does not work with 1.1 build on windows 7/8. There is patched version on github, which is currently the main repo for OpenTK: github.com/thefiddler/opentk More info about the issue: opentk.com/node/3198 –  Lasse Oct 20 '13 at 23:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.