Jinput

Ive downloaded Jinput, and its a couple of .jar files and some dll’s.

What do I do with it? (i’m using Eclipse) And what is a .jar file?

Silly me, a jar file is a java source file, but for some reason I clicked on the jitest.jar but it didnt even load up!
Ill work it out, but if someone could tell me how to even view a jar file in eclipse it would help (i know it sounds stupid)

A brief Googling would probably find your answers.

A JAR file is not a Java source file. It is a special zip file that contains compiled Java class files. Add it to the build path of your Eclipse project.

You sound like you are new to java to me. Anyways what is it that you need to use this “JInput” for (I have never heard of it) and I might be able to help you out.

To use the contents of the JInput.jar file for Eclipse users do the following.

  1. Make an folder to put the JInput.jar in maybe call it “External Jars” here you can store any jars that you download and can easily find them in the same place for future use.

  2. In Eclipse, locate the project folder and click the drop down arrow of the project in which you are going to be using this jars resources.

  3. Right Click JRE System Library> Build Path> Configure Build Path

  4. Click Add External Jars

  5. Locate the folder you have your JInput.jar in and select the jar and click open.

  6. Click OK on the Java Build Path window.

Now that you have your jar in your build path the next step is to import it at the top of any class file that will be using the methods from within the jar.

And thats it, hope it helped :smiley:

That will get you compiling, to run it you need to make sure the natives for your platform are in the java.library.path. In eclipse, you can right click on the jar file and somewhere in the following menus select the location of the native library.

HTH

Endolf

JInput is an API that allows access to input devices from Java, it uses the platform APIs to get the data. It currently has bindings for windows, linux and osx.

We have our own forums right here on jgo :).

Endolf

From a hint in another thread, I believe rouncer wants to capture mouse input outside his game window. Microsoft recommends using the window proc to handle keyboard and mouse input because it has the least overhead, rather then doing keyboard and mouse input through DirectInput. JInput is plugin based, but on Windows typically uses DirectInput. I assume JInput keyboard/mouse access is done through DirectInput (since it doesn’t know anything about the game window) and may not be ideal if what you want is basic keyboard/mouse access for your game. JInput is still useful for all other peripherals though, such as joysticks, gamepads, rudders, wheels, etc.

FWIW, LWJGL makes use of JInput, but handles the mouse and keyboard through the window proc. LWJGL doesn’t track the mouse outside the game window, and I’m sure there is a compelling reason this is so. Maybe an LWJGL guy can weigh in on why this is? I’d guess Windows doesn’t give the game window mouse movement messages, so the only other solution would be a system level hook. This is resource intensive and I can see LWJGL not wanting to do this.

Using either JInput or a system hook is less than ideal. Either may prove to be an acceptable workaround to handling out of window mouse events. If so, JInput is certainly an easier solution since you don’t have to write native code. I just wanted to point out why you are having this problem in the first place.

The default plugin for windows xp/vista/7 uses direct input for gamepads/joysticks only, it uses the raw input for mice and keyboards so it might not be ‘less than ideal’, that said, LWJGL does indeed do it itself to avoid some of the nasty we have to deal with to provide a platform agnostic interface and indeed a windowless one.

Endolf

Endolf is what im after, but before I even get to using it I have to link to it properly and I got to do what shane said to do, thanks shane.

Your welcome :slight_smile:

Ive gotten through what Shane told me to do, Ive got the jar files as referenced libraries, but now im stuck again.
Could anyone supply a java source file of jinput in action? I find I work best off code, im just not sure how to start or even how to type in how to import it properly at the top.

Have you read the JInput Getting started thread?, it contains code.

HTH

Endolf