FIXED External background image Juce 6 (skin)

Hi everyone,
i try to update a juce 5 project to the version 6, and i am facing some basic problems.
Basically, i have a single background image that is located in a sub-folder (/ui), as i want to be able to modify the image externally (themed skin).

my old code looks like this:
in PluginEditor.cpp:
File bgImageFile = File::getCurrentWorkingDirectory().getChildFile("./ui/myBG.png");
background = ImageCache::getFromFile(bgImageFile);

and then:
g.drawImageAt(background, 0, 0);

in PluginEditor.h: (in private)
Image background;

Right, this code works perfectly, as i can open this plugin made with juce 5 and see the background image :slight_smile:
Now, i am trying to do the same with juce 6, and i got a lot of errors…
“Image” doesnt work the same way ?

What errors did you get? For all we know it could have absolutely nothing to do with the code sample your provided!

1 Like

It seems the using namespace juce missing in juce 6 by default might be the culprit here

1 Like

like “Image” is not defined ! etc… :frowning:

I think @kunitoki already gave the answer. Since JUCE 6 you need to prefix all classes provided by JUCE with the juce:: namespace, so Image should become juce::Image. In JUCE 5 you manually had to enable this behaviour, with JUCE 6 you have to manually disable this behaviour if you don’t want that.

thanks a lot @kunitoki and @PluginPenguin ! yes, that is the thing, now, it compiles correctly and i can see my background ! i just switched from juce5 a couple of days ago.