29AnimatedAppComponent::AnimatedAppComponent()
36 jassert (0 < framesPerSecond && framesPerSecond < 1000);
41void AnimatedAppComponent::updateSync()
48 vBlankAttachment = {
this, [
this] { timerCallback(); } };
52 vBlankAttachment = {};
54 const auto interval = 1000 / framesPerSecond;
72void AnimatedAppComponent::timerCallback()
void setFramesPerSecond(int framesPerSecond)
Your subclass can call this to start a timer running which will call update() and repaint the compone...
int getMillisecondsSinceLastUpdate() const noexcept
When called from update(), this returns the number of milliseconds since the last update call.
void setSynchroniseToVBlank(bool syncToVBlank)
You can use this function to synchronise animation updates with the current display's vblank events.
virtual void update()=0
Called periodically, at the frequency specified by setFramesPerSecond().
void setOpaque(bool shouldBeOpaque)
Indicates whether any parts of the component might be transparent.
void repaint()
Marks the whole component as needing to be redrawn.
static Time JUCE_CALLTYPE getCurrentTime() noexcept
Returns a Time object that is set to the current system time.
void stopTimer() noexcept
Stops the timer.
int getTimerInterval() const noexcept
Returns the timer's interval.
void startTimer(int intervalInMilliseconds) noexcept
Starts the timer and sets the length of interval required.
bool isEmpty() const
Returns true for a default constructed object.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...