arrays within arrays (not multidimensional arrays)

I couldnt find what I am looking for so im reaching out for help…

I would like to declare a few arrays, then make an array with those arrays that i can iterate through the values in the first array… without using a multi array
not sure that makes sense.

I am using the fastLED library to display images on a 28wide by 26 tall grid. each image is declared as a long unsigned int array.

I have several images declared as their own array.

I then want to make a sort of list/lookup table that i can pick which image to display.

ex…

long unsigned int Spencer[] = 
{
0x000000, 0x000000, 0x1b1d20, 0x293030, 0x060405, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x1b1d20, 0x4a5159, 0x3a3a3e, 
0x000000, 0x000000, 0x0c040b, 0x221009, 0x221009, 0x221009, 0x3a231a, 0x221009, 0x000000, 0x060405, 0x786a66, 0xffeded, 0xf7dadb, 0xccb7b5, 0x888b8e, 0x000000, 0x000000, 0x000000, 
etc... etc...
 0x000000, 0x060405, 0x000000, 0x0c040b, 0x060405, 0x000000, 0x000000, 0x000000
};

long unsigned int Liz[] = 
{ blah blah blah blah same number of values but different values
};

long unsigned int Greg[] = 
{ blah blah blah blah same number of values but different values
};

long unsigned int Dani[] = 
{ blah blah blah blah same number of values but different values
};

then i have a for loop that iterates through each value and displays it in the correct pixel…

for(int i = 0; i < NUM_LEDS; i++) {
    setPixel(i, Spencer[i]);
  }

but I want this for loop to change to a different image every so often

void DisplaySpencer()
{
  for(int i = 0; i < NUM_LEDS; i++) {
    setPixel(i, Spencer[i]);
  }
  showPixels();
}
void DisplayLiz()
{
  for(int i = 0; i < NUM_LEDS; i++) {
    setPixel(i, Liz[i]);
  }
  adjust_gamma();
  showPixels();
}
void DisplayDani()
{
  for(int i = 0; i < NUM_LEDS; i++) {
    setPixel(i, Dani[i]);
  }
  adjust_gamma_more();
  showPixels();
}

void runScreenSaver(void){
  clearTablePixels();

  previousScreenSaverMillis = currentScreenSaverMillis;

if(whichScreenSaver==0){
    DisplaySpencer();
  }else if(whichScreenSaver==1){
    DisplayLiz();
  }else{
    DisplayDani();
  }

currentScreenSaverMillis = millis();

    if(currentScreenSaverMillis - previousScreenSaverMillis > screenSaverInterval) {
      previousScreenSaverMillis = currentScreenSaverMillis;
      whichScreenSaver++;
      if(whichScreenSaver>=totNumPics){
        whichScreenSaver=0;
      }
    }

but i want to easily be able to change around the images and change the number of images shown without having to add and subtract using the “if(whichScreenSaver)” statement.

something kinda like this…

int totNumPics = 3;
long unsigned int picList[totNumPics ]  {Spencer[728],Liz[728],Dani[728]};
int gammaList[]                   {           0,           1,           2};


void runScreenSaver(void){
  clearTablePixels();

  previousScreenSaverMillis = currentScreenSaverMillis;

  for(int i = 0; i < NUM_LEDS; i++) {
    setPixel(i, picList[whichScreenSaver]);
  }
  int ourGamma = gammaList[whichScreenSaver];
  if(ourGamma==1){
    adjust_gamma();
  }else if(ourGamma==2){
    adjust_gamma_more();
  }else{
  }
  showPixels();

currentScreenSaverMillis = millis();

    if(currentScreenSaverMillis - previousScreenSaverMillis > screenSaverInterval) {
      previousScreenSaverMillis = currentScreenSaverMillis;
      whichScreenSaver++;
      if(whichScreenSaver>=totNumPics){
        whichScreenSaver=0;
      }
    }

}

but this doesnt work.

I dont want to use a multi dimensional array because changing it if i wanted would be a huge pain with how many values are in each of the images.

id like to easily say 'hey, i want to cycle through these two pics of these two people, oh but wait, now i want to change it to 4 pics total of those two people but also two others, or wait, now i want it to cycle through 3 pics of 3 totally different people.

I tried i think it is making a library? for it…

struct AbstractPicture{
  int gamma;
  long unsigned int pic;
};

AbstractPicture picLib[totNumPics] = {
  {
      0,
      Spencer[]
  },
  {
      1,
      Liz[]
  },
  {
      2,
      Dani[]
  }
};

void runScreenSaver(void){
  clearTablePixels();

  previousScreenSaverMillis = currentScreenSaverMillis;

  for(int i = 0; i < NUM_LEDS; i++) {
    setPixel(i, picLib[whichScreenSaver].pic[i]);
  }
  int ourGamma = picLib[whichScreenSaver].gamma;
  if(ourGamma==1){
    adjust_gamma();
  }else if(ourGamma==2){
    adjust_gamma_more();
  }else{
  }
  showPixels();

currentScreenSaverMillis = millis();

    if(currentScreenSaverMillis - previousScreenSaverMillis > screenSaverInterval) {
      previousScreenSaverMillis = currentScreenSaverMillis;
      whichScreenSaver++;
      if(whichScreenSaver>=totNumPics){
        whichScreenSaver=0;
      }
    }

}

but that doesnt really work either because it needs the picture’s arrays inside the picLib declaration, which defeats the purpose of making it easily swapped around.

I hope this is understandable… this is just bits of the code… but the relevant parts. the whole thing is really super long… and Im kind of in a non working state right now.

any help is much appreciated.

You should be able to use something like this, although I don't have the time tonight to test it out.

unsigned long * piclist[] = {Spencer, Liz, Greg, Dani};

lol yea thanks just figured it out... using just that. pointers i guess. just learned something new.

Thanks!

Excuse me, but, arrays within arrays, IS the definition of multiple dimensional arrays.

Paul