I’m currently using the binary png method to implement my GUI background. now I am trying to achieve animating the background by making the background png change when hover over different dials
void TokyoRe_verbAudioProcessorEditor::paint (Graphics& g)
{
Image background = ImageCache::getFromMemory(BinaryData::Animation1_png, BinaryData::Animation1_pngSize);
g.drawImageAt(background, 0, 0);
}
I have swapped to using a struct class in my Editor.h to be able to implement the mouseEvent function along side the GUI png (paint::Graphics &g) draw function
struct AnimatedComponent : public Component
{
void paint(Graphics&) override;
Image AnimationOne = ImageCache::getFromMemory(BinaryData::Animation1_png, BinaryData::Animation1_pngSize);
Image AnimationTwo = ImageCache::getFromMemory(BinaryData::Animation2_png, BinaryData::Animation2_pngSize);
Image AnimationThree = ImageCache::getFromMemory(BinaryData::Animation3_png, BinaryData::Animation3_pngSize);
Image AnimationFour = ImageCache::getFromMemory(BinaryData::Animation4_png, BinaryData::Animation4_pngSize);
void mouseEnter(const MouseEvent& e) override;
void mouseExit(const MouseEvent& e) override;
};
Below is the part in the Editor.cpp that calls the struct class and draws the Background Image with the mouseEvent
void AnimatedComponent::paint(juce::Graphics &g)
{
/g.setColour(Colours::blue);
g.drawEllipse(getWidth() - 113, 80, 80, 80, 3);
Draws the image at set bounds
g.drawImageAt(AnimationOne, 0, 0);
}
void AnimatedComponent::mouseExit(const juce::MouseEvent &e)
{
-> undefined g gdrawImageAt(AnimationOne, 0, 0);
Image Comp = AnimationOne;
repaint();
DBG("blaExit");
}
void AnimatedComponent::mouseEnter(const juce::MouseEvent &e)
{
/g.drawImageAt(AnimationTwo, 0, 0);
Image Comp = AnimationTwo;
repaint();
DBG("blaEnter");
}
is there anyway for me to add (paint::Graphics &g) to the void AnimatedComponent::MouseEvent?
I’m really new to coding and would appreciate some help cracking this Thanks!