此函数可用于在运行游戏的设备上显示虚拟键盘。调用此函数时,需要为前三个参数中的每个参数提供以下常量之一:
虚拟键盘类型常量 | |
---|---|
键盘类型 | 描述 |
kbv_type_default | The default keyboard type for the current system. |
kbv_type_ascii | An ASCII-only keyboard. |
kbv_type_url | A normal keyboard optimized for URL entry. Usually features a ".com" or other domain keys, as well as "/" and "." keys. |
kbv_type_email | A normal keyboard optimized for e-mail entry. Usually features "@" and "." characters. |
kbv_type_numbers | A numbers-only keyboard, usually displayed as a number pad. |
kbv_type_phone | A phone pad keyboard. Usually numbers-only with the "*" and "#" keys. |
kbv_type_phone_name | A keyboard optimized for entering both a phone number and a name. Usually similar to an ASCII keyboard, but with a limited special characters selection. |
虚拟键盘返回类型常量 | |
---|---|
返回类型 | 描述 |
kbv_returnkey_default | The default return key title for the current system. |
kbv_returnkey_go | Sets the return key title to "Go". |
kbv_returnkey_google | Sets the return key title to "Google", or to a generic search icon in some cases. |
kbv_returnkey_join | Sets the return key title to "Go". |
kbv_returnkey_next | Sets the return key title to "Next". |
kbv_returnkey_route | Sets the return key title to "Route". |
kbv_returnkey_search | Sets the return key title to "Search", or to a generic search icon in some cases. |
kbv_returnkey_send | Sets the return key title to "Send". |
kbv_returnkey_yahoo | Sets the return key title to "Yahoo", or to a generic search icon in some cases. |
kbv_returnkey_done | Sets the return key title to "Done". |
kbv_returnkey_continue | Sets the return key title to "Continue". |
kbv_returnkey_emergency | Sets the return key title to "Emergency Call". |
虚拟键盘自动大写类型常量 | |
---|---|
自动大写类型 | 描述 |
kbv_autocapitalize_none | Autocapitalization is disabled. |
kbv_autocapitalize_words | Words will be auto-capitalized. |
kbv_autocapitalize_sentences | Sentences will be auto-capitalized. |
kbv_autocapitalize_characters | All characters will be capitalized. |
最后一个参数是启用/禁用预想英文输入法,这将被设置为true以允许它,否则设置为false,但请注意,仅仅因为它被允许并不意味着它将被使用,因为这将取决于用户在设备上的偏好。在预想英文输入法模式下,虚拟键盘不会生成正常的GameMaker按键事件。相反,它将只更新最后一个按下的字符和键盘字符串变量。这是由于无法检测用于检测按键的内部文本字段中的变化是来自实际的虚拟键盘键还是来自文本建议。在这些情况下,您可能希望读取keyboard_string输入,而不是读取任何类型的原始按键输入。
还需要注意的是,根据平台操作系统的不同,用户将获得具有不同函数的不同键盘,每个目标的使用注意事项如下:
无法使用返回键 | 替换键 |
---|---|
kbv_returnkey_google kbv_returnkey_yahoo | kbv_returnkey_search |
kbv_returnkey_join kbv_returnkey_route kbv_returnkey_emergency | kbv_returnkey_go |
kbv_returnkey_continue | kbv_returnkey_next |
调用此函数将生成系统异步事件,其中 async_load DS 映射将填充以下键/值对:
keyboard_virtual_show(keyboard_type, return_key_type, autocapitalization_type, predictive_text_enabled);
参数 | 类型 | 描述 |
---|---|---|
keyboard_type | 虚拟键盘类型常量 | 确定虚拟键盘上的可用键集(请参阅顶部的表)。 |
return_key_type | 虚拟键盘返回类型常量 | 确定虚拟键盘的返回/操作键上显示的内容(参见顶部的表格)。 |
autocapitalization_type | 虚拟键盘自动大写类型常量 | 确定如何/是否将通过虚拟键盘键入的单词自动大写(请参阅顶部的表格)。 |
predictive_text_enabled | Boolean | 设置为true/false以启用/禁用预想英文输入法。 |
N/A
if (input == false)
{
input = true;
keyboard_virtual_show(kbv_type_numbers, kbv_returnkey_default, kbv_autocapitalize_none, false);
}
如果给定的变量未设置为true,则上面的代码将调出操作系统虚拟键盘。