Widget that does something when you tap it. The function is only called once when you first tap it.
More...
#include <screen.h>
|
| ButtonWidget (std::function< void(void)> onpress, Rect rect, std::string name) |
| Create a Button widget.
|
|
| ButtonWidget (void(*onpress)(), Rect rect, std::string name) |
| Create a Button widget.
|
|
bool | update (bool was_pressed, int x, int y) |
| responds to user input
|
|
void | draw (vex::brain::lcd &, bool first_draw, unsigned int frame_number) |
| draws the button to the screen
|
|
Widget that does something when you tap it. The function is only called once when you first tap it.
◆ ButtonWidget() [1/2]
screen::ButtonWidget::ButtonWidget |
( |
std::function< void(void)> | onpress, |
|
|
Rect | rect, |
|
|
std::string | name ) |
|
inline |
Create a Button widget.
- Parameters
-
onpress | the function to be called when the button is tapped |
rect | the area the button should take up on the screen |
name | the label put on the button |
◆ ButtonWidget() [2/2]
screen::ButtonWidget::ButtonWidget |
( |
void(*)() | onpress, |
|
|
Rect | rect, |
|
|
std::string | name ) |
|
inline |
Create a Button widget.
- Parameters
-
onpress | the function to be called when the button is tapped |
rect | the area the button should take up on the screen |
name | the label put on the button |
◆ update()
bool screen::ButtonWidget::update |
( |
bool | was_pressed, |
|
|
int | x, |
|
|
int | y ) |
responds to user input
- Parameters
-
was_pressed | if the screen is pressed |
x | x position if the screen was pressed |
y | y position if the screen was pressed |
- Returns
- true if the button was pressed
The documentation for this class was generated from the following files: