不再自动关闭控制台;不再禁用Circle和Ellipse的修改宽高函数;同步工程文件。

This commit is contained in:
Haibo 2018-05-03 22:21:01 +08:00
parent 6797570015
commit 24dbd42970
8 changed files with 36 additions and 42 deletions

View File

@ -5,8 +5,6 @@
// 窗口句柄 // 窗口句柄
static HWND s_HWnd = nullptr; static HWND s_HWnd = nullptr;
// 是否打开控制台
static bool s_bShowConsole = false;
bool e2d::Window::__init() bool e2d::Window::__init()
@ -72,18 +70,12 @@ bool e2d::Window::__init()
{ {
// 禁用输入法 // 禁用输入法
Window::setTypewritingEnable(false); Window::setTypewritingEnable(false);
// 查找是否存在控制台 // 禁用控制台关闭按钮
HWND hwnd = ::GetConsoleWindow(); HWND consoleHWnd = ::GetConsoleWindow();
if (hwnd) if (consoleHWnd)
{ {
// 禁用控制台关闭按钮 HMENU hmenu = ::GetSystemMenu(consoleHWnd, FALSE);
HMENU hmenu = ::GetSystemMenu(hwnd, FALSE);
::RemoveMenu(hmenu, SC_CLOSE, MF_BYCOMMAND); ::RemoveMenu(hmenu, SC_CLOSE, MF_BYCOMMAND);
// 默认隐藏控制台
if (!s_bShowConsole)
{
::ShowWindow(hwnd, SW_HIDE);
}
} }
} }
else else
@ -204,9 +196,8 @@ e2d::String e2d::Window::getTitle()
return wszTitle; return wszTitle;
} }
void e2d::Window::showConsole(bool show /* = true */) void e2d::Window::showConsole(bool show)
{ {
s_bShowConsole = show;
// 查找已存在的控制台句柄 // 查找已存在的控制台句柄
HWND hwnd = ::GetConsoleWindow(); HWND hwnd = ::GetConsoleWindow();
// 关闭控制台 // 关闭控制台
@ -271,9 +262,11 @@ void e2d::Window::setTypewritingEnable(bool bEnable)
LRESULT e2d::Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT e2d::Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
LRESULT result = 0; LRESULT result = 0;
bool hasHandled = false;
switch (message) switch (message)
{ {
// 处理窗口大小变化消息 // 处理窗口大小变化消息
case WM_SIZE: case WM_SIZE:
{ {
@ -294,6 +287,7 @@ LRESULT e2d::Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
InvalidateRect(hWnd, NULL, FALSE); InvalidateRect(hWnd, NULL, FALSE);
} }
result = 0; result = 0;
hasHandled = true;
break; break;
// 重绘窗口 // 重绘窗口
@ -303,6 +297,7 @@ LRESULT e2d::Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
ValidateRect(hWnd, NULL); ValidateRect(hWnd, NULL);
} }
result = 0; result = 0;
hasHandled = true;
break; break;
// 窗口关闭消息 // 窗口关闭消息
@ -315,21 +310,24 @@ LRESULT e2d::Window::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
} }
} }
result = 0; result = 0;
hasHandled = true;
break; break;
// 窗口销毁消息
case WM_DESTROY: case WM_DESTROY:
{ {
PostQuitMessage(0); PostQuitMessage(0);
} }
result = 1; result = 1;
hasHandled = true;
break; break;
default: }
if (!hasHandled)
{ {
result = DefWindowProc(hWnd, message, wParam, lParam); result = DefWindowProc(hWnd, message, wParam, lParam);
} }
}
return result; return result;
} }

View File

@ -133,12 +133,12 @@ e2d::String e2d::Path::getFileExtension(String filePath)
{ {
String fileExtension; String fileExtension;
// 找到文件名中的最后一个 '.' 的位置 // 找到文件名中的最后一个 '.' 的位置
int pos = filePath.getWString().find_last_of(L'.'); size_t pos = filePath.getWString().find_last_of(L'.');
// 判断 pos 是否是有效位置 // 判断 pos 是否是有效位置
if (pos != -1) if (pos != std::wstring::npos)
{ {
// 截取扩展名 // 截取扩展名
fileExtension = filePath.subtract(pos); fileExtension = filePath.subtract(static_cast<int>(pos));
// 转换为小写字母 // 转换为小写字母
fileExtension = fileExtension.toLower(); fileExtension = fileExtension.toLower();
} }

View File

@ -87,7 +87,7 @@ public:
// 打开/隐藏控制台 // 打开/隐藏控制台
static void showConsole( static void showConsole(
bool bShow = true bool show
); );
// 是否允许响应输入法 // 是否允许响应输入法

View File

@ -200,16 +200,6 @@ public:
double radius double radius
); );
public:
// 禁用的函数
void setWidth() {}
// 禁用的函数
void setHeight() {}
// 禁用的函数
void setSize() {}
protected: protected:
// äÖȾÂÖÀª // äÖȾÂÖÀª
virtual void _renderLine() override; virtual void _renderLine() override;
@ -265,16 +255,6 @@ public:
double radiusY double radiusY
); );
public:
// 禁用的函数
void setWidth() {}
// 禁用的函数
void setHeight() {}
// 禁用的函数
void setSize() {}
protected: protected:
// äÖȾÂÖÀª // äÖȾÂÖÀª
virtual void _renderLine() override; virtual void _renderLine() override;

