since i've never touched jinput yet and am not so aware about its developpement stage, i'm wondering about few things, and if they're doable right now.

A. Keyboard---------------Is it possible to get a sort of "isKeyPressed(int keyCode)" information directly?(I mean a direct access of course, not a layer which sets a true/false flag on key events.)

B. Mouse-----------Is it possible to "block" the cursor completely? or into a given area?Is it possible to get the dx/dy directly? (i mean, to get it even when the cursor is out of the window or even if the cursor doesn't move at all, when it's blocked or against the border)

If you could give me some sample code, it would even be more appreciated. Well, it's really needed since i've no clue on how it works at all.

soon as the mouse bug with directx is sorted out, all of those things will be possible, except mouse blocking (i think)

if you're doing a full-screen app and want to use jinput for mouse input you will have to draw the cursor and track its position yourself, which leaves the blocking up to you. as for windowed apps im not sure, but just yet, i dont think there's a way to lock the mouse so the OS doesnt let you click outside of the window.

AWT lets you get the exact location of the pointer, but leaves problems for eg. FPS games, but for an RTS or mouse based games, if you're already using AWT, it may be more predictable for your users. (mouse will move at same speed in game as it does in OS for instance)

Now you have to find the controller you want: You can do this by checking Controller.getType():

myController = retrieveMyController(controllers);

Each controller contains an array of axes (may be empty!) and/or subcontrollers (may be empty as well!).

Typically a gamepad with 4 buttons contains 6 axes:- 2 for the directions- 4 for the buttons

Access to all axes is made through Controller.getAxes(). You can determine the type of an axis with Axis.getType().

To read current data from the controller you have to poll it with: Controller.poll()After that you can retrieve the value of each axis using Axis.getPollData()

When the axis is normalized (keyboard, buttons, etc) you get values in the range [-1,1]. Negative values only make sense for directions on a gamepad/joystick. 0.0 generally means unpressed and 1.0 pressed. Values in between can be generated form analog devices (e.g: joystick).

Analog devices usually never have a relased/unpressed state in which they report 0.0. They differ from that in positive AND negative direction by an amount that can be retrieved with Axes.getDeadZone().

Note: Currently the mouse device is implemented differently on the major plattforms Lin/Mac and Win. On Windows the mouse generates normalized delta values when the Linux/MacOS X version is not nomalized.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org