all repos — mgba @ a6f5bbbeb9f8a20d66cd325b27a97d73ce832175

mGBA Game Boy Advance Emulator

Redo background texturing
Jeffrey Pfau jeffrey@endrift.com
Fri, 17 Oct 2014 00:53:34 -0700
commit

a6f5bbbeb9f8a20d66cd325b27a97d73ce832175

parent

b74a5a529329465df05ba6f0bf558ddb0f88739e

3 files changed, 14 insertions(+), 11 deletions(-)

jump to
M src/platform/qt/LoadSaveState.cppsrc/platform/qt/LoadSaveState.cpp

@@ -20,9 +20,6 @@ , m_currentFocus(0)

{ m_ui.setupUi(this); - QImage currentImage(reinterpret_cast<const uchar*>(controller->drawContext()), VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, 1024, QImage::Format_RGB32); - m_currentImage.convertFromImage(currentImage.rgbSwapped()); - m_slots[0] = m_ui.state1; m_slots[1] = m_ui.state2; m_slots[2] = m_ui.state3;
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -18,7 +18,7 @@ Window::Window(QWidget* parent)

: QMainWindow(parent) , m_logView(new LogView()) , m_stateWindow(nullptr) - , m_screenWidget(new QWidget()) + , m_screenWidget(new QLabel()) #ifdef USE_GDB_STUB , m_gdbController(nullptr) #endif

@@ -29,8 +29,11 @@ QGLFormat format(QGLFormat(QGL::Rgba | QGL::DoubleBuffer));

format.setSwapInterval(1); m_screenWidget->setLayout(new QStackedLayout()); m_screenWidget->layout()->setContentsMargins(0, 0, 0, 0); + m_screenWidget->setScaledContents(true); setCentralWidget(m_screenWidget); m_display = new Display(format); + m_screenWidget->setMinimumSize(m_display->minimumSize()); + m_screenWidget->setSizePolicy(m_display->sizePolicy()); attachWidget(m_display); connect(m_controller, SIGNAL(gameStarted(GBAThread*)), this, SLOT(gameStarted(GBAThread*))); connect(m_controller, SIGNAL(gameStopped(GBAThread*)), m_display, SLOT(stopDrawing()));

@@ -179,11 +182,7 @@ connect(m_stateWindow, &LoadSaveState::closed, [this]() { m_controller->setPaused(false); });

} m_stateWindow->setAttribute(Qt::WA_DeleteOnClose); m_stateWindow->setMode(ls); - if (isFullScreen()) { - attachWidget(m_stateWindow); - } else { - m_stateWindow->show(); - } + attachWidget(m_stateWindow); } void Window::setupMenu(QMenuBar* menubar) {

@@ -240,7 +239,14 @@ pause->setChecked(false);

pause->setCheckable(true); pause->setShortcut(tr("Ctrl+P")); connect(pause, SIGNAL(triggered(bool)), m_controller, SLOT(setPaused(bool))); - connect(m_controller, &GameController::gamePaused, [pause]() { pause->setChecked(true); }); + connect(m_controller, &GameController::gamePaused, [this, pause]() { + pause->setChecked(true); + + QImage currentImage(reinterpret_cast<const uchar*>(m_controller->drawContext()), VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, 1024, QImage::Format_RGB32); + QPixmap pixmap; + pixmap.convertFromImage(currentImage.rgbSwapped()); + m_screenWidget->setPixmap(pixmap); + }); connect(m_controller, &GameController::gameUnpaused, [pause]() { pause->setChecked(false); }); m_gameActions.append(pause); emulationMenu->addAction(pause);
M src/platform/qt/Window.hsrc/platform/qt/Window.h

@@ -64,7 +64,7 @@ Display* m_display;

QList<QAction*> m_gameActions; LogView* m_logView; LoadSaveState* m_stateWindow; - QWidget* m_screenWidget; + QLabel* m_screenWidget; #ifdef USE_GDB_STUB GDBController* m_gdbController;