I'm in the early stages of writing a class that has 2 static instances of other classes. its basically a GUI / basic window manager layered on top of the FABGL libraries that actually drive my vga display
class vgaWindow
{
public:
vgaWindow(); //generic constructor
vgaWindow(String wNAME, uint16_t X0, uint16_t Y0, uint16_t X1, uint16_t Y1 ) ; //simple constructor
vgaWindow(String wNAME, uint16_t X0, uint16_t Y0, uint16_t X1, uint16_t Y1, Color *FG0, Color *BG0);
private:
static uint16_t wIDused; //keep track of used id's
static uint16_t dispW, dispH;
static fabgl::VGAController disp; //create the display instance
static fabgl::Canvas cv; //create canvas to draw on
};
so I know how to initialize the ints in the cpp file:
uint16_t vgaWindow::wIDused=0;
uint16_t vgaWindow::dispW=0;
uint16_t vgaWindow::dispH=0;
but I haven't the slightest clue how to init a class level member that is a class. Is it even possible? am I even saying that right?
this is really a c++ question, but in case its relevant, this code will be running on an esp32. Programed with the esspresso arduino core on platformio.
my second question is around static fabgl::Canvas cv;
per the fabgl documentation (and a look at the source code), there is no default(no argument) constructor. creating an instance of Canvas is meant to be done like this:
static fabgl::Canvas cv(&disp)
I added a method to attach the "canvas" to the "controller" as is done in the constructor meant to be used. Am I on the right path with that? I cant get it to compile until I resolve the initialization, so I have no idea.
ps sorry if this is formatted horribly, I cant seem to fix it. Thanks!