[1637] | 1 | //--------------------------------------------------------------------------------------
|
---|
| 2 | // File: DxStdAfx.h
|
---|
| 3 | //
|
---|
| 4 | // Desc: Standard includes and precompiled headers for DXUT
|
---|
| 5 | //
|
---|
| 6 | // Copyright (c) Microsoft Corporation. All rights reserved.
|
---|
| 7 | //--------------------------------------------------------------------------------------
|
---|
| 8 | #pragma once
|
---|
| 9 | #ifndef DXSDK_STDAFX_H
|
---|
| 10 | #define DXSDK_STDAFX_H
|
---|
| 11 |
|
---|
| 12 | #ifndef STRICT
|
---|
| 13 | #define STRICT
|
---|
| 14 | #endif
|
---|
| 15 |
|
---|
| 16 | // If app hasn't choosen, set to work with Windows 98, Windows Me, Windows 2000, Windows XP and beyond
|
---|
| 17 | #ifndef WINVER
|
---|
| 18 | #define WINVER 0x0410
|
---|
| 19 | #endif
|
---|
| 20 | #ifndef _WIN32_WINDOWS
|
---|
| 21 | #define _WIN32_WINDOWS 0x0410
|
---|
| 22 | #endif
|
---|
| 23 | #ifndef _WIN32_WINNT
|
---|
| 24 | #define _WIN32_WINNT 0x0500
|
---|
| 25 | #endif
|
---|
| 26 |
|
---|
| 27 | // #define DXUT_AUTOLIB to automatically include the libs needed for DXUT
|
---|
| 28 | #ifdef DXUT_AUTOLIB
|
---|
| 29 | #pragma comment( lib, "dxerr9.lib" )
|
---|
| 30 | #pragma comment( lib, "dxguid.lib" )
|
---|
| 31 | #if defined(DEBUG) || defined(_DEBUG)
|
---|
| 32 | #pragma comment( lib, "d3dx9d.lib" )
|
---|
| 33 | #else
|
---|
| 34 | #pragma comment( lib, "d3dx9.lib" )
|
---|
| 35 | #endif
|
---|
| 36 | #pragma comment( lib, "d3d9.lib" )
|
---|
| 37 | #pragma comment( lib, "winmm.lib" )
|
---|
| 38 | #pragma comment( lib, "comctl32.lib" )
|
---|
| 39 | #endif
|
---|
| 40 |
|
---|
| 41 | #pragma warning( disable : 4100 ) // disable unreference formal parameter warnings for /W4 builds
|
---|
| 42 |
|
---|
| 43 | #include <windows.h>
|
---|
| 44 | #include <assert.h>
|
---|
| 45 | #include <wchar.h>
|
---|
| 46 | #include <mmsystem.h>
|
---|
| 47 | #include <commctrl.h> // for InitCommonControls()
|
---|
| 48 | #include <shellapi.h> // for ExtractIcon()
|
---|
| 49 | #include <new.h> // for placement new
|
---|
| 50 | #include <math.h>
|
---|
| 51 | #include <limits.h>
|
---|
| 52 | #include <stdio.h>
|
---|
| 53 | #include <XInput.h> // Header for XInput APIs
|
---|
| 54 |
|
---|
| 55 | // CRT's memory leak detection
|
---|
| 56 | #if defined(DEBUG) || defined(_DEBUG)
|
---|
| 57 | #include <crtdbg.h>
|
---|
| 58 | #endif
|
---|
| 59 |
|
---|
| 60 | // Enable extra D3D debugging in debug builds if using the debug DirectX runtime.
|
---|
| 61 | // This makes D3D objects work well in the debugger watch window, but slows down
|
---|
| 62 | // performance slightly.
|
---|
| 63 | #if defined(DEBUG) || defined(_DEBUG)
|
---|
| 64 | #ifndef D3D_DEBUG_INFO
|
---|
| 65 | #define D3D_DEBUG_INFO
|
---|
| 66 | #endif
|
---|
| 67 | #endif
|
---|
| 68 |
|
---|
| 69 | // Direct3D includes
|
---|
| 70 | #include <d3d9.h>
|
---|
| 71 | #include <d3dx9.h>
|
---|
| 72 | #include <dxerr9.h>
|
---|
| 73 |
|
---|
| 74 | // DirectSound includes
|
---|
| 75 | #include <mmsystem.h>
|
---|
| 76 | #include <mmreg.h>
|
---|
| 77 | #include <dsound.h>
|
---|
| 78 |
|
---|
| 79 | // strsafe.h deprecates old unsecure string functions. If you
|
---|
| 80 | // really do not want to it to (not recommended), then uncomment the next line
|
---|
| 81 | //#define STRSAFE_NO_DEPRECATE
|
---|
| 82 |
|
---|
| 83 | #ifndef STRSAFE_NO_DEPRECATE
|
---|
| 84 | #pragma deprecated("strncpy")
|
---|
| 85 | #pragma deprecated("wcsncpy")
|
---|
| 86 | #pragma deprecated("_tcsncpy")
|
---|
| 87 | #pragma deprecated("wcsncat")
|
---|
| 88 | #pragma deprecated("strncat")
|
---|
| 89 | #pragma deprecated("_tcsncat")
|
---|
| 90 | #endif
|
---|
| 91 |
|
---|
| 92 | #pragma warning( disable : 4996 ) // disable deprecated warning
|
---|
| 93 | #include <strsafe.h>
|
---|
| 94 | #pragma warning( default : 4996 )
|
---|
| 95 |
|
---|
| 96 | #include "DXUT.h"
|
---|
| 97 | #include "DXUTmisc.h"
|
---|
| 98 | #include "DXUTenum.h"
|
---|
| 99 | #include "DXUTmesh.h"
|
---|
| 100 | #include "DXUTgui.h"
|
---|
| 101 | #include "DXUTsettingsDlg.h"
|
---|
| 102 | #include "DXUTSound.h"
|
---|
| 103 | #include "DXUTRes.h"
|
---|
| 104 |
|
---|
| 105 | #if defined(DEBUG) || defined(_DEBUG)
|
---|
| 106 | #ifndef V
|
---|
| 107 | #define V(x) { hr = x; if( FAILED(hr) ) { DXUTTrace( __FILE__, (DWORD)__LINE__, hr, L#x, true ); } }
|
---|
| 108 | #endif
|
---|
| 109 | #ifndef V_RETURN
|
---|
| 110 | #define V_RETURN(x) { hr = x; if( FAILED(hr) ) { return DXUTTrace( __FILE__, (DWORD)__LINE__, hr, L#x, true ); } }
|
---|
| 111 | #endif
|
---|
| 112 | #else
|
---|
| 113 | #ifndef V
|
---|
| 114 | #define V(x) { hr = x; }
|
---|
| 115 | #endif
|
---|
| 116 | #ifndef V_RETURN
|
---|
| 117 | #define V_RETURN(x) { hr = x; if( FAILED(hr) ) { return hr; } }
|
---|
| 118 | #endif
|
---|
| 119 | #endif
|
---|
| 120 |
|
---|
| 121 | #ifndef SAFE_DELETE
|
---|
| 122 | #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
|
---|
| 123 | #endif
|
---|
| 124 | #ifndef SAFE_DELETE_ARRAY
|
---|
| 125 | #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
|
---|
| 126 | #endif
|
---|
| 127 | #ifndef SAFE_RELEASE
|
---|
| 128 | #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
|
---|
| 129 | #endif
|
---|
| 130 |
|
---|
| 131 | #endif // !defined(DXSDK_STDAFX_H)
|
---|