So I've created a paginated menu with 8 pages each capable of showing six 265-color thumbnails and titles, all of which are stored in a struct. (This is for a food cooker of sorts.)
Code: Select all
struct MITEMS {
unsigned long img[50];
char name[50][18];
unsigned long temp[50];
int mins[50], secs[50];
} MenuItems;
Code: Select all
const unsigned long CLEGCA_bmp = 0x0000016C;
const unsigned long CSTRIP_bmp = 0x000119AA;
const unsigned long UNDEF_bmp = 0x000692E0;
Code: Select all
void populateFakeMenuItems(void) {
int loops = 0;
for (loops = 0; loops <= 50; loops++) {
sprintf(MenuItems.name[loops], "[%d NOT SET]", loops + 1);
MenuItems.img[loops] = UNDEF_bmp;
MenuItems.temp[loops] = 335;
MenuItems.mins[loops] = 2;
MenuItems.secs[loops] = 0;
}
strcpy(MenuItems.name[0], "Chicken Legs");
MenuItems.img[0] = CLEGCA_bmp;
MenuItems.temp[0] = 335;
MenuItems.mins[0] = 2;
MenuItems.secs[0] = 0;
strcpy(MenuItems.name[1], "Chicken Strips");
MenuItems.img[1] = CSTRIP_bmp;
MenuItems.temp[1] = 335;
MenuItems.mins[1] = 2;
MenuItems.secs[1] = 0;
... so on...
Code: Select all
void loadMenuScreen(int pgNum) {
imgMenuA.Picture_Name = MenuItems.img[pgNum * 6];
...
imgMenuF.Picture_Name = MenuItems.img[pgNum * 6 + 5];
DrawScreenO(&MenuScreen, VTFT_LOAD_RES_NONE); //Images are shewed. (LOAD_RES_ALL is called by function loading this screen initially.)
//DrawScreenO(&MenuScreen, VTFT_LOAD_RES_ALL); //Takes longer because of re-loading..
return;
}
One other thing to note: I have been able to call DrawScreenO(&MenuScreen, VTFT_LOAD_RES_ALL); on initially loading the MenuScreen from, say, HomeScreen, and then for page number changes calling loadMenuScreen(x) with DrawScreenO(&MenuScreen, VTFT_LOAD_RES_NONE); The only issue is that upon a page change all the images load instantly, but are skewed to the right.. odd. (see attached)
Any suggestions?
Thank you!
Harrison