mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 10:00:42 +01:00
69 lines
1.0 KiB
XML
69 lines
1.0 KiB
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
<root>
|
|
<name>keyPressed</name>
|
|
|
|
<category>Input/Output</category>
|
|
|
|
<subcategory>Keyboard</subcategory>
|
|
|
|
<usage>Web & Application</usage>
|
|
|
|
<example>
|
|
<image>keyPressed.jar</image>
|
|
<code>
|
|
// Click on the image to give it focus
|
|
// and 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 loop() {
|
|
if (keyPressed == true) {
|
|
fill(0);
|
|
} else {
|
|
fill(255);
|
|
}
|
|
rect(25, 25, 50, 50);
|
|
}
|
|
</code>
|
|
</example>
|
|
|
|
<description>
|
|
The boolean system variable <b>keyPressed</b> is <b>true</b> if any key is pressed and <b>false</b> if no keys are pressed.
|
|
</description>
|
|
|
|
<syntax>
|
|
keyPressed
|
|
</syntax>
|
|
|
|
<parameter>
|
|
<label></label>
|
|
<description></description>
|
|
</parameter>
|
|
|
|
<returns></returns>
|
|
|
|
<related>
|
|
key
|
|
keyCode
|
|
keyPressed()
|
|
keyReleased()
|
|
</related>
|
|
|
|
<availability>1.0</availability>
|
|
|
|
<type>System variable</type>
|
|
|
|
<partof>Core</partof>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</root>
|