Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  more than one Mouse  (Read 6293 times)
0 Members and 1 Guest are viewing this topic.
Offline hanswurst

Junior Newbie





« Posted 2010-03-19 11:49:48 »

Hello Everybody,
I try to get the input from two usb-mice to move in a 3D-World(LWJGL). So far no problem, but is there a way to identify the Mice? Everytime the Program starts, the Mice change there Position.
1  
2  
3  
4  
5  
6  
7  
8  
9  
for(int i=0;i<controllers.length;i++) {
   if(controllers[i].getType()==Controller.Type.MOUSE) {
      if(firstMouse==null){
         firstMouse = controllers[i];
      }
      else if(secondMouse==null)secondMouse = controllers[i];
      else thirdMouse= controllers[i];
   }
}

I tryed to get the portnumber, but they are alle the same for every mouse.
I´m working on Windows 7 and XP. 
My second Problem is that the Windows cursor is moved by all mice. Is there a way to stop that? The Windows cursor should only listen to the first mouse.

thanks for help
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #1 - Posted 2010-03-19 18:38:07 »

Hi

Are the mice the same make and model?, if not, you can get the name of the device.

JInput has no control over what moves the windows cursor, that is a windows issue.

Endolf

Offline hanswurst

Junior Newbie





« Reply #2 - Posted 2010-03-19 19:09:11 »

Yes it is the same model.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #3 - Posted 2010-03-19 20:18:51 »

The devices are enumerated in the order that directx calls the callback. It's possible that a directx app would have the same issue. I will do some digging at the weekend and see what I can find.

Endolf

Offline hanswurst

Junior Newbie





« Reply #4 - Posted 2010-03-20 00:46:22 »

very cool.
Thanks
Offline deepthought
« Reply #5 - Posted 2010-06-15 20:59:11 »

when your program starts up, have a window showing how each mouse is moving and have the user choose which mouse to choose for what.

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Offline shadow123

Junior Newbie





« Reply #6 - Posted 2010-11-17 22:53:20 »

I have exactly the same problem on a redhat platform. two devices same make and model (2 usb track balls).

I can not tell them apart at the JInput level as they both have the same Controller name, and each time you boot the machine its 50:50 the order Jinput returns them in the array of controllers.

using rules to force the device names in /dev/input I can force the names to be in the same order (based on the ID of the device) however Jinput doesnt seem to base the return of the controllers on the device name.

anybody know what it bases the order on, and can I get it consistant?

Offline shadow123

Junior Newbie





« Reply #7 - Posted 2010-11-18 00:02:00 »

given that listFiles doesnt guarantee order, I assume this is due to LinuxEnvironmentPlugin listFilePrivileged doing


dir.listFiles(filter);


I dont surpose somebody who knows what they are doing could update the code to apply an alpha sort on it

File[] files = dir.listFiles(filter);
Arrays.sort(files, new Comparator<File>(){
    public int compare(File f1, File f2)
    {
        return f1.getName().compareTo(f2.getName());
    } });
return files;

Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #8 - Posted 2010-11-18 17:56:45 »

Hi

Looks good, I hope to add this over the weekend (I'm out thursday and fridays).

Thanks for the update Smiley

Endolf

Offline shadow123

Junior Newbie





« Reply #9 - Posted 2010-11-19 00:14:27 »

Thanks,

I rebuilt jinput with the change and tested it and it works fine.
when I posted the original code I forgot jinput is built for 1.4, so no templates and no annotations, so for completness the code change is.

      File[] files = dir.listFiles(filter);
      Arrays.sort(files, new Comparator(){
          public int compare(Object f1, Object f2)
          {
              return ((File)f1).getName().compareTo(((File)f2).getName());
          } });


and if anybody needs to fix the order of devices on a linux platform ie. writting rules this was a usefull link http://reactivated.net/writing_udev_rules.html
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline shadow123

Junior Newbie





« Reply #10 - Posted 2011-02-17 23:55:02 »

Hi

Looks good, I hope to add this over the weekend (I'm out thursday and fridays).

Thanks for the update Smiley

Endolf

Hi I dont suppose you know if this fix has been released? any chance of a url to a release with this version in it. getting hold of JInput releases isnt very obvious Sad

Cheers

shadow123
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #11 - Posted 2011-02-20 14:39:01 »

Hi

Sorry, I did forget to commit this. I have now made the change (but not tested it), the project pages for jinput are here, in the downloads section. Also, I've updated the webstart demo and the maven repository.

Endolf

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

BurntPizza (20 views)
2014-09-21 02:42:18

BurntPizza (14 views)
2014-09-21 01:30:30

moogie (14 views)
2014-09-21 00:26:15

UprightPath (25 views)
2014-09-20 20:14:06

BurntPizza (27 views)
2014-09-19 03:14:18

Dwinin (42 views)
2014-09-12 09:08:26

Norakomi (73 views)
2014-09-10 13:57:51

TehJavaDev (97 views)
2014-09-10 06:39:09

Tekkerue (49 views)
2014-09-09 02:24:56

mitcheeb (70 views)
2014-09-08 06:06:29
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!