int main(int argc, char *argv[]){
while((++argv)[0]){
if(argv[0][0] == '-')
switch (argv[0][1]) {
default: //wrong command
printf("Command Unknown, type -help for a list of commands.\n");
break;
case'h': //help
printf("help is on the way\n");
break;
case't': //testCommand
printf("test\n");
test();
break;
}
}
return 0;
}
wild guess, because you give us so little to work
RGBMatrix uses dynamic allocation and you failed to provide a proper copy constructor, assignment operator and destructor
also while((++argv)[0])
iirc, the last element of the array is a NULL pointer, not a null string
however, that's a moot point, use argc dammit
Your error is looping up to width * 3 when you are also multiplying the index j by 3. Just loop up to width:
1 2 3 4 5 6 7 8 9 10 11 12
// You might want to introduce a couple of typedefs:
using byte = unsignedchar;
using uint = unsignedint;
void RGBMatrix::Fill(byte Red, byte Green, byte Blue){
for (uint i = 0; i < height; i++)
for (uint j = 0; j < width; j++) {
matrix[i][j*3] = Red;
matrix[i][j*3+1] = Green;
matrix[i][j*3+2] = Blue;
}
}
You should also have a constructor for the matrix that sets the width and height to 0 and the pointer to nullptr. And your ModifySize function should delete the previous matrix if the pointer isn't nullptr.