2-4.keyPressed
Name(名称):keyPressed//布尔系统变量
Examples(例子):
// Click on the image to give it focus,
点击图片给它焦点
// and then press any key.
然后按任意键
// Note: The rectangle in this example may注意:此示例中的矩形可能
// flicker as the operating system may闪烁作为操作系统可能
// register a long key press as a repetition注册一个长按键作为重复
// of key presses.
按键。
void draw() {
if (keyPressed == true) {
fill(0);
} else {
fill(255);
}
rect(25, 25, 50, 50);
}
Description(描述):The boolean system variable keyPressed is true if any key is pressed and false if no keys are pressed.
布尔系统变量keyPressed如果任何键被按下,则为真,如果没有按键,则为false。
Note that there is a similarly named function called keyPressed(). See its reference page for more information.
请注意,有一个类似的名为keyPressed()的函数。 有关详细信息,请参阅其参考页面。
Related(相关函数):key
keyCode
keyPressed()
keyReleased()
- 本文固定链接: http://iprocessing.cn/2017/07/14/keypressed键盘按键动作/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表