隐藏一个函数不暴露在.h中

This commit is contained in:
HuYingzhuo 2019-04-30 19:46:49 +08:00
parent c0b98e73d3
commit 67eac6173a
2 changed files with 22 additions and 23 deletions

View File

@ -2,34 +2,34 @@
namespace hgl namespace hgl
{ {
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
namespace namespace
{ {
constexpr wchar_t WIN_CLASS_NAME[] = L"CMGameEngine/ULRE Window Class"; constexpr wchar_t WIN_CLASS_NAME[] = L"CMGameEngine/ULRE Window Class";
}
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); bool RegistryWinClass(HINSTANCE hInstance)
{
WNDCLASSEXW win_class;
bool WinWindow::Registry() hgl_zero(win_class);
{
WNDCLASSEXW win_class;
hgl_zero(win_class); win_class.cbSize = sizeof(WNDCLASSEXW);
win_class.style = CS_HREDRAW | CS_VREDRAW;
win_class.lpfnWndProc = WindowProc;
win_class.cbClsExtra = 0;
win_class.cbWndExtra = 0;
win_class.hInstance = hInstance;
win_class.hIcon = LoadIcon(nullptr, IDI_APPLICATION);
win_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
win_class.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
win_class.lpszMenuName = nullptr;
win_class.lpszClassName = WIN_CLASS_NAME;
win_class.hIconSm = LoadIcon(nullptr, IDI_WINLOGO);
win_class.cbSize = sizeof(WNDCLASSEXW); return RegisterClassExW(&win_class);
win_class.style = CS_HREDRAW | CS_VREDRAW; }
win_class.lpfnWndProc = WindowProc; }//namespace
win_class.cbClsExtra = 0;
win_class.cbWndExtra = 0;
win_class.hInstance = hInstance;
win_class.hIcon = LoadIcon(nullptr, IDI_APPLICATION);
win_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
win_class.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
win_class.lpszMenuName = nullptr;
win_class.lpszClassName = WIN_CLASS_NAME;
win_class.hIconSm = LoadIcon(nullptr, IDI_WINLOGO);
return RegisterClassExW(&win_class);
}
bool WinWindow::Create() bool WinWindow::Create()
{ {
@ -99,7 +99,7 @@ namespace hgl
hInstance = GetModuleHandleW(nullptr); hInstance = GetModuleHandleW(nullptr);
if (!Registry()) if (!RegistryWinClass(hInstance))
return(false); return(false);
if(!Create()) if(!Create())

View File

@ -17,7 +17,6 @@ namespace hgl
protected: protected:
bool Registry();
bool Create(); bool Create();
void OnClose() override{Close();} void OnClose() override{Close();}