Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (416)
games submitted by our members
Games in WIP (306)
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  
  Game Controller Input  (Read 3665 times)
0 Members and 1 Guest are viewing this topic.
Offline NexusOne

Junior Member




Java games rock!


« Posted 2003-12-30 15:17:50 »

If I attach a controller, say a gamecube or ps2 controller, to my computer through some sort of attachment how can I read input from it for my (jogl) game?
Offline kevglass
« League of Dukes »

JGO Kernel


Medals: 54
Projects: 20


Mentally unstable, best avoided.


« Reply #1 - Posted 2003-12-30 15:26:45 »

See JInput Smiley

Although I'm not sure how a gamecube or ps2 controller will function. My gamepad (Logitech Wingman) works happily through JInput.

Kev

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #2 - Posted 2003-12-30 17:00:47 »

Don't forget JXInput. Whatever shows up as a DirectInput-device will be usable.

And - with JXInput you can code with virtual or auxiluary devices so that your game works when the control is NOT available.

Look at FlyingGuns as an example, where you can use joystick, mouse or keyboard .... even simulatniously ... same code....

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Games published by our own members! Check 'em out!
Try the Free Demo of Titan Attacks
Offline Jeff

JGO Coder




Got any cats?


« Reply #3 - Posted 2003-12-31 21:48:39 »

So to plug my own project, and for completeness.

All of the above is also true for JInput.  You do virtual control devices by writing plug-ins.

JInput is currently ported to Win32, OSX and Linux.  On Win32 it supports DirectInput devices as well as the Win32 plug-in also calls DirectInput.   The linux and OSX developers can tell you the details of those plug-ins.

JInput is part of the 3 current "core" APIs that the sun Game Technology Group is supporting.  (JOGL, JOAL, JInput).   Having said that, there are cetainly other API sets out there that work fine if they meet your needs better (LWJGL, JXInput, JavaJoystick, etc)




Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline NexusOne

Junior Member




Java games rock!


« Reply #4 - Posted 2004-01-01 00:06:09 »

thanks  Cool
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #5 - Posted 2006-10-23 08:24:54 »

What I meant is that JXInput supports high-level structures that allow e.g. to have an 'Axis' (like a joysticks x-, y- or z-axis) only by using 'Button's (e.g. from a joystick again or a keyboard. Like this one:


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
     JXKeyboardInputDevice kd = JXInputManager.createKeyboardDevice( comp );

    Button left = kd.createButton( KeyEvent.VK_LEFT );
    Button right = kd.createButton( KeyEvent.VK_RIGHT );
               
    JXVirtualInputDevice vd = JXInputManager.createVirtualDevice();
    VirtualAxis vaileron = vd.createAxis( Axis.ID_X );
       
     vaileron.setButtons( right, left );
     vaileron.setTimeFor0To1( 1000 );
     vaileron.setTimeFor1To0( 500 );
     vaileron.setName( "Aileron" );


Or something that allows for 'overlaying' axes and 'or'-ing buttons:

1  
2  
    Axis aileron = new LatestChangedValueAxis( vaileron, mouseaileron );
    Button trigger = new OrButton( joysticktrigger, mousetrigger );


FlyingGuns shows user extensions (that I may mave to JXInput). E.g. a 'MouseDevice'
that creates x/y axes from mouse movements.


HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline endolf
« League of Dukes »

JGO Coder


Medals: 4
Projects: 1


Current project release date: sometime in 3003


« Reply #6 - Posted 2006-10-23 13:20:41 »

JInput unders Linux will expose any joysticks and / or event devices. That means almost anything with a USB interface. My scanner shows up there with 3 buttons, which in theory, I could use in a game for input Smiley. LWJGL, and by extention JME use/can use JInput under the covers.

Endolf

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #7 - Posted 2006-10-23 14:31:49 »

Smiley

I had a problem with JXInput crashing on certain machines. It turned out it was some USB keyboard device enumerating 665  buttons!!
This caused a buffer overflow in my code (shame on me  Embarrassed )

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
BrassApparatus (9 views)
2013-06-19 08:52:37

NegativeZero (14 views)
2013-06-19 03:31:52

NegativeZero (17 views)
2013-06-19 03:24:09

Jesse_Attard (20 views)
2013-06-18 22:03:02

HeroesGraveDev (62 views)
2013-06-15 23:35:23

Vermeer (61 views)
2013-06-14 20:08:06

davedes (61 views)
2013-06-14 16:03:55

alaslipknot (55 views)
2013-06-13 07:56:31

Roquen (77 views)
2013-06-12 04:12:32

alaslipknot (60 views)
2013-06-10 19:30:18
Smoothing Algorithm Question
by UprightPath
2013-05-28 02:58:26

Smoothing Algorithm Question
by UprightPath
2013-05-28 02:57:33

Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38
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!