I need to add a background image to the UI. I did some research, and found two solutions,
(1) use projucer to add image as a binary data, then use ImageCache::getFromMemory
(2) use an external file, then ImageCache::getFromFile
It seems the method (1) is recommended. My problem is that I haven’t used the projucer to create or update the project file structure since first time exporting the project.
You can see my file structure in projucer is very clean.
Instead, I did all the file creation and some compilation directly in visual studio
I am afraid if now I add binary data using projucer, then exporting the project will remove all things that I modified using visual studio.
So what is the best practice? Can I make synchronise the project state in projucer and visual studio, and adding binarydata without changing the visual studio project config?
Best practice is to always use Projucer to manage the project. It can take a little bit to develop a nice flow with this, but it’s the only way to guarantee your project stays in sync on all platforms.
If you want to adopt this practice, then you will have to manually recreate the project in Projucer. It’s not too painful to add all the files, and assuming you recall any special compiler settings you may have set, then that should go quickly as well.
While you may only be developing Windows software at the moment, there may come a day when you want to produce a version for another OS (I am building for Windows, Mac, iOS, and Android), and you will enjoy how easy it is to simply generate the project files on the target and build.
Thanks, I added files in projucer and managed header, library paths, it works for the current project.
However, for packing the App to publish in Microsoft app store, I need to create another package project in the same solution.
Do you know how to do this in projucer? Can I create this package project in visual studio without being removed by projucer export each time?
I don’t know how to do this in projucer, but any manual changes you make to the VS project files will be overwritten by Projucer.
I can’t see any way to add other VS projects into the Projucer. Is it possible you could create a VS project that referred to the project created by the Projucer and the package project?
Alternatively you could explore the possibility of using cmake to see if that meets your needs.
Yes, it works. I can create a VS solution, then add both projucer project and package project!