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
+