lvGL C++ Wrapper

I’m Working on a C++ wrapper of the library.
At moment is in a very early stage but it works nicely.
if someone is interested in code i will share with community.
At moment i’m able to run applications on simulator and embedded linux platform using fbdev and event input interface.

code will be like:

int main (int argc,char** argv) {

GUI* App = new GUI();
App->Go();
App->Jo();
App->Kill();

return 0;

}

int GUI::AppInit() {

IO->enCursor();

CREATE_LV_EVENT(Btn_Pressed_lvcb,GUI,this,&GUI::Btn_Pressed_cb);

calendar = new lvCalendar();
calendar->EnableMultiSel();
calendar->SetDate(5,6,2021);
calendar->ShowToday();
calendar->Center();
calendar->DropDown(true);


lvButton* btn = new lvButton();
btn->SetLabel("Ciao");
btn->AlignParent(LV_ALIGN_BOTTOM_RIGHT,-10,-10);
btn->SetCallback(LV_EVENT_PRESSED,Btn_Pressed_lvcb);

return 0;

}

void GUI::Btn_Pressed_cb(void* btn) {
if(calendar)
calendar->DropDown(false);
}

you can find the code at GitHub - fstuff-dev/lvglpp: lvGL C++ Wrapper !!! let me know !!!

3 Likes

Great, I am interested to see, what you come up with ! Lot’s of things to consider I reckon. For instance you might have to write own allocators if you end up using smart pointers with move semantics.

1 Like

Hi you can find the code at GitHub - fstuff-dev/lvglpp: lvGL C++ Wrapper !!! let me know !!!

Hi,

That’s great! A C++ binding would add great value to LVGL. Are interested in working with us on an official C++ biding?

Yeah ! I Really love the library and i think that have a really great potential for embedded systems.
if you have suggestion on my code will be a grate starting point for the C++ Binding.
Let me Know if you like the code and if we can take some good from it.
Thanks

I think wrapper is a great idea, can’t wait to test it!
Maybe you could try to modify the micropython wrapper generator code to generate C++ wrapper automatically?

1 Like

Great, thanks. I think there is a lot of things to discuss, such as:

  • how should the API look like
  • what C++ features to use
  • automatic code generation
  • manually added parts
  • how to keep track of the new features of LVGL
  • how and what kind of test shall we run to test the binding

I’ve opened an issue for it on GitHub. Let’s continue there :slight_smile:

  • etc