Button names reported from the controller

Started by Numknuf, April 29, 2004, 11:48:37

Previous topic - Next topic

Numknuf

The button count is 12 and the Controller correctly reports the on off status of all buttons but the name for the last four is null.

BUTTON0: false
BUTTON1: false
BUTTON2: false
BUTTON3: false
BUTTON4: false
BUTTON5: false
BUTTON6: false
BUTTON7: false
null: false
null: false
null: false
null: false

So it is useable but I can't refer to a button by its name.

Matzon

yup, the names where being limited to 8 (!?). I have fixed it in cvs. (basically moved the name assigning to after nCreate, and made it check buttons.length)

Index: Controller.java
===================================================================
RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Controller.java,v
retrieving revision 1.17
diff -r1.17 Controller.java
155,161d154
< 		// Assign names to all the buttons
< 		buttonName = new String[8];
< 		for (int i = 0; i < 8; i ++) {
< 			buttonName[i] = "BUTTON" + i;
< 			buttonMap.put(buttonName[i], new Integer(i));
< 		}
< 		
178a172,178
>     
>     // Assign names to all the buttons
>     buttonName = new String[buttons.length];
>     for (int i = 0; i < buttons.length; i ++) {
>       buttonName[i] = "BUTTON" + i;
>       buttonMap.put(buttonName[i], new Integer(i));
>     }