This repository was archived by the owner on Mar 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathvkwindow.cpp
More file actions
51 lines (44 loc) · 1.33 KB
/
vkwindow.cpp
File metadata and controls
51 lines (44 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "vkwindow.h"
#include "mainwindow.h"
#include "interface/core_commands.h"
VkWindow::VkWindow(QWindow *parent)
: QWindow(parent)
{
setSurfaceType(QWindow::VulkanSurface);
}
VkWindow::~VkWindow()
{
if (w->getCoreLib())
{
m64p_handle configVideoParallel = NULL;
(*ConfigOpenSection)("Video-Parallel", &configVideoParallel);
(*ConfigSetParameter)(configVideoParallel, "ScreenWidth", M64TYPE_INT, &orig_width);
(*ConfigSetParameter)(configVideoParallel, "ScreenHeight", M64TYPE_INT, &orig_height);
(*ConfigSaveSection)("Video-Parallel");
}
}
void VkWindow::resizeEvent(QResizeEvent *event)
{
QWindow::resizeEvent(event);
if (timerId)
{
killTimer(timerId);
timerId = 0;
}
timerId = startTimer(500);
orig_width = event->size().width();
orig_height = event->size().height();
m_width = orig_width * devicePixelRatio();
m_height = orig_height * devicePixelRatio();
}
void VkWindow::timerEvent(QTimerEvent *te)
{
int size = (m_width << 16) + m_height;
int current_size = 0;
(*CoreDoCommand)(M64CMD_CORE_STATE_QUERY, M64CORE_VIDEO_SIZE, ¤t_size);
if (current_size != size)
(*CoreDoCommand)(M64CMD_CORE_STATE_SET, M64CORE_VIDEO_SIZE, &size);
killTimer(te->timerId());
timerId = 0;
requestActivate();
}