mirror of
https://github.com/simple64/simple64.git
synced 2026-11-13 19:08:42 +01:00
update gui
This commit is contained in:
1 parent
86a13b136c
commit
29fcc02883
5 files changed
+31
-1
No files matched your search
@@ -406,6 +406,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
}
|
||||
|
||||
setupDiscord();
|
||||
FPSLabel = new QLabel(this);
|
||||
statusBar()->addPermanentWidget(FPSLabel);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -676,6 +678,10 @@ void MainWindow::createVkWindow(QVulkanInstance* vulkan_inst)
|
||||
|
||||
my_window->installEventFilter(&keyPressFilter);
|
||||
this->installEventFilter(&keyPressFilter);
|
||||
frame_timer = new QTimer(this);
|
||||
connect(frame_timer, &QTimer::timeout, this, &MainWindow::updateFrameCount);
|
||||
frame_timer->start(1000);
|
||||
frame_count = 0;
|
||||
}
|
||||
|
||||
void MainWindow::deleteVkWindow()
|
||||
@@ -683,6 +689,9 @@ void MainWindow::deleteVkWindow()
|
||||
QWidget *container = new QWidget(this);
|
||||
setCentralWidget(container);
|
||||
delete my_window;
|
||||
frame_timer->stop();
|
||||
frame_timer->deleteLater();
|
||||
FPSLabel->clear();
|
||||
}
|
||||
|
||||
void MainWindow::stopGame()
|
||||
@@ -1152,3 +1161,15 @@ m64p_dynlib_handle MainWindow::getCoreLib()
|
||||
{
|
||||
return coreLib;
|
||||
}
|
||||
|
||||
void MainWindow::addFrameCount()
|
||||
{
|
||||
++frame_count;
|
||||
}
|
||||
|
||||
void MainWindow::updateFrameCount()
|
||||
{
|
||||
QString FPS = QString("%1 FPS").arg(frame_count);
|
||||
FPSLabel->setText(FPS);
|
||||
frame_count = 0;
|
||||
}
|
||||
@@ -67,8 +67,11 @@ public slots:
|
||||
void showMessage(QString message);
|
||||
void updateDiscordActivity(struct DiscordActivity activity);
|
||||
void clearDiscordActivity();
|
||||
void addFrameCount();
|
||||
|
||||
private slots:
|
||||
void updateFrameCount();
|
||||
|
||||
void discordCallback();
|
||||
|
||||
void updateDownloadFinished(QNetworkReply *reply);
|
||||
@@ -136,6 +139,7 @@ private:
|
||||
QMenu * OpenRecent;
|
||||
int verbose;
|
||||
int nogui;
|
||||
uint32_t frame_count;
|
||||
|
||||
QMessageBox *download_message = nullptr;
|
||||
VkWindow *my_window = nullptr;
|
||||
@@ -143,6 +147,8 @@ private:
|
||||
LogViewer logViewer;
|
||||
QSettings *settings = nullptr;
|
||||
KeyPressFilter keyPressFilter;
|
||||
QTimer *frame_timer = nullptr;
|
||||
QLabel *FPSLabel = nullptr;
|
||||
|
||||
m64p_dynlib_handle coreLib;
|
||||
m64p_dynlib_handle rspPlugin;
|
||||
|
||||
@@ -77,7 +77,8 @@ m64p_error qtVidExtFuncGLGetAttr(m64p_GLattr, int*)
|
||||
|
||||
m64p_error qtVidExtFuncGLSwapBuf(void)
|
||||
{
|
||||
return M64ERR_UNSUPPORTED;
|
||||
w->getWorkerThread()->addFrameCount();
|
||||
return M64ERR_SUCCESS;
|
||||
}
|
||||
|
||||
m64p_error qtVidExtFuncSetCaption(const char *)
|
||||
|
||||
@@ -30,6 +30,7 @@ void WorkerThread::run()
|
||||
connect(this, SIGNAL(updateDiscordActivity(struct DiscordActivity)), w, SLOT(updateDiscordActivity(struct DiscordActivity)), Qt::BlockingQueuedConnection);
|
||||
connect(this, SIGNAL(clearDiscordActivity()), w, SLOT(clearDiscordActivity()), Qt::BlockingQueuedConnection);
|
||||
connect(this, SIGNAL(addLog(QString)), w->getLogViewer(), SLOT(addLog(QString)), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(addFrameCount()), w, SLOT(addFrameCount()), Qt::QueuedConnection);
|
||||
#ifdef _WIN32
|
||||
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
|
||||
#else
|
||||
|
||||
@@ -25,6 +25,7 @@ signals:
|
||||
void updateDiscordActivity(struct DiscordActivity activity);
|
||||
void clearDiscordActivity();
|
||||
void addLog(QString text);
|
||||
void addFrameCount();
|
||||
|
||||
private:
|
||||
QString m_fileName;
|
||||
|
||||
Reference in new issue
Block a user