I am having difficulties drawing objects in the correct positions with littleVGL. I have set all the padding members for both the page and object to “0” however it is not drawing the objects directly below the blue bar located at the top of the screen. I have posted most of the code below along with a picture of the result.
Function to create screen:
lv_data_t * createScr(uint32_t colorOption)
{
lv_data_t * screenData = (lv_data_t *)malloc( sizeof(lv_data_t) );
screenData->object = (lv_obj_t *)malloc( sizeof(lv_obj_t) );
screenData->style = (lv_style_t *)malloc( sizeof(lv_style_t) );
screenData->object = lv_page_create(NULL, NULL);
lv_page_set_sb_mode(screenData->object, LV_SB_MODE_OFF);
lv_style_copy(screenData->style, &lv_style_plain);
screenData->style->body.main_color = LV_COLOR_HEX(colorOption);
screenData->style->body.grad_color = LV_COLOR_HEX(colorOption);
screenData->style->body.padding.ver = 0;
screenData->style->body.padding.hor = 0;
screenData->style->body.padding.inner = 0;
lv_obj_set_style(screenData->object,screenData->style);
pros::delay(20);
return screenData;
}
Creation of objects in initialize function:
lv_data_t * mainScreen = createScr(0x3e4451);//loadingScreen();
lv_scr_load(mainScreen->object);
pros::delay(20);
lv_style_t testStyle;
lv_style_copy(&testStyle,&lv_style_plain);
testStyle.body.padding.ver = 0;
testStyle.body.padding.hor = 0;
testStyle.body.padding.inner = 0;
lv_obj_t * testObj = lv_obj_create(mainScreen->object,NULL);
lv_obj_set_style(testObj,&testStyle);
lv_obj_set_pos(testObj,300,0);
lv_obj_t * testObj2 = lv_obj_create(mainScreen->object,testObj);
lv_obj_set_pos(testObj2,0,0);
pros::delay(10000);
lv_page_clean(mainScreen->object);
freeDataMem(mainScreen); //Frees memory