Fixed /W4 compile warnings in sample SimpleTexturedDirectx11.

This commit is contained in:
Marc-Antoine Lortie
2020-04-03 09:43:01 -04:00
parent 6b68c0ee45
commit e67ddd0ca1
4 changed files with 69 additions and 69 deletions

View File

@@ -56,7 +56,7 @@ const char g_szClassName[] = "directxWindowClass";
static std::string g_ModelPath;
UINT width, height;
HWND hwnd = nullptr;
HWND g_hwnd = nullptr;
// ------------------------------------------------------------
// DirectX Variables
@@ -120,8 +120,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return 0;
}
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPWSTR lpCmdLine, int nCmdShow)
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
LPWSTR /*lpCmdLine*/, int nCmdShow)
{
int argc;
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
@@ -182,7 +182,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
RECT wr = { 0,0, SCREEN_WIDTH, SCREEN_HEIGHT };
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);
hwnd = CreateWindowEx(
g_hwnd = CreateWindowEx(
WS_EX_CLIENTEDGE,
g_szClassName,
" Simple Textured Directx11 Sample ",
@@ -191,21 +191,21 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
NULL, NULL, hInstance, NULL
);
if (hwnd == NULL)
if (g_hwnd == NULL)
{
MessageBox(NULL, "Window Creation Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
ShowWindow(g_hwnd, nCmdShow);
UpdateWindow(g_hwnd);
width = wr.right - wr.left;
height = wr.bottom - wr.top;
try {
InitD3D(hInstance, hwnd);
InitD3D(hInstance, g_hwnd);
while (true)
{
@@ -225,17 +225,17 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
CleanD3D();
return static_cast<int>(msg.wParam);
} catch (const std::exception& e) {
MessageBox(hwnd, e.what(), TEXT("Error!"), MB_ICONERROR | MB_OK);
MessageBox(g_hwnd, e.what(), TEXT("Error!"), MB_ICONERROR | MB_OK);
CleanD3D();
return EXIT_FAILURE;
} catch (...) {
MessageBox(hwnd, TEXT("Caught an unknown exception."), TEXT("Error!"), MB_ICONERROR | MB_OK);
MessageBox(g_hwnd, TEXT("Caught an unknown exception."), TEXT("Error!"), MB_ICONERROR | MB_OK);
CleanD3D();
return EXIT_FAILURE;
}
}
void InitD3D(HINSTANCE hinstance, HWND hWnd)
void InitD3D(HINSTANCE /*hinstance*/, HWND hWnd)
{
HRESULT hr;
@@ -362,7 +362,7 @@ void InitD3D(HINSTANCE hinstance, HWND hWnd)
}
// Note this tutorial doesn't handle full-screen swapchains so we block the ALT+ENTER shortcut
dxgiFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_ALT_ENTER);
dxgiFactory->MakeWindowAssociation(g_hwnd, DXGI_MWA_NO_ALT_ENTER);
dxgiFactory->Release();
@@ -564,7 +564,7 @@ void InitGraphics()
m_View = XMMatrixLookAtLH(Eye, At, Up);
ourModel = new ModelLoader;
if (!ourModel->Load(hwnd, dev, devcon, g_ModelPath))
if (!ourModel->Load(g_hwnd, dev, devcon, g_ModelPath))
Throwanerror("Model couldn't be loaded");
}