-
-
Notifications
You must be signed in to change notification settings - Fork 457
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xrEngine: splash screen creation refactor
- Loading branch information
1 parent
c520f41
commit f8f2ce9
Showing
7 changed files
with
78 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "stdafx.h" | ||
#include "xr_3da/resource.h" | ||
#include "splash.h" | ||
|
||
HWND logoWindow = nullptr; | ||
|
||
static INT_PTR CALLBACK LogoWndProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp) | ||
{ | ||
switch (msg) | ||
{ | ||
case WM_DESTROY: break; | ||
case WM_CLOSE: DestroyWindow(hw); break; | ||
case WM_COMMAND: | ||
if (LOWORD(wp) == IDCANCEL) | ||
DestroyWindow(hw); | ||
break; | ||
default: return false; | ||
} | ||
return true; | ||
} | ||
|
||
namespace splash | ||
{ | ||
void show(const bool topmost) | ||
{ | ||
if (logoWindow) | ||
return; | ||
|
||
logoWindow = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_STARTUP), nullptr, LogoWndProc); | ||
const HWND logoPicture = GetDlgItem(logoWindow, IDC_STATIC_LOGO); | ||
RECT logoRect; | ||
GetWindowRect(logoPicture, &logoRect); | ||
const HWND prevWindow = topmost ? HWND_TOPMOST : HWND_NOTOPMOST; | ||
SetWindowPos(logoWindow, prevWindow, 0, 0, logoRect.right - logoRect.left, logoRect.bottom - logoRect.top, | ||
SWP_NOMOVE | SWP_SHOWWINDOW); | ||
UpdateWindow(logoWindow); | ||
} | ||
|
||
void hide() | ||
{ | ||
if (logoWindow != nullptr) | ||
{ | ||
DestroyWindow(logoWindow); | ||
logoWindow = nullptr; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
namespace splash | ||
{ | ||
void ENGINE_API show(const bool topmost); | ||
void ENGINE_API hide(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters