Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (755)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (842)
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 9937 times)
0 Members and 1 Guest are viewing this topic.
Offline NexusOne

Junior Devvie

Java games rock!

« Posted 2003-12-30 14: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

« JGO Spiffy Duke »

Medals: 319
Projects: 25
Exp: 22 years

Coder, Trainee Pixel Artist, Game Reviewer

« Reply #1 - Posted 2003-12-30 14: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.


Offline Herkules

Senior Devvie

Friendly fire isn't friendly!

« Reply #2 - Posted 2003-12-30 16: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!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder

Got any cats?

« Reply #3 - Posted 2003-12-31 20: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!
Offline NexusOne

Junior Devvie

Java games rock!

« Reply #4 - Posted 2003-12-31 23:06:09 »

thanks  Cool
Offline Herkules

Senior Devvie

Friendly fire isn't friendly!

« Reply #5 - Posted 2006-10-23 06: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:

     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:

    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

JGO Coder

Medals: 7
Exp: 15 years

Current project release date: sometime in 3003

« Reply #6 - Posted 2006-10-23 11: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.


Offline Herkules

Senior Devvie

Friendly fire isn't friendly!

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


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  

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

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

nelsongames (74 views)
2018-04-24 18:14:32

ivj94 (759 views)
2018-03-24 14:47:39

ivj94 (87 views)
2018-03-24 14:46:31

ivj94 (643 views)
2018-03-24 14:43:53

Solater (102 views)
2018-03-17 05:04:08

nelsongames (184 views)
2018-03-05 17:56:34

Gornova (426 views)
2018-03-02 22:15:33

buddyBro (1086 views)
2018-02-28 16:59:18
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!