Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (777)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
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 3896 times)
0 Members and 1 Guest are viewing this topic.
Offline Swot

Junior Newbie

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

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:
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
Exp: 15 years

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.


Pages: [1]
  ignore  |  Print  

hadezbladez (295 views)
2018-11-16 13:46:03

hadezbladez (164 views)
2018-11-16 13:41:33

hadezbladez (295 views)
2018-11-16 13:35:35

hadezbladez (75 views)
2018-11-16 13:32:03

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

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

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

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

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

nelsongames (2279 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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!