JUCE v8.0.9
JUCE API
 
Loading...
Searching...
No Matches
juce::VBlankAnimatorUpdater Class Reference

Similar to AnimatorUpdater, but automatically calls update() whenever the screen refreshes. More...

#include <juce_VBlankAnimatorUpdater.h>

Inheritance diagram for juce::VBlankAnimatorUpdater:
Collaboration diagram for juce::VBlankAnimatorUpdater:

Public Member Functions

 VBlankAnimatorUpdater (Component *c)
 Constructs a VBlankAnimatorUpdater that is synchronised to the refresh rate of the monitor that the provided Component is being displayed on.
 
void addAnimator (const Animator &animator)
 Registers an Animator with the updater.
 
void addAnimator (const Animator &animator, std::function< void()> onComplete)
 Registers an Animator with the updater and specifies a callback to be called upon the completion of the Animator.
 
void removeAnimator (const Animator &animator)
 Removes an Animator.
 

Private Member Functions

void update ()
 Calls Animator::update() for all registered Animators that are still alive.
 
void update (double timestampMs)
 Calls Animator::update() for all registered Animators that are still alive.
 

Private Attributes

std::map< void *, Entryanimators
 
std::map< void *, Entry >::iterator currentIterator
 
bool iteratorServiced = false
 
bool reentrancyGuard = false
 
VBlankAttachment vBlankAttachment
 

Detailed Description

Similar to AnimatorUpdater, but automatically calls update() whenever the screen refreshes.

@tags{Animations}

Constructor & Destructor Documentation

◆ VBlankAnimatorUpdater()

juce::VBlankAnimatorUpdater::VBlankAnimatorUpdater ( Component c)
inlineexplicit

Constructs a VBlankAnimatorUpdater that is synchronised to the refresh rate of the monitor that the provided Component is being displayed on.

Member Function Documentation

◆ addAnimator() [1/2]

void juce::AnimatorUpdater::addAnimator ( const Animator animator)

Registers an Animator with the updater.

◆ addAnimator() [2/2]

void juce::AnimatorUpdater::addAnimator ( const Animator animator,
std::function< void()>  onComplete 
)

Registers an Animator with the updater and specifies a callback to be called upon the completion of the Animator.

This callback can be used for cleanup purposes e.g.

animatorUpdater.addAnimator (someComponentPtr->getAnimator(),
[&someComponentPtr] { someComponentPtr.reset(); });

◆ removeAnimator()

void juce::AnimatorUpdater::removeAnimator ( const Animator animator)

Removes an Animator.

◆ update() [1/2]

void juce::AnimatorUpdater::update ( )
inherited

Calls Animator::update() for all registered Animators that are still alive.

References to deleted Animators are removed.

Uses Time::getMillisecondCounterHiRes() to calculate the necessary timestamp. Consider using a VBlankAnimatorUpdater instead for using timestamps that are synchronised across all VBlankAnimatorUpdater instances.

◆ update() [2/2]

void juce::AnimatorUpdater::update ( double  timestampMs)
inherited

Calls Animator::update() for all registered Animators that are still alive.

References to deleted Animators are removed.

The supplied timestamp should be monotonically increasing for correct behaviour. Ideally this should be a timestamp supplied by a VBlankAttachment. Consider using the VBlankAnimatorUpdater class, which takes care of supplying the right timestamp.

See also
VBlankAnimatorUpdater

Member Data Documentation

◆ animators

std::map<void*, Entry> juce::AnimatorUpdater::animators
privateinherited

◆ currentIterator

std::map<void*,Entry>::iterator juce::AnimatorUpdater::currentIterator
privateinherited

◆ iteratorServiced

bool juce::AnimatorUpdater::iteratorServiced = false
privateinherited

◆ reentrancyGuard

bool juce::AnimatorUpdater::reentrancyGuard = false
privateinherited

◆ vBlankAttachment

VBlankAttachment juce::VBlankAnimatorUpdater::vBlankAttachment
private

The documentation for this class was generated from the following file: