Helper class to synchronise Component updates to the vertical blank event of the display that the Component is presented on.
More...
#include <juce_VBlankAttachment.h>
Helper class to synchronise Component updates to the vertical blank event of the display that the Component is presented on.
This is useful when animating the Component's contents.
@tags{Animations}
◆ VBlankAttachment() [1/4]
| juce::VBlankAttachment::VBlankAttachment |
( |
| ) |
|
|
default |
Default constructor for creating an empty object.
◆ VBlankAttachment() [2/4]
| juce::VBlankAttachment::VBlankAttachment |
( |
Component * |
c, |
|
|
std::function< void()> |
callbackIn |
|
) |
| |
Constructor.
Creates an attachment that will call the passed in function at every vertical blank event of the display that the passed in Component is currently visible on.
The Component must be valid for the entire lifetime of the VBlankAttachment.
You should prefer the other constructor, where the callback also receives a timestamp parameter. This constructor is only provided for compatibility with the earlier JUCE implementation.
◆ VBlankAttachment() [3/4]
| juce::VBlankAttachment::VBlankAttachment |
( |
Component * |
c, |
|
|
std::function< void(double)> |
callbackIn |
|
) |
| |
Constructor.
Creates an attachment that will call the passed in function at every vertical blank event of the display that the passed in Component is currently visible on.
The Component must be valid for the entire lifetime of the VBlankAttachment.
The provided callback is called with a monotonically increasing value expressed in seconds that corresponds to the time of the next frame to be presented. Use this value to synchronise drawing across all classes using a VBlankAttachment.
◆ VBlankAttachment() [4/4]
◆ ~VBlankAttachment()
| juce::VBlankAttachment::~VBlankAttachment |
( |
| ) |
|
|
override |
◆ cleanup()
| void juce::VBlankAttachment::cleanup |
( |
| ) |
|
|
private |
◆ componentBeingDeleted()
| virtual void juce::ComponentListener::componentBeingDeleted |
( |
Component & |
component | ) |
|
|
virtualinherited |
Called when the component is in the process of being deleted.
This callback is made from inside the destructor, so be very, very cautious about what you do in here.
In particular, bear in mind that it's the Component base class's destructor that calls this - so if the object that's being deleted is a subclass of Component, then the subclass layers of the object will already have been destructed when it gets to this point!
- Parameters
-
| component | the component that was deleted |
Reimplemented in juce::ComponentMovementWatcher, and juce::RelativeCoordinatePositionerBase.
◆ componentBroughtToFront()
| virtual void juce::ComponentListener::componentBroughtToFront |
( |
Component & |
component | ) |
|
|
virtualinherited |
◆ componentChildrenChanged()
| virtual void juce::ComponentListener::componentChildrenChanged |
( |
Component & |
component | ) |
|
|
virtualinherited |
◆ componentEnablementChanged()
| virtual void juce::ComponentListener::componentEnablementChanged |
( |
Component & |
component | ) |
|
|
virtualinherited |
◆ componentMovedOrResized()
| virtual void juce::ComponentListener::componentMovedOrResized |
( |
Component & |
component, |
|
|
bool |
wasMoved, |
|
|
bool |
wasResized |
|
) |
| |
|
virtualinherited |
Called when the component's position or size changes.
- Parameters
-
| component | the component that was moved or resized |
| wasMoved | true if the component's top-left corner has just moved |
| wasResized | true if the component's width or height has just changed |
- See also
- Component::setBounds, Component::resized, Component::moved
Reimplemented in juce::ComponentMovementWatcher, juce::SidePanel, juce::Viewport, juce::Label, juce::NativeScaleFactorNotifier, juce::PeerListener, juce::AudioProcessorEditor::AudioProcessorEditorListener, juce::StandaloneFilterWindow::MainContentComponent, juce::DropShadower, juce::FocusOutline, and juce::RelativeCoordinatePositionerBase.
◆ componentNameChanged()
| virtual void juce::ComponentListener::componentNameChanged |
( |
Component & |
component | ) |
|
|
virtualinherited |
◆ componentParentHierarchyChanged()
| void juce::VBlankAttachment::componentParentHierarchyChanged |
( |
Component & |
component | ) |
|
|
overrideprivatevirtual |
Called to indicate that the component's parents have changed.
When a component is added or removed from its parent, all of its children will produce this notification (recursively - so all children of its children will also be called as well).
- Parameters
-
| component | the component that this listener is registered with |
- See also
- Component::parentHierarchyChanged
Reimplemented from juce::ComponentListener.
◆ componentVisibilityChanged()
| virtual void juce::ComponentListener::componentVisibilityChanged |
( |
Component & |
component | ) |
|
|
virtualinherited |
◆ isEmpty()
| bool juce::VBlankAttachment::isEmpty |
( |
| ) |
const |
|
inline |
Returns true for a default constructed object.
◆ onVBlank()
| void juce::VBlankAttachment::onVBlank |
( |
double |
timestampSec | ) |
|
|
overrideprivatevirtual |
Called on every vertical blank of the display to which the peer is associated.
The timestampSec parameter is a monotonically increasing value expressed in seconds that corresponds to the time at which the next frame will be displayed.
Implements juce::ComponentPeer::VBlankListener.
◆ operator=()
◆ updateOwner()
| void juce::VBlankAttachment::updateOwner |
( |
| ) |
|
|
private |
◆ updatePeer()
| void juce::VBlankAttachment::updatePeer |
( |
| ) |
|
|
private |
◆ callback
| std::function<void (double)> juce::VBlankAttachment::callback |
|
private |
◆ lastOwner
| Component* juce::VBlankAttachment::lastOwner = nullptr |
|
private |
◆ lastPeer
◆ owner
| Component* juce::VBlankAttachment::owner = nullptr |
|
private |
The documentation for this class was generated from the following file: