去掉了EApp::init函数的一个重载
This commit is contained in:
parent
d5a45b3b01
commit
7c035c63ed
|
|
@ -25,7 +25,6 @@ e2d::EApp::EApp()
|
|||
: m_bEnd(false)
|
||||
, m_bPaused(false)
|
||||
, m_bManualPaused(false)
|
||||
, m_bTopMost(false)
|
||||
, m_bShowConsole(false)
|
||||
, m_nAnimationInterval(17LL)
|
||||
, m_ClearColor(EColor::BLACK)
|
||||
|
|
@ -53,17 +52,17 @@ e2d::EApp * e2d::EApp::getInstance()
|
|||
return s_pInstance; // 获取 EApp 的唯一实例
|
||||
}
|
||||
|
||||
bool e2d::EApp::init(const EString &title, UINT32 width, UINT32 height)
|
||||
{
|
||||
return init(title, width, height, EWindowStyle());
|
||||
}
|
||||
|
||||
bool e2d::EApp::init(const EString &title, UINT32 width, UINT32 height, EWindowStyle wStyle)
|
||||
bool e2d::EApp::init(const EString &title, UINT32 width, UINT32 height, const EWindowStyle &wStyle /* = nullptr */)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
// ±£´æ´°¿ÚÑùʽ
|
||||
EApp::getInstance()->m_WindowStyle = wStyle;
|
||||
// ±£´æ´°¿ÚÃû³Æ
|
||||
EApp::getInstance()->m_sTitle = title;
|
||||
|
||||
// 注册窗口类
|
||||
WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
|
||||
|
|
@ -119,10 +118,6 @@ bool e2d::EApp::init(const EString &title, UINT32 width, UINT32 height, EWindowS
|
|||
{
|
||||
dwStyle |= WS_MINIMIZEBOX;
|
||||
}
|
||||
// 保存窗口是否置顶显示
|
||||
EApp::getInstance()->m_bTopMost = wStyle.m_bTopMost;
|
||||
// 保存窗口名称
|
||||
EApp::getInstance()->m_sTitle = title;
|
||||
// 创建窗口
|
||||
GetHWnd() = CreateWindow(
|
||||
L"Easy2DApp",
|
||||
|
|
@ -177,7 +172,7 @@ int e2d::EApp::run()
|
|||
ShowWindow(GetHWnd(), SW_SHOWNORMAL);
|
||||
UpdateWindow(GetHWnd());
|
||||
// 设置窗口置顶
|
||||
if (pApp->m_bTopMost)
|
||||
if (pApp->m_WindowStyle.m_bTopMost)
|
||||
{
|
||||
SetWindowPos(GetHWnd(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
|
|
@ -566,6 +561,11 @@ HWND e2d::EApp::getHWnd()
|
|||
return GetHWnd();
|
||||
}
|
||||
|
||||
e2d::EWindowStyle e2d::EApp::getWindowStyle()
|
||||
{
|
||||
return getInstance()->m_WindowStyle;
|
||||
}
|
||||
|
||||
LONGLONG e2d::EApp::getTotalDurationFromStart()
|
||||
{
|
||||
return GetInterval(s_tStart);
|
||||
|
|
|
|||
|
|
@ -210,10 +210,7 @@
|
|||
<ClCompile Include="Base\EApp.cpp" />
|
||||
<ClCompile Include="Base\EScene.cpp" />
|
||||
<ClCompile Include="Common\EFont.cpp" />
|
||||
<ClCompile Include="Common\EKeyboardMsg.cpp" />
|
||||
<ClCompile Include="Common\EMouseMsg.cpp" />
|
||||
<ClCompile Include="Common\EObject.cpp" />
|
||||
<ClCompile Include="Common\EPhysicsMsg.cpp" />
|
||||
<ClCompile Include="Common\ESpriteFrame.cpp" />
|
||||
<ClCompile Include="Common\ETexture.cpp" />
|
||||
<ClCompile Include="Geometry\ECircle.cpp" />
|
||||
|
|
@ -235,6 +232,9 @@
|
|||
<ClCompile Include="Manager\EObjectManager.cpp" />
|
||||
<ClCompile Include="Manager\EPhysicsManager.cpp" />
|
||||
<ClCompile Include="Manager\ETimerManager.cpp" />
|
||||
<ClCompile Include="Msg\EKeyboardMsg.cpp" />
|
||||
<ClCompile Include="Msg\EMouseMsg.cpp" />
|
||||
<ClCompile Include="Msg\EPhysicsMsg.cpp" />
|
||||
<ClCompile Include="Node\EButton.cpp" />
|
||||
<ClCompile Include="Node\EButtonToggle.cpp" />
|
||||
<ClCompile Include="Node\EMenu.cpp" />
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@
|
|||
<Filter Include="Common">
|
||||
<UniqueIdentifier>{be5d9314-b00a-4f11-bd2a-1f720dc32407}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Msg">
|
||||
<UniqueIdentifier>{3c524aef-fb91-4f44-a3dc-bff34de229eb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Win\winbase.cpp">
|
||||
|
|
@ -153,12 +156,6 @@
|
|||
<ClCompile Include="Geometry\EEllipse.cpp">
|
||||
<Filter>Geometry</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common\EMouseMsg.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common\EKeyboardMsg.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Manager\EPhysicsManager.cpp">
|
||||
<Filter>Manager</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -204,9 +201,6 @@
|
|||
<ClCompile Include="Node\EMenu.cpp">
|
||||
<Filter>Node</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common\EPhysicsMsg.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common\ESpriteFrame.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -216,6 +210,15 @@
|
|||
<ClCompile Include="Transition\ETransition.cpp">
|
||||
<Filter>Transition</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Msg\EKeyboardMsg.cpp">
|
||||
<Filter>Msg</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Msg\EMouseMsg.cpp">
|
||||
<Filter>Msg</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Msg\EPhysicsMsg.cpp">
|
||||
<Filter>Msg</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Win\winbase.h">
|
||||
|
|
|
|||
|
|
@ -22,19 +22,12 @@ public:
|
|||
// 获取程序实例
|
||||
static EApp * getInstance();
|
||||
|
||||
// 初始化游戏界面
|
||||
static bool init(
|
||||
const EString &title, /* 窗口标题 */
|
||||
UINT32 width, /* 窗口宽度 */
|
||||
UINT32 height /* 窗口高度 */
|
||||
);
|
||||
|
||||
// 初始化游戏界面
|
||||
static bool init(
|
||||
const EString &title, /* 窗口标题 */
|
||||
UINT32 width, /* 窗口宽度 */
|
||||
UINT32 height, /* 窗口高度 */
|
||||
EWindowStyle wStyle /* 窗口样式 */
|
||||
const EWindowStyle &wStyle = nullptr /* ´°¿ÚÑùʽ */
|
||||
);
|
||||
|
||||
// 启动程序
|
||||
|
|
@ -96,6 +89,9 @@ public:
|
|||
// 获取窗口句柄
|
||||
static HWND getHWnd();
|
||||
|
||||
// »ñÈ¡´°¿ÚÑùʽ
|
||||
static EWindowStyle getWindowStyle();
|
||||
|
||||
// 获取从游戏开始到当前经过的毫秒数
|
||||
static LONGLONG getTotalDurationFromStart();
|
||||
|
||||
|
|
@ -175,7 +171,6 @@ private:
|
|||
bool m_bEnd;
|
||||
bool m_bPaused;
|
||||
bool m_bManualPaused;
|
||||
bool m_bTopMost;
|
||||
bool m_bShowConsole;
|
||||
EString m_sTitle;
|
||||
EString m_sAppName;
|
||||
|
|
@ -183,6 +178,7 @@ private:
|
|||
LONGLONG m_nAnimationInterval;
|
||||
EScene * m_pCurrentScene;
|
||||
EScene * m_pNextScene;
|
||||
EWindowStyle m_WindowStyle;
|
||||
ETransition * m_pTransition;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue