add key_action
This commit is contained in:
21
Lektion 2/Key_action/black_white_2/black_white_2.pde
Normal file
21
Lektion 2/Key_action/black_white_2/black_white_2.pde
Normal file
@@ -0,0 +1,21 @@
|
||||
boolean bg_is_white = true;
|
||||
|
||||
void draw() {
|
||||
if(bg_is_white) {
|
||||
background(255);
|
||||
fill(0);
|
||||
} else {
|
||||
background(0);
|
||||
fill(255);
|
||||
}
|
||||
ellipseMode(CENTER);
|
||||
ellipse(50, 50, 50, 50);
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
bg_is_white = false;
|
||||
}
|
||||
|
||||
void mousePressed() {
|
||||
bg_is_white = true;
|
||||
}
|
||||
Reference in New Issue
Block a user