I'm working with a library for the esp32 called fabgl, It drives a vga monitor. This class has pretty extensive UI features built in & provides an example of exactly the sort of GUI I want to build. (full class here) . The example I'll be referring to is located in /examples/vga/graficaluserinterface/. I am just barley understanding how to use this class, so ANYTHING you can tell me about the way its structured (or why) would be of great help. I will also pose a few specific questions in my post:
The trouble I'm having is understanding how the program is setup / how it flows. lets start with main.cpp (includes omitted):
fabgl::VGA16Controller DisplayController;
fabgl::PS2Controller PS2Controller;
fabgl::FontInfo dataCon24= fabgl::FONT_dataCtr24;
void setup()
{
Serial.begin(115200);
PS2Controller.begin(PS2Preset::KeyboardPort0_MousePort1, KbdMode::GenerateVirtualKeys);
DisplayController.begin();
DisplayController.setResolution(VGA_640x480_60Hz);
}
void loop()
{
MyApp().runAsync(&DisplayController, 3500).joinAsyncRun(); // why this? Just to use a larger stack!
}
This I'm mostly good with, setup runs & then anything before the myApp call runs once, then the app gets run? (explanation of the authors note: "bigger stack" would be cool).
then we have app.h. This seems to replace most of what would normally be in main.cpp?
this line confuses me, specifically the single colon, which I only know with respect to initializing lists
class MyApp : public uiApp
init() seems to be roughly equivalent to setup(), in that it runs once. Through out there, all the gui objects get created for the first frame. as well as objects for other frames, defined in their own .h file.
two primary questions around this:
a) since loop() in main doesn't actually loop, where is my main loop?
b) i see a lot of syntax that looks like this:
testButton->onClick = [&](){ testButtonClick(); };
I can copy it & it works, but I'd like to know what the leading "[&] () " means/does.
App.h (6.7 KB)
GraphicalUserInterface.ino (1.3 KB)
TestControlsFrame.h (4.6 KB)