Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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  
  Keyboards, Mice, and Focus  (Read 2646 times)
0 Members and 1 Guest are viewing this topic.
Offline Swot

Junior Newbie





« Posted 2011-05-01 04:57:12 »

Hello.
I am new to Jinput and have just recently set up Jinput, class paths, and what not and I have a question.
I worked through the "Getting Started with JInput" topic and everything was working fine until I got to the section on reading in input from the controllers. I went ahead and typed out the code for polling the controllers, establishing an eventqueue, and reading events and the code did not seam to do anything. I would run it, and nothing. I set up a few debug statements listing the controller's names etc, a System.out.println if an event was triggered (to see if the StringBuffer was somehow empty), I messed around with administrator settings, and nothing seamed to work. I was about to give up, when I plugged in my old Axis Pad, and voila it was being detected!

I've searched these forums for an explanation and came about this thread: http://www.java-gaming.org/topics/getting-mouse-keyboard-events-and-position/20169/view.html
I am writing these programs using the Netbeans 7.0 IDE, and it could be possible when the program executes there is no active window for the raw data to fetch keyboard and mouse events from (I should have mentioned above that the test program ran correctly).
As the above thread was from two years ago, I was wondering if any fix had been discovered in the meantime.

You see, my final project (and initial reason for installing JInput) requires detecting input from multiple mice and keyboards while out of focus. Why this is is that I bought Portal 2 recently, and was very disappointed that it did not have an "offline" multiplayer (playing split screen on one computer with a friend). Looking around the internet I found a workaround on the Steam forums, how one can launch the multiplayer maps directly from the console, and bind a joystick's keys to player two (after said joystick was emulated as a 360 controller).
I have also found and set up a way to play the game on two different monitors.

While this is all great, my controller is pretty old (3 of the 4 bumpers/triggers don't work) and playing with it on the more reaction based puzzles is very difficult. So I started looking for ways to detect multiple mice and keyboards, and then emulate a controller with them. One solution (GlovePIE) would require the computer to run in test mode as it used unsigned drivers to emulate controllers; another was outdated by 4-6 years. This makes JInput my best bet as it is still regularly updated and has a forum of awesome people (This would be you guys) working on it.

In short, is there a way to detect the input of multiple mice and keyboards without having an in-focus window, or is there a way to have a window and Portal 2 to share focus, or some other workaround?
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #1 - Posted 2011-05-02 11:51:56 »

The normal plugin in windows mixes directx for joysticks, and raw for mice and keyboards. Windows raw does not allow access to non focused windows. Directx combines all mice into 1 virtual one and all keyboards into 1 virtual one. So I don't think you can do what you want to do I'm afraid.

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.

TehJavaDev (16 views)
2014-08-28 18:26:30

CopyableCougar4 (25 views)
2014-08-22 19:31:30

atombrot (38 views)
2014-08-19 09:29:53

Tekkerue (34 views)
2014-08-16 06:45:27

Tekkerue (32 views)
2014-08-16 06:22:17

Tekkerue (20 views)
2014-08-16 06:20:21

Tekkerue (30 views)
2014-08-16 06:12:11

Rayexar (66 views)
2014-08-11 02:49:23

BurntPizza (43 views)
2014-08-09 21:09:32

BurntPizza (34 views)
2014-08-08 02:01:56
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!