1234567891011121314151617181920212223242526 |
- package main.java.com.lotkavolterra;
- import processing.core.PApplet;
- class Button extends PApplet {
- String label;
- float x; // top left corner x position
- float y; // top left corner y position
- float w; // width of button
- float h; // height of button
- Button(String labelB, float xpos, float ypos, float widthB, float heightB) {
- label = labelB;
- x = xpos;
- y = ypos;
- w = widthB;
- h = heightB;
- }
- boolean MouseIsOver(float mouseX, float mouseY) {
- if (mouseX > x && mouseX < (x + w) && mouseY > y && mouseY < (y + h)) {
- return true;
- }
- return false;
- }
- }
|