diff options
| author | Crystalwarrior <varsash@gmail.com> | 2019-09-14 22:35:02 +0300 |
|---|---|---|
| committer | Crystalwarrior <varsash@gmail.com> | 2019-09-14 22:35:02 +0300 |
| commit | 938f1aeea15c6b68495bb1cb0a80467f4e8cf343 (patch) | |
| tree | e6fc806ed0360d8cb731acddc11faa00bb7c8bb2 /include | |
| parent | ab30cca586a05506c3cfb502cee53957409242e8 (diff) | |
Optimize the heck out of animated images. There is no lag after the image is loaded now.
HOWEVER, there's lag when the image is first loaded due to the aspect ratio and sizing (at least with .apng's).
Diffstat (limited to 'include')
| -rw-r--r-- | include/aocharmovie.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/aocharmovie.h b/include/aocharmovie.h index 65ab79fe..0921bc5f 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -6,6 +6,7 @@ #include <QTimer> #include <QDebug> #include <QImageReader> +#include <QElapsedTimer> class AOApplication; @@ -21,7 +22,8 @@ public: void play_talking(QString p_char, QString p_emote); void play_idle(QString p_char, QString p_emote); - void set_frame(QImage image); + QPixmap get_pixmap(QImage image); + void set_frame(QPixmap f_pixmap); void stop(); @@ -35,19 +37,22 @@ public: private: AOApplication *ao_app; - QImageReader *m_reader; + QVector<QPixmap> movie_frames; + QVector<int> movie_delays; QTimer *preanim_timer; QTimer *ticker; QString last_path; + QElapsedTimer actual_time; const int time_mod = 60; // These are the X and Y values before they are fixed based on the sprite's width. int x = 0; int y = 0; - bool m_flipped = false; + int frame = 0; + bool m_flipped = false; bool play_once = true; signals: |
