all repos — mgba @ 3c9433b74ca1203003481b4f142010b240599375

mGBA Game Boy Advance Emulator

src/platform/qt/Display.h (view raw)

 1/* Copyright (c) 2013-2015 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef QGBA_DISPLAY
 7#define QGBA_DISPLAY
 8
 9#include <QWidget>
10
11#include "MessagePainter.h"
12
13struct GBAThread;
14
15namespace QGBA {
16
17class Display : public QWidget {
18Q_OBJECT
19
20public:
21	enum class Driver {
22		QT = 0,
23#ifdef BUILD_GL
24		OPENGL = 1,
25#endif
26	};
27
28	Display(QWidget* parent = nullptr);
29
30	static Display* create(QWidget* parent = nullptr);
31	static void setDriver(Driver driver) { s_driver = driver; }
32
33	bool isAspectRatioLocked() const { return m_lockAspectRatio; }
34	bool isFiltered() const { return m_filter; }
35
36public slots:
37	virtual void startDrawing(GBAThread* context) = 0;
38	virtual void stopDrawing() = 0;
39	virtual void pauseDrawing() = 0;
40	virtual void unpauseDrawing() = 0;
41	virtual void forceDraw() = 0;
42	virtual void lockAspectRatio(bool lock);
43	virtual void filter(bool filter);
44	virtual void framePosted(const uint32_t*) = 0;
45
46	void showMessage(const QString& message);
47
48protected:
49	void resizeEvent(QResizeEvent*);
50
51	MessagePainter* messagePainter() { return &m_messagePainter; }
52
53private:
54	static Driver s_driver;
55
56	MessagePainter m_messagePainter;
57	bool m_lockAspectRatio;
58	bool m_filter;
59};
60
61}
62
63#endif