View File

@ -20,6 +20,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\core\Action\Action.cpp" /> <ClCompile Include="..\..\core\Action\Action.cpp" />
<ClCompile Include="..\..\core\Action\ActionBase.cpp" />
<ClCompile Include="..\..\core\Action\ActionDelay.cpp" /> <ClCompile Include="..\..\core\Action\ActionDelay.cpp" />
<ClCompile Include="..\..\core\Action\ActionFunc.cpp" /> <ClCompile Include="..\..\core\Action\ActionFunc.cpp" />
<ClCompile Include="..\..\core\Action\ActionGradual.cpp" /> <ClCompile Include="..\..\core\Action\ActionGradual.cpp" />
@ -76,6 +77,7 @@
<ClCompile Include="..\..\core\Tool\Random.cpp" /> <ClCompile Include="..\..\core\Tool\Random.cpp" />
<ClCompile Include="..\..\core\Tool\Timer.cpp" /> <ClCompile Include="..\..\core\Tool\Timer.cpp" />
<ClCompile Include="..\..\core\Transition\Transition.cpp" /> <ClCompile Include="..\..\core\Transition\Transition.cpp" />
<ClCompile Include="..\..\core\Transition\TransitionBase.cpp" />
<ClCompile Include="..\..\core\Transition\TransitionEmerge.cpp" /> <ClCompile Include="..\..\core\Transition\TransitionEmerge.cpp" />
<ClCompile Include="..\..\core\Transition\TransitionFade.cpp" /> <ClCompile Include="..\..\core\Transition\TransitionFade.cpp" />
<ClCompile Include="..\..\core\Transition\TransitionMove.cpp" /> <ClCompile Include="..\..\core\Transition\TransitionMove.cpp" />

View File

@ -213,6 +213,12 @@
<ClCompile Include="..\..\core\Custom\CustomTextRenderer.cpp"> <ClCompile Include="..\..\core\Custom\CustomTextRenderer.cpp">
<Filter>Custom</Filter> <Filter>Custom</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\core\Action\ActionBase.cpp">
<Filter>Action</Filter>
</ClCompile>
<ClCompile Include="..\..\core\Transition\TransitionBase.cpp">
<Filter>Transition</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\core\e2daction.h" /> <ClInclude Include="..\..\core\e2daction.h" />

View File

@ -164,6 +164,7 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\core\Action\Action.cpp" /> <ClCompile Include="..\..\core\Action\Action.cpp" />
<ClCompile Include="..\..\core\Action\ActionBase.cpp" />
<ClCompile Include="..\..\core\Action\ActionDelay.cpp" /> <ClCompile Include="..\..\core\Action\ActionDelay.cpp" />
<ClCompile Include="..\..\core\Action\ActionFunc.cpp" /> <ClCompile Include="..\..\core\Action\ActionFunc.cpp" />
<ClCompile Include="..\..\core\Action\ActionGradual.cpp" /> <ClCompile Include="..\..\core\Action\ActionGradual.cpp" />
@ -220,6 +221,7 @@
<ClCompile Include="..\..\core\Tool\Random.cpp" /> <ClCompile Include="..\..\core\Tool\Random.cpp" />
<ClCompile Include="..\..\core\Tool\Timer.cpp" /> <ClCompile Include="..\..\core\Tool\Timer.cpp" />
<ClCompile Include="..\..\core\Transition\Transition.cpp" /> <ClCompile Include="..\..\core\Transition\Transition.cpp" />
<ClCompile Include="..\..\core\Transition\TransitionBase.cpp" />
<ClCompile Include="..\..\core\Transition\TransitionEmerge.cpp" /> <ClCompile Include="..\..\core\Transition\TransitionEmerge.cpp" />
<ClCompile Include="..\..\core\Transition\TransitionFade.cpp" /> <ClCompile Include="..\..\core\Transition\TransitionFade.cpp" />
<ClCompile Include="..\..\core\Transition\TransitionMove.cpp" /> <ClCompile Include="..\..\core\Transition\TransitionMove.cpp" />

View File

@ -213,6 +213,12 @@
<ClCompile Include="..\..\core\Custom\CustomTextRenderer.cpp"> <ClCompile Include="..\..\core\Custom\CustomTextRenderer.cpp">
<Filter>Custom</Filter> <Filter>Custom</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\core\Action\ActionBase.cpp">
<Filter>Action</Filter>
</ClCompile>
<ClCompile Include="..\..\core\Transition\TransitionBase.cpp">
<Filter>Transition</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\core\e2daction.h" /> <ClInclude Include="..\..\core\e2daction.h" />