Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (753)
Games in Android Showcase (228)
games submitted by our members
Games in WIP (842)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / JInput / Re: JInput Controller connect disconnect problem SOVLED!!! on: 2011-03-15 18:00:14
by doing it this way your are recalling the native calls, that build the list of devices in java. there was no other way to update the list than to call the native code again, but there was no given method to do that.
2  Java Game APIs & Engines / JInput / Re: Disconect and connect again one joystick on: 2011-03-15 16:45:34

see my post one level up. I just figured it out this morning.
3  Java Game APIs & Engines / JInput / JInput Controller connect disconnect problem SOVLED!!! on: 2011-03-15 16:28:02
Greetings fellow developers. I have been searching this topic only to find that one has succeeded and failed to provide their results because they like proprietary bullshit.

I have been looking to make a push to talk handset for a project I am doing with the United States Air Force. I found it necessary that I must be able to find a device that I plug/unplug during the program running.
I come to find that the immediate issue was that "ControllerEnvironment.getDefaultEnvironment().getControllers()" never changed the list of Controllers while the program is running. So why is that?

Well lets start with the the call "ControllerEnvironment.getDefaultEnvironment().getControllers()". This class does not have a protected Constructor. so in order to have access to the constructor you have to be part of the package it is contained in. This is not practical. So I made this public, but only to find that I still could not call construction on it. so I undid that.

The next thing I notice is the getDefaultEnvironment(). Ths actually uses a constructor. Once again, this is protected. So I made it public.

Next, for testing purpose I programmed a button like so in my GUI;

        ce = new DefaultControllerEnviornment();
        Controller[] controller = ce.getControllers();
        for(int i = 0; i < controller.length; i++)

every time i press this button, it reconstructs the list of controllers and prints them out.

so i removed and added devices while pressing this button. Viola!! it worked, the list was updating the devices.

so for the next part you basically want to created a TimerTask that runs this code every so often to update the list. How often is up to the use of your software and how important an updated list of controllers is.

I have yet to test how this effects the rest of my code polling the controllers, but this is a start, and it is far easier than try to understand and edit the native code.

I hope this helps all of you out, i have spent a couple weeks researching this, and I solved it in a matter of half an hour just mucking through the code.
Pages: [1]
ivj94 (586 views)
2018-03-24 14:47:39

ivj94 (49 views)
2018-03-24 14:46:31

ivj94 (383 views)
2018-03-24 14:43:53

Solater (63 views)
2018-03-17 05:04:08

nelsongames (110 views)
2018-03-05 17:56:34

Gornova (159 views)
2018-03-02 22:15:33

buddyBro (704 views)
2018-02-28 16:59:18

buddyBro (93 views)
2018-02-28 16:45:17

xxMrPHDxx (494 views)
2017-12-31 17:17:51

xxMrPHDxx (734 views)
2017-12-31 17:15:51
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!