mirror of https://github.com/mgba-emu/mgba.git
Qt: Redraw screen when a status message is posted
This commit is contained in:
parent
03f166509f
commit
6ae001037d
|
@ -72,6 +72,9 @@ void Display::filter(bool filter) {
|
|||
|
||||
void Display::showMessage(const QString& message) {
|
||||
m_messagePainter.showMessage(message);
|
||||
if (!isDrawing()) {
|
||||
forceDraw();
|
||||
}
|
||||
}
|
||||
|
||||
void Display::mouseMoveEvent(QMouseEvent*) {
|
||||
|
|
|
@ -33,6 +33,8 @@ public:
|
|||
bool isAspectRatioLocked() const { return m_lockAspectRatio; }
|
||||
bool isFiltered() const { return m_filter; }
|
||||
|
||||
virtual bool isDrawing() const = 0;
|
||||
|
||||
signals:
|
||||
void showCursor();
|
||||
void hideCursor();
|
||||
|
|
|
@ -16,6 +16,7 @@ using namespace QGBA;
|
|||
|
||||
DisplayGL::DisplayGL(const QGLFormat& format, QWidget* parent)
|
||||
: Display(parent)
|
||||
, m_isDrawing(false)
|
||||
, m_gl(new EmptyGLWidget(format, this))
|
||||
, m_painter(new PainterGL(m_gl))
|
||||
, m_drawThread(nullptr)
|
||||
|
@ -33,6 +34,7 @@ void DisplayGL::startDrawing(GBAThread* thread) {
|
|||
if (m_drawThread) {
|
||||
return;
|
||||
}
|
||||
m_isDrawing = true;
|
||||
m_painter->setContext(thread);
|
||||
m_painter->setMessagePainter(messagePainter());
|
||||
m_context = thread;
|
||||
|
@ -55,6 +57,7 @@ void DisplayGL::startDrawing(GBAThread* thread) {
|
|||
|
||||
void DisplayGL::stopDrawing() {
|
||||
if (m_drawThread) {
|
||||
m_isDrawing = false;
|
||||
if (GBAThreadIsActive(m_context)) {
|
||||
GBAThreadInterrupt(m_context);
|
||||
}
|
||||
|
@ -69,6 +72,7 @@ void DisplayGL::stopDrawing() {
|
|||
|
||||
void DisplayGL::pauseDrawing() {
|
||||
if (m_drawThread) {
|
||||
m_isDrawing = false;
|
||||
if (GBAThreadIsActive(m_context)) {
|
||||
GBAThreadInterrupt(m_context);
|
||||
}
|
||||
|
@ -81,6 +85,7 @@ void DisplayGL::pauseDrawing() {
|
|||
|
||||
void DisplayGL::unpauseDrawing() {
|
||||
if (m_drawThread) {
|
||||
m_isDrawing = true;
|
||||
if (GBAThreadIsActive(m_context)) {
|
||||
GBAThreadInterrupt(m_context);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@ public:
|
|||
DisplayGL(const QGLFormat& format, QWidget* parent = nullptr);
|
||||
~DisplayGL();
|
||||
|
||||
bool isDrawing() const override { return m_isDrawing; }
|
||||
|
||||
public slots:
|
||||
void startDrawing(GBAThread* context) override;
|
||||
void stopDrawing() override;
|
||||
|
@ -60,6 +62,7 @@ protected:
|
|||
private:
|
||||
void resizePainter();
|
||||
|
||||
bool m_isDrawing;
|
||||
QGLWidget* m_gl;
|
||||
PainterGL* m_painter;
|
||||
QThread* m_drawThread;
|
||||
|
|
|
@ -15,11 +15,13 @@ using namespace QGBA;
|
|||
|
||||
DisplayQt::DisplayQt(QWidget* parent)
|
||||
: Display(parent)
|
||||
, m_isDrawing(false)
|
||||
, m_backing(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void DisplayQt::startDrawing(GBAThread*) {
|
||||
m_isDrawing = true;
|
||||
}
|
||||
|
||||
void DisplayQt::lockAspectRatio(bool lock) {
|
||||
|
|
|
@ -21,11 +21,13 @@ Q_OBJECT
|
|||
public:
|
||||
DisplayQt(QWidget* parent = nullptr);
|
||||
|
||||
bool isDrawing() const override { return m_isDrawing; }
|
||||
|
||||
public slots:
|
||||
void startDrawing(GBAThread* context) override;
|
||||
void stopDrawing() override {}
|
||||
void pauseDrawing() override {}
|
||||
void unpauseDrawing() override {}
|
||||
void stopDrawing() override { m_isDrawing = false; }
|
||||
void pauseDrawing() override { m_isDrawing = false; }
|
||||
void unpauseDrawing() override { m_isDrawing = true; }
|
||||
void forceDraw() override { update(); }
|
||||
void lockAspectRatio(bool lock) override;
|
||||
void filter(bool filter) override;
|
||||
|
@ -35,6 +37,7 @@ protected:
|
|||
virtual void paintEvent(QPaintEvent*) override;
|
||||
|
||||
private:
|
||||
bool m_isDrawing;
|
||||
QImage m_backing;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue