Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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  
  reasonable to expect that the user will not plug in new controllers in game?  (Read 3331 times)
0 Members and 1 Guest are viewing this topic.
Offline fishtoprecords

Senior Newbie

« Posted 2011-02-04 21:27:29 »

The usual samples show a code fragment like this:
    Controller[] controllers = driver.getKnownControllers();
    while(true) {
        for (Controller ctl : controllers) {
            EventQueue queue = ctl.getEventQueue();
           // do stuff

Which works great in my testing.
But by placing the getKnownControllers() outside of the infinite loop, you will not detect any changes. The user could plug in a new controller, or even swap one for another, and the sample code will not detect it.

Is this a reasonable restriction? Is it acceptable to use this design? or should the main loop also check occasionally for new controllers?
Offline Riven

« JGO Overlord »

Medals: 1340
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #1 - Posted 2011-02-04 22:26:50 »

If you want to make the extra effort for your players, please do!

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline Nate

« JGO Bitwise Duke »

Medals: 167
Projects: 4
Exp: 14 years

Esoteric Software

« Reply #2 - Posted 2011-02-05 01:41:00 »

It has been a while, but I don't think JInput will detect controllers that have been plugged in since the app was started.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder

Medals: 7
Exp: 15 years

Current project release date: sometime in 3003

« Reply #3 - Posted 2011-02-05 11:39:32 »

Currently it's not a supported feature, people state that it's important to them, but as with a lot of open source projects, none of them consider it important enough to spend the time to implement it.

It's not important enough to me for me to do it right now either.

One person has done it in the past, but it was an internal development for a company that was not willing to release it back to the community.


Offline fishtoprecords

Senior Newbie

« Reply #4 - Posted 2011-02-05 15:05:32 »

I have a hard time seeing that its a real-world need. I expect most folks plug in their controllers and then start the game.
Pages: [1]
  ignore  |  Print  

EgonOlsen (42 views)
2018-06-10 19:43:48

EgonOlsen (22 views)
2018-06-10 19:43:44

EgonOlsen (43 views)
2018-06-10 19:43:20

DesertCoockie (197 views)
2018-05-13 18:23:11

nelsongames (124 views)
2018-04-24 18:15:36

nelsongames (123 views)
2018-04-24 18:14:32

ivj94 (863 views)
2018-03-24 14:47:39

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

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

Solater (140 views)
2018-03-17 05:04:08
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!