From 69d2f6640582eacab49f15c06771680f6f9dfd7c Mon Sep 17 00:00:00 2001 From: Nomango <569629550@qq.com> Date: Tue, 24 Oct 2017 09:27:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=A2=E6=88=B7=E5=8C=BA?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=A4=A7=E5=B0=8F=E4=B8=8E=E8=AE=BE=E5=AE=9A?= =?UTF-8?q?=E5=80=BC=E4=B8=8D=E7=AC=A6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Demo/main.cpp | 4 +++- Easy2D/Base/EApp.cpp | 19 +++++++------------ Easy2D/Easy2D.vcxproj | 3 ++- Easy2D/Easy2D.vcxproj.filters | 3 +++ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Demo/main.cpp b/Demo/main.cpp index 04a6cfc6..bd2130b1 100644 --- a/Demo/main.cpp +++ b/Demo/main.cpp @@ -10,8 +10,10 @@ int WINAPI WinMain( { EApp app; - if (app.init(L"Easy2D Demo", 640, 480, app.NO_MINI_SIZE)) + if (app.init(L"Easy2D Demo", 640, 480)) { + float w = EApp::getWidth(); + float h = EApp::getHeight(); auto scene = new EScene(); auto text = new EText(L"中文测试中文测试中文测试中文测试中文测试中文测试中文测试", EColor::WHITE, L"楷体"); diff --git a/Easy2D/Base/EApp.cpp b/Easy2D/Base/EApp.cpp index f8b7acc0..29399b4a 100644 --- a/Easy2D/Base/EApp.cpp +++ b/Easy2D/Base/EApp.cpp @@ -114,12 +114,7 @@ bool e2d::EApp::init(const EString &title, UINT32 width, UINT32 height, EWindowS WARN_IF(screenWidth < width || screenHeight < height, "The window is larger than screen!"); width = min(width, screenWidth); height = min(height, screenHeight); - // 创建屏幕居中的矩形 - RECT rtWindow; - rtWindow.left = (screenWidth - width) / 2; - rtWindow.top = (screenHeight - height) / 2; - rtWindow.right = rtWindow.left + width; - rtWindow.bottom = rtWindow.top + height; + // 创建窗口样式 DWORD dwStyle = WS_OVERLAPPED | WS_SYSMENU; if (!wStyle.NO_MINI_SIZE) @@ -128,8 +123,6 @@ bool e2d::EApp::init(const EString &title, UINT32 width, UINT32 height, EWindowS } // 保存窗口是否置顶显示 m_bTopMost = wStyle.TOP_MOST; - // 计算客户区大小 - AdjustWindowRectEx(&rtWindow, dwStyle, FALSE, 0L); // 保存窗口名称 m_sTitle = title; // 创建窗口 @@ -137,10 +130,10 @@ bool e2d::EApp::init(const EString &title, UINT32 width, UINT32 height, EWindowS L"Easy2DApp", m_sTitle.c_str(), dwStyle, - rtWindow.left, - rtWindow.top, - rtWindow.right - rtWindow.left, - rtWindow.bottom - rtWindow.top, + 0, + 0, + width, + height, NULL, NULL, HINST_THISCOMPONENT, @@ -153,6 +146,8 @@ bool e2d::EApp::init(const EString &title, UINT32 width, UINT32 height, EWindowS { // 禁用输入法 this->setKeyboardLayoutEnable(false); + // 重设客户区大小 + this->setWindowSize(width, height); } else { diff --git a/Easy2D/Easy2D.vcxproj b/Easy2D/Easy2D.vcxproj index 97b23fc5..59c39c00 100644 --- a/Easy2D/Easy2D.vcxproj +++ b/Easy2D/Easy2D.vcxproj @@ -101,7 +101,7 @@ Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - None + EditAndContinue false @@ -230,6 +230,7 @@ + diff --git a/Easy2D/Easy2D.vcxproj.filters b/Easy2D/Easy2D.vcxproj.filters index 7e5d3218..3f90ce09 100644 --- a/Easy2D/Easy2D.vcxproj.filters +++ b/Easy2D/Easy2D.vcxproj.filters @@ -171,6 +171,9 @@ Tool + + Tool +