controller input problems

Started by infielder6, February 05, 2007, 06:22:56

Previous topic - Next topic

infielder6

Hello, I'm trying to write a java application which makes use of a game controller. I am trying to select text. I can use the joysticks (analog sticks) to register and the buttons also fire.. but when i try to select a letter.. it fires off for a seemingly infinite amount of times. I.e. when i select a it will type aaaaaaaaaaaaaaaaaaaa.... etc...

I've been looking through tutorials and sample code but can't find anything

Anyone have any ideas.

I called the controllers like this

while(running){
         controller.poll();
         
         if(controller.isButtonPressed(10)){
            frame.addLeftText();
         }else if(controller.isButtonPressed(11)){
            frame.addRightText();
         }else if(controller.isButtonPressed(3)){
            frame.clearText();
         }else if(controller.isButtonPressed(0)){
            frame.exitApp();
         }
         
         frame.axisEvent(controller);
}

the methods mentioned inside the code just add the last selected character to the end of a string.. the axisEvent method is what allows me to select the test.. which are just digits aranged in a circle around each of two joysticks...

Matzon

isButtonPressed will return yes for each game loop - so at 60 FPS, you will get 60 a's in a second.

you might want to look at the event based api:
http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/input/basiccontroller#using_the_event_based_api

infielder6