GameControlPlus responding to mouse not joystick!

edited July 2015 in Library Questions

I'm working with all (AFAIK) latest versions of Processing and (the awesome!) GameControlPlus library set on Windows 7. Using a Logitech Extreme 3D joystick. I can run all the examples in the GCP libraries with the joystick with no prob.

I've compared my problem-sketch code to other working examples and as far a I can see, the GCP stuff has been brought in correctly.

In my sketch, when I call getUserInput() and print the returned joystick values, they remain a a constant value, but when I move the mouse, the numbers follow the mouse.

This post is just to see if there are any known issues where mis-coding or things that will cause the joystick to be confused with the mouse. I have a second Win7 PC and the problem-sketch behaves the same.

I'm also hoping to avoid posting the code as it is in 4 files and a bit messy at this point! Perhaps somebody has seen this behavior and could comment...

Answers

  • In your sketch have you

    a) created a device configuration file for the joystick

    b) use getMatchedDevice to select the joystick

    BTW which class does the getUserInput come from, just looked at the reference for GCP and can't find it.

  • Greets! I started working with your examples, and when I got them to work, CAREFULLY recreated them in my sketch.

    I feel the config file in DATA is correct - have used it other sketches.

    In this sketch I have several Classes but just made a folder called "Functions" and placed the code for getUserInput there by itself... Just getting started with Processing Classes (have done them with Arduino C). Would like to turn your joystick control into a class but think that may be unnecessary...

    The 'main' sketch has the library imports, and the calls/setup for ControllIO and ControlDevice.

    From the GameControlPlus library I worked with the Gcp_Joystick sketch in the examples folder and extracted code from that. In all cases except this one I've had good success...

    I'd be glad to up the whole sketch but it is has 4 tabs (files) and would be tricky to just paste inline...

  • So you have explained the getUserInput but you have not answered my 2 questions a & b

    Post just the code used to initialise the Joystick device so I can see what you are doing.

  • Apologies for the confusion! YES to A & B! I have used the config package you supplied several times am comfortable with it's setup.

    Here follows the essential joystick code: PS: This forum-package has the worst text formatting I've ever seen! Had to resort to a screen-shot to get this in!

    code

  • GoTo - I actually did attempt to learn how to use markdown, and found it to be such a PITA - for one simple post! I've been on a lotta forums, and there ARE much better packages out there! But - it is what it is... and pasting in the image did the job.

  • The getMatchedDevice method looks for an attached device that mstches the config file. In your case the problem appears to be that it is matching the mouse probably because you are only using the x and y axis. Copy the config file here so I can see it.

    If you use the device lister you might find the config akso matches the mouse, include one of the uniquely named joystick buttons in the configuration file so it ignores the mouse when looking for a match.

  • I did try using this file on other sketches, and it did work. I'll also insert a shot of the configurator listing:

    Ok - here is the content of the config file:

    For CIC Project JOYX X-Axis 3 SLIDER X-axis 0 1.0 0.0 JOYY Y-Axix 3 SLIDER Y-axis 0 1.0 0.0 But0 GP Button Zero 1 BUTTON Button 0 0 0.0 0.0 But1 GP Button One 1 BUTTON Button 1 0 0.0 0.0

    config

  • If the file works on other sketches then there doesn't appear the problem with GCP try removing the mouse before running the sketch and see if it works.

  • In the config file you have Y-axix is that correct

  • Quark - I have discovered the joystick config file had some sort of error... I did make it with your utility - but when I replaced mine with one supplied by your library (just changed names in my sketch) all worked fine. I'd like to send you the two scripts so perhaps you can see what may have gone wrong (by me or the software). Have a couple other comments on the GameControl library - should I send them to your general email address?

  • Answer ✓

    Send the config files (as attachments) to my email address, the one made by the utility and the one that worked.

Sign In or Register to comment.