Debug Mode in OSX?

Hi,

I just switched to Mac and i found that the JInput class is precompiled with “Debug on” (i assume) - when I use it, it keeps outputting debug messages like

Queue getNextEvent return value: 0
Queue getNextEvent return value: 0
Queue getNextEvent return value: 0
Queue getNextEvent return value: 0

Can anybody help me with that? Or does anybody have the same problem?

There have been previous discussions of this issue (see previous posts). I am currently not aware if there will be a resultion for this issue. Hopefully a future release of JInput will control the debug behavior with a runtime parameter.

It’s been 120 days, apparently, so I hope this was resolved.

It’s incredibly annoying to see literally hundreds of debug messages in a few short seconds, especially because I often rely heavily on the console in order to debug my own programs (of course). Seriously, this is really really turning me off to JInput and making it impossible to test out. I was attempting to experiment with keyboard access and trying to have the buttons I pressed printed into the console, but naturally this is impossible when it’s filled with garbage.

Is there a solution, or am I going to have to give up on JInput before I even got started (this really is a ridiculous deterrent to my programming)?

Try this build.

HTH

Endolf

P.S. I don’t have access to an OSX machine, so I don’t know what it will do, but it’s the latest code from CVS.

Yeah, that’s a lot lot newer than what I downloaded, cool. I’ll let you know how it works when I get back to the project.

Hey, do you know any quick tutorials that show me how to get a hold of the mouse axes, or an example? I can’t find a simple 10 line example anywhere, and I can’t figure out how to get what I need out of the mouse object.

Hi

This is off the top of my head. It almost certainly won’t compile, and probably won’t run even when you get past that, but it should be along the right lines :).


// Get the environment and all controllers.
Controller[] controllers = ControllerEnvironment.getDefaultEnvironment().getControllers();
// Loop through them all, there may be more than one mouse remember.
for(Controller tempController : controllers) {
    // If it's a mouse, we are interested
    if(tempController.getType()==Controller.Type.MOUSE) {
        // Get the X axis
        Component xAxis = tempController.getComponents(Component.Identifier.Axis.X);
        //Get the Y axis
        Component yAxis = tempController.getComponents(Component.Identifier.Axis.Y);
    }
}

You can then poll the device (50 times a second is good otherwise the OS buffers tend to fill up) and then grab the values of those axis.

The other way, is to get just the device like above, then call

getEventQueue()

on it, poll it every 50th of a second and then call

getNextEvent()

on the event queue. Each event will have the identifier of the axis it’s for and you can just check that for

Component.Identifier.Axis.X

and

Component.Identifier.Axis.Y

HTH

Endolf

Ah, cool, I see it exactly, then. Yeah, I had it figured out how to get input from the Mouse before you replied to this, but I could only see how to get different values by using the string “human” name. I see how the constants apply here.

I have another question after messing around with the mouse some. My Mouse apparently has 5 components, which I found were the x axis, y axis, left button, right button, and the click on the scroll wheel. I can get click inputs and mouse movements just fine, but I can’t figure out how to recieve inputs from the scroll wheel. When I move it around JInput doesn’t seem to know in any obvious way. Any ideas?

By the way, the massive debug outputs are gone, and I am also enjoying JInput’s simplicity after tooling around with it a bit and figuring out how it works.

I think I fixed the mouse scroll wheel issue, try the jinput.jar from here:

http://odense.kollegienet.dk/~naur/jinput.jar

  • elias