Search code examples
c#monoopentk

Is there an updated version of OpenTK documentation?


I'm developing a multiplataform application using C# and mono. For OpenGL bindings I'm using OpenTK. I was looking at their "getting started" tutorial on Input: http://www.opentk.com/doc/input, and found this:

Use Mouse.GetState() to retrieve the aggregate state of all connected mice. Use Mouse.GetState(int) to retrieve the state of the specified mouse. To check whether a button is pressed:

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

I used that code snippet and got a compile time error, saying that Mouse doesn't contain a method definition for GetState(). And I downloaded the most recent version of OpenTK So, are there any updated resources to get started with OpenTK?


Solution

  • Mouse.GetState doesn't have an overload with 0 parameters, you have to pass in an int (0 should get you the first mouse connected to the computer). This is true only for the last stable release, if you download the latest SVN nightly build, it contains both methods.

    And just as a tip, the aggregated state of all mice will say that the left mouse button is clicked if any of the connected mice have the left mouse button clicked, and the mouse coordinates will be different from screen coordinates if you have more than one mouse connected.