mirror of https://github.com/mgba-emu/mgba.git
Qt: Move display attaching code
This commit is contained in:
parent
0208c7456a
commit
4de01a4576
|
@ -80,6 +80,17 @@ Display::Display(QWidget* parent)
|
|||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
void Display::attach(std::shared_ptr<CoreController> controller) {
|
||||
connect(controller.get(), &CoreController::stateLoaded, this, &Display::resizeContext);
|
||||
connect(controller.get(), &CoreController::stateLoaded, this, &Display::forceDraw);
|
||||
connect(controller.get(), &CoreController::rewound, this, &Display::forceDraw);
|
||||
connect(controller.get(), &CoreController::paused, this, &Display::pauseDrawing);
|
||||
connect(controller.get(), &CoreController::unpaused, this, &Display::unpauseDrawing);
|
||||
connect(controller.get(), &CoreController::frameAvailable, this, &Display::framePosted);
|
||||
connect(controller.get(), &CoreController::statusPosted, this, &Display::showMessage);
|
||||
connect(controller.get(), &CoreController::didReset, this, &Display::resizeContext);
|
||||
}
|
||||
|
||||
void Display::resizeEvent(QResizeEvent*) {
|
||||
m_messagePainter.resize(size(), m_lockAspectRatio, devicePixelRatio());
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
bool isFiltered() const { return m_filter; }
|
||||
bool isShowOSD() const { return m_showOSD; }
|
||||
|
||||
void attach(std::shared_ptr<CoreController>);
|
||||
virtual void startDrawing(std::shared_ptr<CoreController>) = 0;
|
||||
virtual bool isDrawing() const = 0;
|
||||
virtual bool supportsShaders() const = 0;
|
||||
|
|
|
@ -1960,14 +1960,7 @@ void Window::setController(CoreController* controller, const QString& fname) {
|
|||
}
|
||||
|
||||
void Window::attachDisplay() {
|
||||
connect(m_controller.get(), &CoreController::stateLoaded, m_display.get(), &Display::resizeContext);
|
||||
connect(m_controller.get(), &CoreController::stateLoaded, m_display.get(), &Display::forceDraw);
|
||||
connect(m_controller.get(), &CoreController::rewound, m_display.get(), &Display::forceDraw);
|
||||
connect(m_controller.get(), &CoreController::paused, m_display.get(), &Display::pauseDrawing);
|
||||
connect(m_controller.get(), &CoreController::unpaused, m_display.get(), &Display::unpauseDrawing);
|
||||
connect(m_controller.get(), &CoreController::frameAvailable, m_display.get(), &Display::framePosted);
|
||||
connect(m_controller.get(), &CoreController::statusPosted, m_display.get(), &Display::showMessage);
|
||||
connect(m_controller.get(), &CoreController::didReset, m_display.get(), &Display::resizeContext);
|
||||
m_display->attach(m_controller);
|
||||
connect(m_display.get(), &Display::drawingStarted, this, &Window::changeRenderer);
|
||||
m_display->startDrawing(m_controller);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue