1
\$\begingroup\$

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.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ 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. \$\endgroup\$ Commented Nov 23, 2012 at 4:21

1 Answer 1

2
\$\begingroup\$

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
}
\$\endgroup\$
2
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ Commented Sep 20, 2013 at 22:14
  • \$\begingroup\$ 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 \$\endgroup\$ Commented Oct 20, 2013 at 23:06

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.