Game Development Reference
In-Depth Information
Initialization and update of key information
There is a function called s3eKeyboardGetInt that allows us to find out what kind
of keyboard our device has. We can use this information to provide different input
methods to our program should we want to. For example, entering a user's name
on a high score might allow the user to enter their name directly if the device has a
full alphabetic keyboard, but could fall back to a method using arrow keys to cycle
through characters if the device does not feature a full keyboard.
The s3eKeyboardGetInt function call takes a single parameter from the
s3eKeyboardProperty enumeration, and returns an integer value. Details of
the available properties are provided in the following table:
Property name
Description
S3E_KEYBOARD_HAS_NUMPAD
Returns 1 if the device has a numeric
keypad, otherwise returns 0 .
S3E_KEYBOARD_HAS_ALPHA
Returns 1 if the device has an alphabetic
keypad, otherwise returns 0 .
S3E_KEYBOARD_HAS_DIRECTION
Returns 1 if the device has directional
controls (up, down, left, right, and a Select
or OK button), otherwise returns 0 .
S3E_KEYBOARD_NUMPAD_ORIENTATION If the device has a numeric keypad, this
property will return the orientation of the
keypad relative to how the user is holding
the device (if this is possible to detect).
S3E_KEYBOARD_GET_CHAR
Returns 1 if the device supports the
character code input method or 0 if it
does not.
The final value in this table can also be used with the function s3eKeyboardSetInt
to show and hide the virtual keyboard on Android and iOS devices, which will
then allow us to use the character code input method on these types of devices.
The following function call will display the virtual keyboard:
s3eKeyboardSetInt(S3E_KEYBOARD_GET_CHAR, 1);
To hide the virtual keyboard, pass in 0 instead of 1 .
Given that this feature is limited to just Android and iOS, and there is no way of
determining whether the functionality is supported at runtime, this approach is
probably best avoided if you intend to support a wide range of devices.
Search WWH ::




Custom Search