Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

RobotMan192/VexV5-CustomUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

VexV5-CustomUI

A library to assist with creating GUI on the Vex V5 Brain. Allows creation of included widgets or custom ones that you make yourself. This is not a pros UI library, it is made for use with vexcode pro.

Currently comes bundled with the following widgets:

  1. Button
  2. Combo Box
  3. Text Box

Installation

  1. Install the library by creating a new folder called "lib" in your project directory make sure that you only do this in the file explorer not the project editor
  2. Drag and drop the CustomUI directory into it
  3. Update your projects makefile by adding the following code
SRC_C += $(wildcard lib/*/*.cpp)
SRC_C += $(wildcard lib/*/*/*.cpp)

SRC_H  += $(wildcard lib/*/*.h)
SRC_H  += $(wildcard lib/*/*/*.h)

Example

Include the CustomUI header in your file that you are going to use it

#include "../lib/CustomUI/CustomUI.h"

Create a display this is where you will add widgets

CUI::Display display(&Brain);

In the main function add a button

CUI::Button randomButton("Press Me",CUI::ButtonStyle{},CUI::Rect(4,4,100,25),[](){
  printf("Button Clicked\n");
});

Connect the button to the display

display.addWidget(&randomButton);

Initialize the display

display.init();

Final Code:

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();
  
  CUI::Display display(&Brain);
  
  CUI::Button randomButton("Press Me",CUI::ButtonStyle{},CUI::Rect(4,4,100,25),[](){
    printf("Button Clicked\n");
  });
  
  display.addWidget(&randomButton);
  
  display.init();
}