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

Page 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

Image 46
Contents Basic Customization Guide Please Contents Examining Device Property Files Default Emulator Device Property Files Vi Wireless Toolkit Basic Customization Guide December Figures Viii Wireless Toolkit Basic Customization Guide December Tables Wireless Toolkit Basic Customization Guide December Who Should Use This Book How This Book Is OrganizedUsing Operating System Commands Shell Prompts Typographic ConventionsRelated Documentation Accessing Sun Documentation Online Sun Welcomes Your CommentsCustomizing the Wireless Toolkit How to Customize the Wireless ToolkitDevice Property Files and the Default Emulator Customization StepsCustomizing the Wireless Toolkit Wireless Toolkit Basic Customization Guide December Creating Device Property Files Make a Copy of an Existing Main Device Property FileObtain and Enter Image Files Obtain and Enter the Screen Properties Screen LocationTotal Screen Size Display AreaDisplay Area in Full Screen Mode Specifying Screen PropertiesObtain and Enter the Button Properties By measuring the image file, obtain the button propertiesHeight Width Obtain and Enter Soft Button Label Areas Soft button label display is defined by a line of the form Obtain and Enter Icon Properties Defining the Icon Location and StatesEnter the following measured values for the icons properties Run the Emulator for the New Device Enter Color PropertiesScreen Background RGB Color Examining Device Property Files Device Property Files Fonts Main Device Property FileFonts Used by the Midp APIs System Fonts Default FontBitmap Fonts Ascii character Distance to character Font Underlining Device ImageImage with Buttons Highlighted and Backlight On Image without Buttons PressedImage with Buttons Pressed ScalingScreen Properties Screen Location Total Screen Size Display Area in Full Screen ModeDisplay Area Screen Pixel Ratio Screen Background ColorTouch Screen Screen Border ColorScreen Buffering Keyboard Handler Device ButtonsDefining a Device Button Button.LEFT = 13, 197, 20 Assigning a PC Keyboard Key to a Button Assigning a Game Action to a Button Specifying the Characters Generated by a Button PressAssigning Abstract Commands to Buttons Abstract Command Types in Order of PrecedenceEmulating Abstract Command Button Assignments Precedence of Assigning Commands to a Button Secondary Button Assignments Abstract Command Menu Displayed Icons Defining the Icon Location and StatesSoft Button Label Display Soft Button Labels on the Emulated Device DisplayColor Sound AlertsDevice Software Capabilities Alert Type ValuesLocales Character EncodingsEnableAlphaChannel false Transparent ImagesWireless Toolkit Basic Customization Guide December Default Emulator Device Property Files Property FilesDefaultGrayPhone.properties Appendix a Default Emulator Device Property Files Wireless Toolkit Basic Customization Guide December Appendix a Default Emulator Device Property Files Wireless Toolkit Basic Customization Guide December # alert.alerttype.sound soundfile Wireless Toolkit Basic Customization Guide December Device Image Files Icon Image FilesIcon Image Files Support for ByteCode Obfuscators Adding a ByteCode ObfuscatorExample Appendix B Support for ByteCode Obfuscators Wireless Toolkit Basic Customization Guide December P E N D I X C Wireless Toolkit Basic Customization Guide December Index Keyboard.handler property Device property files, 1 WMA messages, customizing Wireless Toolkit Basic Customization Guide December