I was loading my PNG background images for my game, but since JPG’s are much smaller I thought I would try with that, but that causes the app to vomit.
I added images via Projucer as binary then relaunched VS 2019.
The second parameter should be the int from the BinaryData BinaryData::space1_jpgSize instead of the sizeof. The reader needs to know the length of BinaryData::space1_jpg, and since it is binary and not a null terminated string, the system cannot deduce that value.
The benefit is, it will hold a shared copy of the image, so it doesn’t need to read the data again. That also saves the need for a member variable, you can simply call getFromMemory in the paint() routine without any slowdown.
Btw I got 10 images cycling through, changing at every completed game level, and when I get the next image, I stretch it to app size, which can be changed from within the app, and I do not want to use a switch or If in paint for 10 tests. So although your hint may work fine for just one background, I rather save a few CPU cycles in paint and not to do any condition tests.