
Resolve an issue where if a preanim transitions into (a)idle it would get stuck on the first frame of that (removed the ticker->stop();)
69 lines
1.3 KiB
C++
69 lines
1.3 KiB
C++
#ifndef AOCHARMOVIE_H
|
|
#define AOCHARMOVIE_H
|
|
|
|
#include <QImageReader>
|
|
#include <QLabel>
|
|
#include <QTimer>
|
|
#include <QDebug>
|
|
#include <QImageReader>
|
|
#include <QElapsedTimer>
|
|
|
|
class AOApplication;
|
|
|
|
class AOCharMovie : public QLabel
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app);
|
|
|
|
void play(QString p_char, QString p_emote, QString emote_prefix);
|
|
void play_pre(QString p_char, QString p_emote, int duration);
|
|
void play_talking(QString p_char, QString p_emote);
|
|
void play_idle(QString p_char, QString p_emote);
|
|
|
|
QPixmap get_pixmap(QImage image);
|
|
void set_frame(QPixmap f_pixmap);
|
|
|
|
void stop();
|
|
|
|
void set_flipped(bool p_flipped) {m_flipped = p_flipped;}
|
|
|
|
void move(int ax, int ay);
|
|
|
|
void combo_resize(int w, int h);
|
|
|
|
|
|
private:
|
|
AOApplication *ao_app;
|
|
|
|
QVector<QPixmap> movie_frames;
|
|
QVector<int> movie_delays;
|
|
QTimer *preanim_timer;
|
|
QTimer *ticker;
|
|
QString last_path;
|
|
QImageReader *m_reader = new QImageReader();
|
|
|
|
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;
|
|
|
|
int frame = 0;
|
|
int max_frames = 0;
|
|
|
|
bool m_flipped = false;
|
|
bool play_once = true;
|
|
|
|
signals:
|
|
void done();
|
|
|
|
private slots:
|
|
void preanim_done();
|
|
void movie_ticker();
|
|
};
|
|
|
|
#endif // AOCHARMOVIE_H
|