RIT VEXU Core API
Loading...
Searching...
No Matches
screen::ButtonWidget Class Reference

Widget that does something when you tap it. The function is only called once when you first tap it. More...

#include <screen.h>

Public Member Functions

 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
 

Detailed Description

Widget that does something when you tap it. The function is only called once when you first tap it.

Constructor & Destructor Documentation

◆ ButtonWidget() [1/2]

screen::ButtonWidget::ButtonWidget ( std::function< void(void)> onpress,
Rect rect,
std::string name )
inline

Create a Button widget.

Parameters
onpressthe function to be called when the button is tapped
rectthe area the button should take up on the screen
namethe label put on the button

◆ ButtonWidget() [2/2]

screen::ButtonWidget::ButtonWidget ( void(*)() onpress,
Rect rect,
std::string name )
inline

Create a Button widget.

Parameters
onpressthe function to be called when the button is tapped
rectthe area the button should take up on the screen
namethe label put on the button

Member Function Documentation

◆ update()

bool screen::ButtonWidget::update ( bool was_pressed,
int x,
int y )

responds to user input

Parameters
was_pressedif the screen is pressed
xx position if the screen was pressed
yy position if the screen was pressed
Returns
true if the button was pressed

The documentation for this class was generated from the following files: