feat(gx): apply client area adjustments in d3d backend

This commit is contained in:
fallenoak 2023-03-15 16:33:51 -05:00
parent 69493f48ae
commit 7dbb4af868
2 changed files with 9 additions and 1 deletions

View File

@ -6,6 +6,9 @@
#include <algorithm>
#include <directxmath.h>
int32_t CGxDeviceD3d::s_clientAdjustWidth;
int32_t CGxDeviceD3d::s_clientAdjustHeight;
D3DCMPFUNC CGxDeviceD3d::s_cmpFunc[] = {
D3DCMP_LESSEQUAL,
D3DCMP_EQUAL,
@ -924,6 +927,8 @@ bool CGxDeviceD3d::ICreateWindow(CGxFormat& format) {
format.size.y // bottom
};
AdjustWindowRectEx(&clientArea, dwStyle, false, 0);
CGxDeviceD3d::s_clientAdjustWidth = clientArea.right - format.size.x - clientArea.left;
CGxDeviceD3d::s_clientAdjustHeight = clientArea.bottom - format.size.y - clientArea.top;
// TODO
@ -931,7 +936,8 @@ bool CGxDeviceD3d::ICreateWindow(CGxFormat& format) {
int32_t height = format.size.y ? format.size.y : CW_USEDEFAULT;
if (format.window && format.maximize != 1 && format.size.x && format.size.y) {
// TODO adjust width and height
width += CGxDeviceD3d::s_clientAdjustWidth;
height += CGxDeviceD3d::s_clientAdjustHeight;
}
this->m_hwnd = CreateWindowEx(

View File

@ -196,6 +196,8 @@ class CGxDeviceD3d : public CGxDevice {
};
// Static variables
static int32_t s_clientAdjustWidth;
static int32_t s_clientAdjustHeight;
static D3DCMPFUNC s_cmpFunc[];
static D3DCULL s_cullMode[];
static D3DBLEND s_dstBlend[];