Final exams pt 5 Flashcards
Describe the different procedures for mouse input
- mousePressed() – called when a mouse button is pressed
- mouseReleased() – called when a mouse button is released
- mouseDragged() – called when the mouse is moved while a button is held down
- mouseMoved () – called when the mouse is moved
Write code that:
Draws a circle at the mouse cursor when the mouse is pressed
void mousePressed(){
ellipse(mouseX, mouseY, 100, 100);
}
Draws a rect when the mouse is released
void mouseReleased(){
rect(mouseX, mouseY, 100, 200);
}
Draws a trail of circles whenever the mouse moves
void mouseMoved(){
circle(mouseX, mouseY, 100);
}
Describe the purpose of external libraries
add functions and features to program which have been
1) created by someone else
2) reused from other projects.
What line of code is needed to use an external library in a program?
import library name;
Describe some advantages of ControlP5 over other input types
1) simplifies program –> each button has procedure associated with it
2) large if statements NOT needed if you have many buttons
3) Buttons can be hidden/shown as needed in program.