Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (488)
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  
  LibGDX Gamepad  (Read 3298 times)
0 Members and 1 Guest are viewing this topic.
Offline novasharp

Junior Member


Medals: 1
Projects: 1


Gamemaker


« Posted 2013-04-24 15:46:54 »

I made a gamepad wrapper using JInput for a previous game. Is there any way to use gamepads with LibGDX?

novasharp
Offline gouessej
« Reply #1 - Posted 2013-04-24 18:51:28 »

Hi

As far as I know, one of its contributor talked about supporting Object Oriented Input System in the future:
http://sourceforge.net/projects/wgois/

Maybe I will add some support of NEWT Controller API into LibGDX in a far future.

Offline Cero
« Reply #2 - Posted 2013-04-24 19:36:04 »

There is already full support. http://www.badlogicgames.com/wordpress/?p=2724

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

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #3 - Posted 2013-04-24 19:58:46 »

@Cero do you believe it would be simple to get a Play Station 3 remote to work through that? I'm not sure if drivers would be necessary or something else...

Offline gouessej
« Reply #4 - Posted 2013-04-24 20:10:34 »

It should work, the API is designed to support accelerometers too. I like its design, it is even more straightforward than what I have planned in my draft.

Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #5 - Posted 2013-04-24 20:17:22 »

any idea where to grab a "gdx-controllers.jar"?

Offline novasharp

Junior Member


Medals: 1
Projects: 1


Gamemaker


« Reply #6 - Posted 2013-04-24 20:18:24 »

If you download libgdx, it is in the extensions/gdx-controller directory

novasharp
Offline Cero
« Reply #7 - Posted 2013-04-24 20:40:24 »

@Cero do you believe it would be simple to get a Play Station 3 remote to work through that? I'm not sure if drivers would be necessary or something else...

Installing the gamepad is you business and could be harder than using a xbox360 pad, but I hear its easy too.
Once installed, using it with libgdx is easy as pie.
I wrote the XBox360 mappings and I plan to do one for PS3 as well if none has been posted until then.

Offline novasharp

Junior Member


Medals: 1
Projects: 1


Gamemaker


« Reply #8 - Posted 2013-04-24 22:35:17 »

Okay, so I got the gamepad mapping written, but now I am having the problem that when I go into fullscreen mode, the gamepad stops working.

novasharp
Offline wreed12345

JGO Knight


Medals: 24
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #9 - Posted 2013-04-24 22:57:12 »

See if you can reproduce that on another computer - I think I remember seeing something like this somewhere else where it was a driver problem

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

Junior Member


Medals: 1
Projects: 1


Gamemaker


« Reply #10 - Posted 2013-04-25 01:21:57 »

Well, haven't had the chance to test it on another computer yet, but now when I try to start my game in fullscreen, I get this error:

terminate called after throwing an instance of 'OIS::Exception'
  what():  Win32InputManager::Win32InputManager >> The sent HWND is not valid!
AL lib: alc_cleanup: 1 device not closed

novasharp
Offline novasharp

Junior Member


Medals: 1
Projects: 1


Gamemaker


« Reply #11 - Posted 2013-04-25 12:43:36 »

Okay, so I tested it on a 64bit Win7 Pro desktop. The same problems occurred. When I went into fullscreen, the gamepad stopped responding. It seemed to have stopped polling the hardware gamepad.

novasharp
Offline novasharp

Junior Member


Medals: 1
Projects: 1


Gamemaker


« Reply #12 - Posted 2013-04-25 13:23:45 »

Update: I fixed it by doing two things:

First, I reloaded my gamepad each time I switched between fullscreen and not fullscreen.

Second, I changed my reload code to this:
1  
2  
3  
4  
5  
6  
7  
8  
if(Gdx.input != null) {
   Array<Controller> controllers = new DesktopControllerManager().getControllers();
   if(controllers.size > 0) gamepad = controllers.first();
}
if(gamepad != null) {
   gamepad.addListener(this);
}
hatPosition = -1;

novasharp
Offline Cero
« Reply #13 - Posted 2013-04-25 18:20:30 »

Could you post this on the libgdx forum and/or post an issue to the libgdx issue page? 
If this is a bug and not only your pc it should be known and fixed

Offline badlogicgames
« Reply #14 - Posted 2013-04-25 18:36:31 »

It's a know bug i haven't come around to fixing yet. Your solution is interesting, i thought i needed to reinitiate the entire thing. Should be easy to fix. If someone happens to have a pull request before i get to it i won't be mad Smiley

http://www.badlogicgames.com - musings on Android and Java game development
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 (17 views)
2014-08-28 18:26:30

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

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

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

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

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

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

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

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

BurntPizza (37 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!