Skip to content

Instantly share code, notes, and snippets.

@ZieIony
Last active October 3, 2020 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZieIony/19e3d6a4fcd8fad8bf7ecc1dc7f52fc2 to your computer and use it in GitHub Desktop.
Save ZieIony/19e3d6a4fcd8fad8bf7ecc1dc7f52fc2 to your computer and use it in GitHub Desktop.
class Button {
Color background;
Content content;
float x, y, width, height;
OnClickListener clickListener;
void measure() {
// compute preferred size
}
void layout(float x, float y, float width, float height) {
// save position and size, and layout content here
}
void draw() {
// draw background and content
}
void dispatchMouseEvent(MouseEvent event) {
// if clicked, fire clickListener
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment