Sun Microsystems Computer Accessories manual Assigning a Game Action to a Button

Models: Computer Accessories

1 78
Download 78 pages 61 Kb
Page 46
Image 46

Note – Virtual key codes are defined by the Abstract Window Toolkit in Java 2 Standard Edition. The definitions are found in the class java.awt.event.KeyEvent at

http://java.sun.com/j2se/1.4/docs/api/java/awt/event/

KeyEvent.html

For example,

key.LEFT = VK_LEFT

More than one PC key may be assigned to a single button, using the form:

key.<button_name> = <list of virtual key codes>

where the virtual key codes are separated by spaces.

For example,

key.0 = VK_0 VK_NUMPAD0

Assigning a Game Action to a Button

The QwertyKeyboardHandler also allows the MIDP game actions to be mapped to device buttons. You use a line of the form:

game.<function> = <button_name>

where function can be one of LEFT, RIGHT, UP, DOWN and SELECT and button_name is the name of a button as shown in TABLE 2 on page 29.

The default settings are:

game.UP = UP game.DOWN = DOWN game.LEFT = LEFT game.RIGHT = RIGHT game.SELECT = SELECT

Specifying the Characters Generated by a Button Press

When using the QwertyKeyboardHandler, you can also specify the character generated by a button press either alone or in combination with the Shift or Alt buttons.

You use a line of the form:

keyboard.handler.qwerty.<button_name> = '<base character>' '<shift character>' '<alternate character>'

where base character is the character the button normally generates, shift character is the character used when the button is pressed at the same time as Shift, and alternate character is the character generated when the button is pressed at the same time as Alt.

32 Wireless Toolkit Basic Customization Guide • December 2003

Page 46
Image 46
Sun Microsystems Computer Accessories manual Assigning a Game Action to a Button