diff options
| author | Crystalwarrior <varsash@gmail.com> | 2019-09-15 17:44:02 +0300 |
|---|---|---|
| committer | Crystalwarrior <varsash@gmail.com> | 2019-09-15 17:44:02 +0300 |
| commit | a2f9df4042585ab0849b54e2bb0b9699f9064aed (patch) | |
| tree | e2ae5b98111959c75232ab24b9f909b742658e9c /src/aomovie.cpp | |
| parent | 4db114007456f12c77f002cac4e26cd3f6917638 (diff) | |
Finally implement frame-specific effects such as screenshake, realization flash, sound effects, etc.
Fix screenshake animation modifying the default positions of shook elements
Fix aomovie sometimes not playing the last frame and causing lagspikes due to the delay() method
Diffstat (limited to 'src/aomovie.cpp')
| -rw-r--r-- | src/aomovie.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 851ae570..7f7fb205 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -13,6 +13,7 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) this->setMovie(m_movie); timer = new QTimer(this); + timer->setTimerType(Qt::PreciseTimer); timer->setSingleShot(true); connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); @@ -24,11 +25,6 @@ void AOMovie::set_play_once(bool p_play_once) play_once = p_play_once; } -void AOMovie::start_timer(int delay) -{ - timer->start(delay); -} - void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int duration) { m_movie->stop(); @@ -65,7 +61,7 @@ void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int this->show(); m_movie->start(); if (m_movie->frameCount() == 0 && duration > 0) - this->start_timer(duration); + timer->start(duration); } void AOMovie::stop() @@ -81,17 +77,13 @@ void AOMovie::frame_change(int n_frame) if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) || !play_once) return; //we need this or else the last frame wont show - delay(m_movie->nextFrameDelay()); - - this->stop(); - - //signal connected to courtroom object, let it figure out what to do - done(); + timer->start(m_movie->nextFrameDelay()); } void AOMovie::timer_done() { this->stop(); + //signal connected to courtroom object, let it figure out what to do done(); } |
