LittlevGL contains a set of styles by default. One can take any of those, copy and modify. Still the default ones stay in the RAM - for nothing.
Suggestion: include a flag in lv_conf.h, something like
#define LV_STYLE_INIT_OVERRIDE my_style_init
If the above was set, the internal function lv_style_init() would be #defined out, instead the user had to declare her/his own function to make the default styles as required.
Of course no one forbids re-initializing those lv_style_* -structures after calling lv_init(), but getting rid of the “factory” initializations would save some constant memory estate (initializer constants could be discarded).
Oh, that was fast - thank you! I will certainly have a look at this.
Meanwhile, another question of total different topic: object positioning (or should I open a new topic??).
Now when I call lv_obj_set_pos(...), the position will be the top left corner of that particular object.
I wonder if there’s a way to use the center of the object? Say, I have a labels with text of different widths and I’d like to arrange those center aligned on top of each other. Of course, e.g for X position I can use (lv_disp_get_hor_res(NULL) - (lv_obj_get_width(object) / 2), but is there any easier way? Inside a label I can adjust the alignment though.
The whole alignment system is still a little mystery … I have been fiddling around with LvGL couple of weeks now, but there are still many aspect not 100% clear to me.
This will position the center of the object at (x,y) relative to its parent.
I suggest you create a container to hold all the labels, and set their text alignment to center. Then you can align the container on your screen however you wish.