修复客户区窗口大小与设定值不符的bug
This commit is contained in:
parent
3abc386793
commit
69d2f66405
|
|
@ -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"楷体");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@
|
|||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
|
@ -230,6 +230,7 @@
|
|||
<ClCompile Include="Node\EFont.cpp" />
|
||||
<ClCompile Include="Node\ETexture.cpp" />
|
||||
<ClCompile Include="Tool\EFileUtils.cpp" />
|
||||
<ClCompile Include="Tool\EMusicUtils.cpp" />
|
||||
<ClCompile Include="Tool\ERandom.cpp" />
|
||||
<ClCompile Include="Tool\ETimer.cpp" />
|
||||
<ClCompile Include="Transition\ETransitionEmerge.cpp" />
|
||||
|
|
|
|||
|
|
@ -171,6 +171,9 @@
|
|||
<ClCompile Include="Tool\ETimer.cpp">
|
||||
<Filter>Tool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Tool\EMusicUtils.cpp">
|
||||
<Filter>Tool</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Win\winbase.h">
|
||||
|
|
|
|||
Loading…
Reference in New Issue