Files
processing4/web/reference/API/keyPressed.xml
2005-01-27 06:48:42 +00:00

73 lines
998 B
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<name>keyPressed()</name>
<category>Input/Output</category>
<subcategory>Keyboard</subcategory>
<usage>Web &amp; Application</usage>
<example>
<image>keyPressed_.jar</image>
<code>
// Click on the image to give it focus,
// and then press any key
int value = 0;
void loop() {
fill(value);
rect(25, 25, 50, 50);
}
void keyPressed()
{
if(value == 0) {
value = 255;
} else {
value = 0;
}
}
</code>
</example>
<description>
The <b>keyPressed()</b> function is called once every time a key is pressed. As a general rule, nothing should be draw within the <b>keyPressed()</b> block.
</description>
<syntax>
void keyPressed() {
<c>statements</c>
}
</syntax>
<parameter>
<label></label>
<description></description>
</parameter>
<returns>None</returns>
<related>
keyPressed
key
keyCode
keyReleased()
</related>
<availability>1.0</availability>
<type>Function</type>
<partof>Core</partof>
</root>