首页 > 文档 > Key键值
2017
07-14

Key键值

2-1.key

Name(名称):key//系统变量:键盘上最近使用的键的值

Examples(例子):

// Click on the window to give it focus,
单击窗口使其成为焦点

// and press the ‘B’ key.
然后按”B”键。

void draw() {

if (keyPressed) {

if (key == ‘b’ || key == ‘B’) {

fill(0);

}

} else {

fill(255);

}

rect(25, 25, 50, 50);

}

Description(描述):The system variable key always contains the value of the most recent key on the keyboard that was used (either pressed or released).

系统变量键总是包含键盘上最近使用的键的值(按下或释放)。

For non-ASCII keys, use the keyCode variable. The keys included in the ASCII specification (BACKSPACE, TAB, ENTER, RETURN, ESC, and DELETE) do not require checking to see if they key is coded, and you should simply use the key variable instead of keyCode If you’re making cross-platform projects, note that the ENTER key is commonly used on PCs and Unix and the RETURN key is used instead on Macintosh. Check for both ENTER and RETURN to make sure your program will work for all platforms.

非ASCII键,使用密钥变量。在ASCII规范包括键(Backspace,选项卡,输入,返回,ESC,和删除)不需要看他们的关键是编码,你应该使用的关键变量代替密码如果你让跨平台项目,注意回车键是常用的PC和UNIX和返回键代替苹果。检查输入和返回,以确保您的程序能在所有平台上正常工作。

There are issues with how keyCode behaves across different renderers and operating systems. Watch out for unexpected behavior as you switch renderers and operating systems.

有密码的行为如何在不同的渲染器和操作系统的问题。小心意外的行为,当你切换渲染器和操作系统。

Related(相关函数):keyCode
keyPressed
keyPressed()
keyReleased()



最后编辑:
作者:卡萨布兰卡
卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。