mirror of https://github.com/mgba-emu/mgba.git
Add screenshot support
This commit is contained in:
parent
9efd8f2452
commit
23592af3cc
|
@ -64,6 +64,14 @@ void Display::forceDraw() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_PNG
|
||||||
|
void Display::screenshot() {
|
||||||
|
GBAThreadInterrupt(m_context);
|
||||||
|
GBAThreadTakeScreenshot(m_context);
|
||||||
|
GBAThreadContinue(m_context);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Display::initializeGL() {
|
void Display::initializeGL() {
|
||||||
glClearColor(0, 0, 0, 0);
|
glClearColor(0, 0, 0, 0);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
|
@ -20,6 +20,9 @@ public slots:
|
||||||
void startDrawing(const uint32_t* buffer, GBAThread* context);
|
void startDrawing(const uint32_t* buffer, GBAThread* context);
|
||||||
void stopDrawing();
|
void stopDrawing();
|
||||||
void forceDraw();
|
void forceDraw();
|
||||||
|
#ifdef USE_PNG
|
||||||
|
void screenshot();
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initializeGL() override;
|
virtual void initializeGL() override;
|
||||||
|
|
|
@ -241,6 +241,16 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
menubar->clear();
|
menubar->clear();
|
||||||
QMenu* fileMenu = menubar->addMenu(tr("&File"));
|
QMenu* fileMenu = menubar->addMenu(tr("&File"));
|
||||||
fileMenu->addAction(tr("Load &ROM..."), this, SLOT(selectROM()), QKeySequence::Open);
|
fileMenu->addAction(tr("Load &ROM..."), this, SLOT(selectROM()), QKeySequence::Open);
|
||||||
|
fileMenu->addSeparator();
|
||||||
|
|
||||||
|
#ifdef USE_PNG
|
||||||
|
QAction* screenshot = new QAction(tr("Take &screenshot"), fileMenu);
|
||||||
|
screenshot->setShortcut(tr("F12"));
|
||||||
|
connect(screenshot, SIGNAL(triggered()), m_display, SLOT(screenshot()));
|
||||||
|
m_gameActions.append(screenshot);
|
||||||
|
fileMenu->addAction(screenshot);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
fileMenu->addAction(tr("E&xit"), this, SLOT(close()), QKeySequence::Quit);
|
fileMenu->addAction(tr("E&xit"), this, SLOT(close()), QKeySequence::Quit);
|
||||||
|
|
Loading…
Reference in New Issue