How to add binary resources

Hi Everyone,

I'm new to Juce and trying to figure out how to add a .png file as a binary resource. As far as I've been able to tell reading the forum. I should be able to just add the png to the introjucer project, make sure that the Add to Binary Resources box is checked and then the binary resource file should be automatically added to the project. I'm assuming I'm missing some steps as this is not happening for me.

I'm using Introjucer v3.2.0.0 and have taken the following steps to try and create the png binary resource:

  • Right click to select "Add Existing Files"
  • Selected a .png file
  • Made sure that the "Add to Binary Resources" option is ticked 

Not sure what else I should do, but I'm probably missing something obviouse. Any help would be much appreciated.

Thanks,

Matt

1 Like

Maybe you're misunderstanding what we mean by "binary resources"?

The introjucer generates a class called BinaryData that contains the data for all these files - if you grep the demos and codebase for "BinaryData::" you'll see numerous examples of using it.

Thanks for the reply.

I've found the source of my confusion. Firstly the BinaryData files are only created upon saving the Introjucer project - a step I was unaware of. Also the files are added to the JuceLibraryCode folder, but don't show up in the Introjucer anywhere as far as I can tell and there are no includes added to any of the source files. This all makes the files pretty well hidden for a newb such as myself.

Now that I know where the files are I'm good to go.

Cheers,

Matt

 

You don't need to include the data files explicitly, the JuceHeader.h that the introjucer generates will already take care of that for you.

Thanks for the replies and help on this, Jules. Much appreciated