Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
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  
  JInput and Linux  (Read 4604 times)
0 Members and 1 Guest are viewing this topic.
Offline Niwak

Senior Member


Medals: 1
Projects: 1



« Posted 2007-04-24 07:44:03 »

At the moment, I'm trying JInput in my engine and game under Linux (Mandriva Spring 2007).
Everything works fine as long as I manually change the permission for /dev/input/* (Mandriva does not allow neither read nor write).
I do not consider asking the user to change it's computer configuration as a suitable solution for deployment.
Are there any other alternative ?

I was thinking of things like ;
- a plugin that would rely on SDL (as I heard, SDL seems to handle the permission problem),
- a plugin that would rely on one of X11 / AWT / SWT
- a way to dynamically select the choosen plugin ; i.e. a way for the game to select the plugin based on the the capability of the running platform (for example ; Linux Kernel plugin reports no controller, AWT reports mouse/keyboard only, SWT reports plugin not available due to missing SWT library, SDL reports joystick/mouse/keyboard then select SDL plugin).
- another existing library that could serve as a backup when the running system is not properly configured for JInput.

In short, I would like running my game under Linux to be as easy as running it under Windows.

Any suggestion would be welcomed !

Thanks

                   Vincent
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #1 - Posted 2007-04-24 16:54:31 »

Hi

If you want easy, use windows

No, really, I hate myself for saying it, but if you want something that 'just work's', then it's not linux. Nore Vista for that matter Smiley.

You could do a plugin that wraps other plugins, assign priorities, and then pick it, but it's not currently there. There is an SDL plugin around, but I've no idea how up to date it is. There is an AWT plugin, but obviously thats only mouse and keyboard. You can add the AWT plugin so it's always there, but you will then get mouse and keyboard devices twice if other plugins are working. You could parse the controller names so you know if it's an AWT device though.

Even Ubuntu, does not provide even read access to /dev/input/event* devices by default, so system config needs to be changed to read them directly.

If you wish to do an X or SWT plugin, feel free Smiley

Right now though, most users running linux, are capable of changing a few permissions. It's a pain, but unfortunatly, thems the breaks.

I'm not sure what oddlabs do about this? Elias?

Certainly needs some further thought.

Endolf

Offline Niwak

Senior Member


Medals: 1
Projects: 1



« Reply #2 - Posted 2007-04-24 18:21:17 »

I have so little time and my TODO list is so huge that I don't think I can seriously offer to work on a new plugin.
I moved to Linux recently (Vista is really too expensive) and, if the general feeling is great, I'm sad to say that developping under Linux is fairly harder...
Perhaps I will have to go back to Windows when I will have stopped my mourning against Microsoft...

Anyway, thanks for the fast answer. I will only detect the permission problem and give an information message explaining how to set up the permission right.
When I will have finished the more urgent tasks I have, perhaps I will get back on the subject (who knows...).

Thanks
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 2007-04-24 18:27:29 »

I will only detect the permission problem and give an information message explaining how to set up the permission right.

Yeah, I think thas the best option for now.

Endolf

Offline zeni

Senior Newbie





« Reply #4 - Posted 2009-05-15 02:53:24 »

 Hi,  Grin

I have the same problem, i tried use the KeyListener, but this don't work well at Linux Sad. So, i tried use the JInput and I has the problem with permissions.  Cry

So... this is very old topic. Has anything new?

Is the best way tell to user "Change your permissions" ?

Sorry to bad english. Smiley

Tankyou Tongue
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #5 - Posted 2009-05-15 06:05:26 »

Sorry to bad english. Smiley
No worries, it's good enough to understand the question Smiley

Unfortunatly nothing has changed, I don't think it's something that is likely to either I'm afraid. There is the option of adding the AWT plugin in, this only handles system mouse and keyboard, so no multple device support, and no joysticks etc, but it doesn't require any permission changes.

HTH

Endolf

Offline Niwak

Senior Member


Medals: 1
Projects: 1



« Reply #6 - Posted 2009-05-15 07:25:31 »

A very good howto to setup these permissions can be found here : http://gizmod.wiki.sourceforge.net/HOWTO+-+Setting+Input+Device+Permissions+-+Creating+a+udev+Rule
Offline zeni

Senior Newbie





« Reply #7 - Posted 2009-05-15 17:26:53 »

Quote
No worries, it's good enough to understand the question
Thanks =)

Quote
There is the option of adding the AWT plugin in, this only handles system mouse and keyboard, so no multple device support, and no joysticks etc.

With this  can I use the mouse and keybord at same time ? My linux keylistener return aways this:

KEYPRESSED
KEYRELEASED
KEYPRESSED
KEYRELEASED
KEYPRESSED
KEYRELEASED

on windows( Angry) it returns   (WHY GOD?)

KEYPRESSED
-
-
-
KEYRELEASED

with this can I fix the repeat problem ?     I wrote a Timed Key Listener, on my Desk Pc Work fine but on my Laptop(core DUO) did'nt.


If it works.  you know a example ?

Tankyou endolf
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #8 - Posted 2009-05-16 08:01:04 »

Hi

If you specify -Djinput.plugins=net.java.games.input.AWTEnvironmentPlugin JInput will load the AWT plugin, you don't call it directly, it shows up like any other controller. It supports mouse and keyboard. It uses AWT events underneath, so it doesn't support multiple keyboards and mice (multiple mice will both move the pointer, but AWT doesn't know which one is doing it).

HTH

Endolf

Offline zeni

Senior Newbie





« Reply #9 - Posted 2009-05-18 01:35:51 »

Endolf, tankyou for help.

Sorry to the noob question, but where I set this plugin?.  Tankyou.
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 #10 - Posted 2009-05-18 16:43:08 »

If your running from the command line, it's just another command line arg, just like the library path. If your running in an IDE, it's a VM argument.

HTH

Endolf

Offline zeni

Senior Newbie





« Reply #11 - Posted 2009-05-19 04:21:38 »

I put  "  -Djinput.plugins=net.java.games.input.AWTEnvironmentPlugin " in my run configurations/ Arguments (eclipse) and I run this code:


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public class ControllerManager {

   public static void main(String[] args) {
      ControllerEnvironment controllerEnvironment = ControllerEnvironment
            .getDefaultEnvironment();
      Controller[] aController = controllerEnvironment.getControllers();
      for (int iController = 0; iController < aController.length; iController++) {
         Controller controller = aController[iController];
         System.out.println(controller.getType());
      }
   }

}


and i've this output
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
Loading: net.java.games.input.AWTEnvironmentPlugin
Loading: net.java.games.input.LinuxEnvironmentPlugin
Failed to open device (/dev/input/event5): Failed to open device /dev/input/event5 (13)

Failed to open device (/dev/input/event3): Failed to open device /dev/input/event3 (13)

Failed to open device (/dev/input/event1): Failed to open device /dev/input/event1 (13)

Failed to open device (/dev/input/event0): Failed to open device /dev/input/event0 (13)

Linux plugin claims to have found 2 controllers
Keyboard
Mouse
Mouse
Mouse


So... I've a keyboard  and mouse =~~~ and I don't change any permission =)

Now I Want test if it really work. But i don't found a good tutorial about Keyboard + JInput  Undecided

Someone can help ?  Grin
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 (16 views)
2014-09-19 03:14:18

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

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

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

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

mitcheeb (64 views)
2014-09-08 06:06:29

BurntPizza (47 views)
2014-09-07 01:13:42

Longarmx (35 views)
2014-09-07 01:12:14

Longarmx (39 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
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!