Trying to make a auton selector gui

I am trying to make a GUI to choose whether it is auton or skills.
this is what i have so far. (came from the guide from a few years back

//vex::smartdrive drive = smartdrive(leftSide, rightSide, GPS1, 180, 0, 0, inches, true);
int autonomousSelection = -1;//storage for auton selcetion
vex::competition Competition;

typedef struct _button{
    int xpos;
    int ypos;
    int width;
    int height;
    bool state;
    vex::color offColor;
    vex::color onColor;
    const char *label;
} button;

//button definitions for each software button
button buttons[] = {
    {   30,  30, 60, 60,  false, 0xE00000, 0x0000E0, "Is this a skills run?" },
    {  150, 150, 60, 60,  false, 0x404040, 0xC0C0C0, "5-" },
};

void displayButtonControls( int index, bool pressed );

int findButton(  int16_t xpos, int16_t ypos ) {
    int nButtons = sizeof(buttons) / sizeof(button);

    for( int index=0;index < nButtons;index++) {
      button *pButton = &buttons[ index ];
      if( xpos < pButton->xpos || xpos > (pButton->xpos + pButton->width) )
        continue;

      if( ypos < pButton->ypos || ypos > (pButton->ypos + pButton->height) )
        continue;

      return(index);
    }
    return (-1);
}

void initButtons() {
    int nButtons = sizeof(buttons) / sizeof(button);

    for( int index=0;index < nButtons;index++) {
      buttons[index].state = false;
    }
}

void userTouchCallbackPressed() {
    int index;
    int xpos = Brain.Screen.xPosition();
    int ypos = Brain.Screen.yPosition();

    if( (index = findButton( xpos, ypos )) >= 0 ) {
      displayButtonControls( index, true );
    }

}

void userTouchCallbackReleased() {
    int index;
    int xpos = Brain.Screen.xPosition();
    int ypos = Brain.Screen.yPosition();

    if( (index = findButton( xpos, ypos )) >= 0 ) {
      // clear all buttons to false, ie. unselected
      //      initButtons(); 

      // now set this one as true
      if( buttons[index].state == true) {
      buttons[index].state = false; }
      else    {
      buttons[index].state = true;}

      // save as auton selection
      autonomousSelection = index;

      displayButtonControls( index, false );
    }
}

void displayButtonControls( int index, bool pressed ) {
    vex::color c;
    Brain.Screen.setPenColor( vex::color(0xe0e0e0) );

    for(int i=0;i<sizeof(buttons)/sizeof(button);i++) {

      if( buttons[i].state )
        c = buttons[i].onColor;
      else
        c = buttons[i].offColor;

      Brain.Screen.setFillColor( c );

      // button fill
      if( i == index && pressed == true ) {
        Brain.Screen.drawRectangle( buttons[i].xpos, buttons[i].ypos, buttons[i].width, buttons[i].height, c );
      }
      else
        Brain.Screen.drawRectangle( buttons[i].xpos, buttons[i].ypos, buttons[i].width, buttons[i].height );

      // outline
      Brain.Screen.drawRectangle( buttons[i].xpos, buttons[i].ypos, buttons[i].width, buttons[i].height, vex::color::transparent );

// draw label
      if(  buttons[i].label != NULL )
        Brain.Screen.printAt( buttons[i].xpos + 8, buttons[i].ypos + buttons[i].height - 8, buttons[i].label );
    }
}
void autonomous() {

bool skills = buttons[1].state;

if (skills == 0){
//auton
} else{
//auton again
//rest of skills run
}

Although old - it might be a good reference:

Is it necessary ?I don’t think it can be used in the competition.

this is the example i took from. the gui didn’t show up on the brain when i ran the code.

Also a little outdated but you could look through this
https://rollingrobots.com/v5-gui-auton-selector

I tested it just now on and it works on my V5 Brain with VEXOs 1.1.2 and VEXCode Pro V5 - I imported the project using the Import function under the file menu.

here is the project zipped up …

v5code-project-AutonButtonTemplate.zip (22.3 KB)

Software selection on the robot brain is permitted in competition. The nice thing is only having one program to run and maintain vs multiple versions of essentially the same program. I’ve had teams taking the latter approach and forget to apply bug fixes all the versions of their programs when they fix a bug.