细节调整
This commit is contained in:
parent
85a4c0584a
commit
fb95734a88
|
|
@ -6,7 +6,7 @@
|
||||||
e2d::Game * e2d::Game::_instance = nullptr;
|
e2d::Game * e2d::Game::_instance = nullptr;
|
||||||
|
|
||||||
e2d::Game::Game()
|
e2d::Game::Game()
|
||||||
: _ended(false)
|
: _ended(true)
|
||||||
, _paused(false)
|
, _paused(false)
|
||||||
, _config(nullptr)
|
, _config(nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -122,11 +122,11 @@ HWND e2d::Window::__create()
|
||||||
float dpiScaleX = 0.f, dpiScaleY = 0.f;
|
float dpiScaleX = 0.f, dpiScaleY = 0.f;
|
||||||
Renderer::getFactory()->GetDesktopDpi(&dpiScaleX, &dpiScaleY);
|
Renderer::getFactory()->GetDesktopDpi(&dpiScaleX, &dpiScaleY);
|
||||||
|
|
||||||
int nWidth = static_cast<int>(ceil(this->_size.width * dpiScaleX / 96.f));
|
int nWidth = static_cast<int>(ceil(_size.width * dpiScaleX / 96.f));
|
||||||
int nHeight = static_cast<int>(ceil(this->_size.height * dpiScaleY / 96.f));
|
int nHeight = static_cast<int>(ceil(_size.height * dpiScaleY / 96.f));
|
||||||
|
|
||||||
// 计算窗口大小
|
// 计算窗口大小
|
||||||
DWORD dwStyle = WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX &~WS_THICKFRAME;
|
DWORD dwStyle = WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX & ~WS_THICKFRAME;
|
||||||
RECT wr = { 0, 0, static_cast<LONG>(nWidth), static_cast<LONG>(nHeight) };
|
RECT wr = { 0, 0, static_cast<LONG>(nWidth), static_cast<LONG>(nHeight) };
|
||||||
::AdjustWindowRectEx(&wr, dwStyle, FALSE, NULL);
|
::AdjustWindowRectEx(&wr, dwStyle, FALSE, NULL);
|
||||||
// 获取新的宽高
|
// 获取新的宽高
|
||||||
|
|
@ -141,7 +141,7 @@ HWND e2d::Window::__create()
|
||||||
HWND hWnd = ::CreateWindowEx(
|
HWND hWnd = ::CreateWindowEx(
|
||||||
NULL,
|
NULL,
|
||||||
L"Easy2DApp",
|
L"Easy2DApp",
|
||||||
(LPCTSTR)this->_title,
|
(LPCTSTR)_title,
|
||||||
dwStyle,
|
dwStyle,
|
||||||
(screenWidth - nWidth) / 2, (screenHeight - nHeight) / 2,
|
(screenWidth - nWidth) / 2, (screenHeight - nHeight) / 2,
|
||||||
nWidth, nHeight,
|
nWidth, nHeight,
|
||||||
|
|
@ -426,7 +426,7 @@ LRESULT e2d::Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
|
||||||
|
|
||||||
if (wParam == SIZE_RESTORED)
|
if (wParam == SIZE_RESTORED)
|
||||||
{
|
{
|
||||||
Window::getInstance()->_size = Size(width, height);
|
_instance->_size = Size(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果程序接收到一个 WM_SIZE 消息,这个方法将调整渲染
|
// 如果程序接收到一个 WM_SIZE 消息,这个方法将调整渲染
|
||||||
|
|
@ -443,7 +443,7 @@ LRESULT e2d::Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
|
||||||
// 处理窗口标题变化消息
|
// 处理窗口标题变化消息
|
||||||
case WM_SETTEXT:
|
case WM_SETTEXT:
|
||||||
{
|
{
|
||||||
Window::getInstance()->_title = (const wchar_t*)lParam;
|
_instance->_title = (const wchar_t*)lParam;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue