├── .gitattributes ├── .vs └── KeyLogger_2010 │ └── v16 │ ├── .suo │ └── Browse.VC.db ├── DXUT ├── Core │ ├── DXUT.cpp │ ├── DXUT.h │ ├── DXUT_2008.sln │ ├── DXUT_2008.vcproj │ ├── DXUT_2010.sln │ ├── DXUT_2010.vcxproj │ ├── DXUT_2010.vcxproj.filters │ ├── DXUTenum.cpp │ ├── DXUTenum.h │ ├── DXUTmisc.cpp │ ├── DXUTmisc.h │ └── dpiaware.manifest └── Optional │ ├── DXUTLockFreePipe.h │ ├── DXUTOpt_2008.sln │ ├── DXUTOpt_2008.vcproj │ ├── DXUTOpt_2010.sln │ ├── DXUTOpt_2010.vcxproj │ ├── DXUTOpt_2010.vcxproj.filters │ ├── DXUTShapes.cpp │ ├── DXUTShapes.h │ ├── DXUTcamera.cpp │ ├── DXUTcamera.h │ ├── DXUTgui.cpp │ ├── DXUTgui.h │ ├── DXUTguiIME.cpp │ ├── DXUTguiIME.h │ ├── DXUTres.cpp │ ├── DXUTres.h │ ├── DXUTsettingsdlg.cpp │ ├── DXUTsettingsdlg.h │ ├── ImeUi.cpp │ ├── ImeUi.h │ ├── SDKmesh.cpp │ ├── SDKmesh.h │ ├── SDKmisc.cpp │ ├── SDKmisc.h │ ├── SDKsound.cpp │ ├── SDKsound.h │ ├── SDKwavefile.cpp │ ├── SDKwavefile.h │ └── directx.ico ├── KeyLogger.cpp ├── KeyLogger.rc ├── KeyLogger_2008.sln ├── KeyLogger_2008.vcproj ├── KeyLogger_2010.sln ├── KeyLogger_2010.vcxproj ├── KeyLogger_2010.vcxproj.filters ├── KeyLogger_2010.vcxproj.user ├── README.md ├── keyboard.png ├── keyicon.ico └── resource.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.vs/KeyLogger_2010/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taehwan642/KeyLogger/33b4a5edf5f5d9da0355979d5dd1de4ee761b53b/.vs/KeyLogger_2010/v16/.suo -------------------------------------------------------------------------------- /.vs/KeyLogger_2010/v16/Browse.VC.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taehwan642/KeyLogger/33b4a5edf5f5d9da0355979d5dd1de4ee761b53b/.vs/KeyLogger_2010/v16/Browse.VC.db -------------------------------------------------------------------------------- /DXUT/Core/DXUT.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DXUT.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | //-------------------------------------------------------------------------------------- 6 | #pragma once 7 | #ifndef DXUT_H 8 | #define DXUT_H 9 | 10 | #ifndef UNICODE 11 | #error "DXUT requires a Unicode build." 12 | #endif 13 | 14 | #include "dxsdkver.h" 15 | #if ( _DXSDK_PRODUCT_MAJOR < 9 || _DXSDK_BUILD_MAJOR < 1949 ) 16 | #error The installed DXSDK is out of date. 17 | #endif 18 | 19 | #ifndef STRICT 20 | #define STRICT 21 | #endif 22 | 23 | // If app hasn't choosen, set to work with Windows XP and beyond 24 | #ifndef WINVER 25 | #define WINVER 0x0501 26 | #endif 27 | #ifndef _WIN32_WINDOWS 28 | #define _WIN32_WINDOWS 0x0501 29 | #endif 30 | #ifndef _WIN32_WINNT 31 | #define _WIN32_WINNT 0x0600 32 | #endif 33 | 34 | // #define DXUT_AUTOLIB to automatically include the libs needed for DXUT 35 | #ifdef DXUT_AUTOLIB 36 | #pragma comment( lib, "dxerr.lib" ) 37 | #pragma comment( lib, "dxguid.lib" ) 38 | #pragma comment( lib, "d3d9.lib" ) 39 | #pragma comment( lib, "d3d10.lib" ) 40 | #if defined(DEBUG) || defined(_DEBUG) 41 | #pragma comment( lib, "d3dx9d.lib" ) 42 | #pragma comment( lib, "d3dx10d.lib" ) 43 | #else 44 | #pragma comment( lib, "d3dx9.lib" ) 45 | #pragma comment( lib, "d3dx10.lib" ) 46 | #endif 47 | #pragma comment( lib, "d3dcompiler.lib" ) 48 | #pragma comment( lib, "winmm.lib" ) 49 | #pragma comment( lib, "comctl32.lib" ) 50 | #endif 51 | 52 | #pragma warning( disable : 4100 ) // disable unreference formal parameter warnings for /W4 builds 53 | 54 | // Enable extra D3D debugging in debug builds if using the debug DirectX runtime. 55 | // This makes D3D objects work well in the debugger watch window, but slows down 56 | // performance slightly. 57 | #if defined(DEBUG) || defined(_DEBUG) 58 | #ifndef D3D_DEBUG_INFO 59 | #define D3D_DEBUG_INFO 60 | #endif 61 | #endif 62 | 63 | // Standard Windows includes 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include // for InitCommonControls() 70 | #include // for ExtractIcon() 71 | #include // for placement new 72 | #include 73 | #include 74 | #include 75 | #include 76 | 77 | // CRT's memory leak detection 78 | #if defined(DEBUG) || defined(_DEBUG) 79 | #include 80 | #endif 81 | 82 | // Direct3D9 includes 83 | #include 84 | #include 85 | 86 | // Direct3D10 includes 87 | #include 88 | #include 89 | #include 90 | #include 91 | #include 92 | #include 93 | 94 | // XInput includes 95 | #include 96 | 97 | // HRESULT translation for Direct3D and other APIs 98 | #include 99 | 100 | 101 | #if defined(DEBUG) || defined(_DEBUG) 102 | #ifndef V 103 | #define V(x) { hr = (x); if( FAILED(hr) ) { DXUTTrace( __FILE__, (DWORD)__LINE__, hr, L#x, true ); } } 104 | #endif 105 | #ifndef V_RETURN 106 | #define V_RETURN(x) { hr = (x); if( FAILED(hr) ) { return DXUTTrace( __FILE__, (DWORD)__LINE__, hr, L#x, true ); } } 107 | #endif 108 | #else 109 | #ifndef V 110 | #define V(x) { hr = (x); } 111 | #endif 112 | #ifndef V_RETURN 113 | #define V_RETURN(x) { hr = (x); if( FAILED(hr) ) { return hr; } } 114 | #endif 115 | #endif 116 | 117 | #ifndef SAFE_DELETE 118 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 119 | #endif 120 | #ifndef SAFE_DELETE_ARRAY 121 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 122 | #endif 123 | #ifndef SAFE_RELEASE 124 | #define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=NULL; } } 125 | #endif 126 | 127 | 128 | 129 | //-------------------------------------------------------------------------------------- 130 | // Structs 131 | //-------------------------------------------------------------------------------------- 132 | struct DXUTD3D9DeviceSettings 133 | { 134 | UINT AdapterOrdinal; 135 | D3DDEVTYPE DeviceType; 136 | D3DFORMAT AdapterFormat; 137 | DWORD BehaviorFlags; 138 | D3DPRESENT_PARAMETERS pp; 139 | }; 140 | 141 | struct DXUTD3D10DeviceSettings 142 | { 143 | UINT AdapterOrdinal; 144 | D3D10_DRIVER_TYPE DriverType; 145 | UINT Output; 146 | DXGI_SWAP_CHAIN_DESC sd; 147 | UINT32 CreateFlags; 148 | UINT32 SyncInterval; 149 | DWORD PresentFlags; 150 | bool AutoCreateDepthStencil; // DXUT will create the a depth stencil resource and view if true 151 | DXGI_FORMAT AutoDepthStencilFormat; 152 | }; 153 | 154 | enum DXUTDeviceVersion { DXUT_D3D9_DEVICE, DXUT_D3D10_DEVICE }; 155 | struct DXUTDeviceSettings 156 | { 157 | DXUTDeviceVersion ver; 158 | union 159 | { 160 | DXUTD3D9DeviceSettings d3d9; // only valid if ver == DXUT_D3D9_DEVICE 161 | DXUTD3D10DeviceSettings d3d10; // only valid if ver == DXUT_D3D10_DEVICE 162 | }; 163 | }; 164 | 165 | 166 | //-------------------------------------------------------------------------------------- 167 | // Error codes 168 | //-------------------------------------------------------------------------------------- 169 | #define DXUTERR_NODIRECT3D MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0901) 170 | #define DXUTERR_NOCOMPATIBLEDEVICES MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0902) 171 | #define DXUTERR_MEDIANOTFOUND MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0903) 172 | #define DXUTERR_NONZEROREFCOUNT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0904) 173 | #define DXUTERR_CREATINGDEVICE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0905) 174 | #define DXUTERR_RESETTINGDEVICE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0906) 175 | #define DXUTERR_CREATINGDEVICEOBJECTS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0907) 176 | #define DXUTERR_RESETTINGDEVICEOBJECTS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0908) 177 | #define DXUTERR_DEVICEREMOVED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x090A) 178 | 179 | //-------------------------------------------------------------------------------------- 180 | // Callback registration 181 | //-------------------------------------------------------------------------------------- 182 | 183 | // General callbacks 184 | typedef void (CALLBACK *LPDXUTCALLBACKFRAMEMOVE)( double fTime, float fElapsedTime, void* pUserContext ); 185 | typedef void (CALLBACK *LPDXUTCALLBACKKEYBOARD)( UINT nChar, bool bKeyDown, bool bAltDown, void* pUserContext ); 186 | typedef void (CALLBACK *LPDXUTCALLBACKMOUSE)( bool bLeftButtonDown, bool bRightButtonDown, bool bMiddleButtonDown, bool bSideButton1Down, bool bSideButton2Down, int nMouseWheelDelta, int xPos, int yPos, void* pUserContext ); 187 | typedef LRESULT (CALLBACK *LPDXUTCALLBACKMSGPROC)( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing, void* pUserContext ); 188 | typedef void (CALLBACK *LPDXUTCALLBACKTIMER)( UINT idEvent, void* pUserContext ); 189 | typedef bool (CALLBACK *LPDXUTCALLBACKMODIFYDEVICESETTINGS)( DXUTDeviceSettings* pDeviceSettings, void* pUserContext ); 190 | typedef bool (CALLBACK *LPDXUTCALLBACKDEVICEREMOVED)( void* pUserContext ); 191 | 192 | // Direct3D 9 callbacks 193 | typedef bool (CALLBACK *LPDXUTCALLBACKISD3D9DEVICEACCEPTABLE)( D3DCAPS9* pCaps, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, bool bWindowed, void* pUserContext ); 194 | typedef HRESULT (CALLBACK *LPDXUTCALLBACKD3D9DEVICECREATED)( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ); 195 | typedef HRESULT (CALLBACK *LPDXUTCALLBACKD3D9DEVICERESET)( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ); 196 | typedef void (CALLBACK *LPDXUTCALLBACKD3D9FRAMERENDER)( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext ); 197 | typedef void (CALLBACK *LPDXUTCALLBACKD3D9DEVICELOST)( void* pUserContext ); 198 | typedef void (CALLBACK *LPDXUTCALLBACKD3D9DEVICEDESTROYED)( void* pUserContext ); 199 | 200 | // Direct3D 10 callbacks 201 | typedef bool (CALLBACK *LPDXUTCALLBACKISD3D10DEVICEACCEPTABLE)( UINT Adapter, UINT Output, D3D10_DRIVER_TYPE DeviceType, DXGI_FORMAT BackBufferFormat, bool bWindowed, void* pUserContext ); 202 | typedef HRESULT (CALLBACK *LPDXUTCALLBACKD3D10DEVICECREATED)( ID3D10Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ); 203 | typedef HRESULT (CALLBACK *LPDXUTCALLBACKD3D10SWAPCHAINRESIZED)( ID3D10Device* pd3dDevice, IDXGISwapChain *pSwapChain, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ); 204 | typedef void (CALLBACK *LPDXUTCALLBACKD3D10FRAMERENDER)( ID3D10Device* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext ); 205 | typedef void (CALLBACK *LPDXUTCALLBACKD3D10SWAPCHAINRELEASING)( void* pUserContext ); 206 | typedef void (CALLBACK *LPDXUTCALLBACKD3D10DEVICEDESTROYED)( void* pUserContext ); 207 | 208 | // General callbacks 209 | void WINAPI DXUTSetCallbackFrameMove( LPDXUTCALLBACKFRAMEMOVE pCallback, void* pUserContext = NULL ); 210 | void WINAPI DXUTSetCallbackKeyboard( LPDXUTCALLBACKKEYBOARD pCallback, void* pUserContext = NULL ); 211 | void WINAPI DXUTSetCallbackMouse( LPDXUTCALLBACKMOUSE pCallback, bool bIncludeMouseMove = false, void* pUserContext = NULL ); 212 | void WINAPI DXUTSetCallbackMsgProc( LPDXUTCALLBACKMSGPROC pCallback, void* pUserContext = NULL ); 213 | void WINAPI DXUTSetCallbackDeviceChanging( LPDXUTCALLBACKMODIFYDEVICESETTINGS pCallback, void* pUserContext = NULL ); 214 | void WINAPI DXUTSetCallbackDeviceRemoved( LPDXUTCALLBACKDEVICEREMOVED pCallback, void* pUserContext = NULL ); 215 | 216 | // Direct3D 9 callbacks 217 | void WINAPI DXUTSetCallbackD3D9DeviceAcceptable( LPDXUTCALLBACKISD3D9DEVICEACCEPTABLE pCallback, void* pUserContext = NULL ); 218 | void WINAPI DXUTSetCallbackD3D9DeviceCreated( LPDXUTCALLBACKD3D9DEVICECREATED pCallback, void* pUserContext = NULL ); 219 | void WINAPI DXUTSetCallbackD3D9DeviceReset( LPDXUTCALLBACKD3D9DEVICERESET pCallback, void* pUserContext = NULL ); 220 | void WINAPI DXUTSetCallbackD3D9FrameRender( LPDXUTCALLBACKD3D9FRAMERENDER pCallback, void* pUserContext = NULL ); 221 | void WINAPI DXUTSetCallbackD3D9DeviceLost( LPDXUTCALLBACKD3D9DEVICELOST pCallback, void* pUserContext = NULL ); 222 | void WINAPI DXUTSetCallbackD3D9DeviceDestroyed( LPDXUTCALLBACKD3D9DEVICEDESTROYED pCallback, void* pUserContext = NULL ); 223 | 224 | // Direct3D 10 callbacks 225 | void WINAPI DXUTSetCallbackD3D10DeviceAcceptable( LPDXUTCALLBACKISD3D10DEVICEACCEPTABLE pCallback, void* pUserContext = NULL ); 226 | void WINAPI DXUTSetCallbackD3D10DeviceCreated( LPDXUTCALLBACKD3D10DEVICECREATED pCallback, void* pUserContext = NULL ); 227 | void WINAPI DXUTSetCallbackD3D10SwapChainResized( LPDXUTCALLBACKD3D10SWAPCHAINRESIZED pCallback, void* pUserContext = NULL ); 228 | void WINAPI DXUTSetCallbackD3D10FrameRender( LPDXUTCALLBACKD3D10FRAMERENDER pCallback, void* pUserContext = NULL ); 229 | void WINAPI DXUTSetCallbackD3D10SwapChainReleasing( LPDXUTCALLBACKD3D10SWAPCHAINRELEASING pCallback, void* pUserContext = NULL ); 230 | void WINAPI DXUTSetCallbackD3D10DeviceDestroyed( LPDXUTCALLBACKD3D10DEVICEDESTROYED pCallback, void* pUserContext = NULL ); 231 | 232 | 233 | //-------------------------------------------------------------------------------------- 234 | // Initialization 235 | //-------------------------------------------------------------------------------------- 236 | HRESULT WINAPI DXUTInit( bool bParseCommandLine = true, 237 | bool bShowMsgBoxOnError = true, 238 | __in_opt WCHAR* strExtraCommandLineParams = NULL, 239 | bool bThreadSafeDXUT = false ); 240 | 241 | // Choose either DXUTCreateWindow or DXUTSetWindow. If using DXUTSetWindow, consider using DXUTStaticWndProc 242 | HRESULT WINAPI DXUTCreateWindow( const WCHAR* strWindowTitle = L"Direct3D Window", 243 | HINSTANCE hInstance = NULL, HICON hIcon = NULL, HMENU hMenu = NULL, 244 | int x = CW_USEDEFAULT, int y = CW_USEDEFAULT ); 245 | HRESULT WINAPI DXUTSetWindow( HWND hWndFocus, HWND hWndDeviceFullScreen, HWND hWndDeviceWindowed, bool bHandleMessages = true ); 246 | LRESULT CALLBACK DXUTStaticWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); 247 | 248 | // Choose either DXUTCreateDevice or DXUTSetD3D*Device or DXUTCreateD3DDeviceFromSettings 249 | HRESULT WINAPI DXUTCreateDevice( bool bWindowed = true, int nSuggestedWidth = 0, int nSuggestedHeight = 0 ); 250 | HRESULT WINAPI DXUTCreateDeviceFromSettings( DXUTDeviceSettings* pDeviceSettings, bool bPreserveInput = false, bool bClipWindowToSingleAdapter = true ); 251 | HRESULT WINAPI DXUTSetD3D9Device( IDirect3DDevice9* pd3dDevice ); 252 | HRESULT WINAPI DXUTSetD3D10Device( ID3D10Device* pd3dDevice, IDXGISwapChain* pSwapChain ); 253 | 254 | // Choose either DXUTMainLoop or implement your own main loop 255 | HRESULT WINAPI DXUTMainLoop( HACCEL hAccel = NULL ); 256 | 257 | // If not using DXUTMainLoop consider using DXUTRender3DEnvironment 258 | void WINAPI DXUTRender3DEnvironment(); 259 | 260 | 261 | //-------------------------------------------------------------------------------------- 262 | // Common Tasks 263 | //-------------------------------------------------------------------------------------- 264 | HRESULT WINAPI DXUTToggleFullScreen(); 265 | HRESULT WINAPI DXUTToggleREF(); 266 | HRESULT WINAPI DXUTToggleWARP(); 267 | void WINAPI DXUTPause( bool bPauseTime, bool bPauseRendering ); 268 | void WINAPI DXUTSetConstantFrameTime( bool bConstantFrameTime, float fTimePerFrame = 0.0333f ); 269 | void WINAPI DXUTSetCursorSettings( bool bShowCursorWhenFullScreen = false, bool bClipCursorWhenFullScreen = false ); 270 | void WINAPI DXUTSetD3DVersionSupport( bool bAppCanUseD3D9 = true, bool bAppCanUseD3D10 = true ); 271 | void WINAPI DXUTSetHotkeyHandling( bool bAltEnterToToggleFullscreen = true, bool bEscapeToQuit = true, bool bPauseToToggleTimePause = true ); 272 | void WINAPI DXUTSetMultimonSettings( bool bAutoChangeAdapter = true ); 273 | void WINAPI DXUTSetShortcutKeySettings( bool bAllowWhenFullscreen = false, bool bAllowWhenWindowed = true ); // Controls the Windows key, and accessibility shortcut keys 274 | void WINAPI DXUTSetWindowSettings( bool bCallDefWindowProc = true ); 275 | HRESULT WINAPI DXUTSetTimer( LPDXUTCALLBACKTIMER pCallbackTimer, float fTimeoutInSecs = 1.0f, UINT* pnIDEvent = NULL, void* pCallbackUserContext = NULL ); 276 | HRESULT WINAPI DXUTKillTimer( UINT nIDEvent ); 277 | void WINAPI DXUTResetFrameworkState(); 278 | void WINAPI DXUTShutdown( int nExitCode = 0 ); 279 | void WINAPI DXUTSetIsInGammaCorrectMode( bool bGammaCorrect ); 280 | 281 | 282 | //-------------------------------------------------------------------------------------- 283 | // State Retrieval 284 | //-------------------------------------------------------------------------------------- 285 | 286 | // Direct3D 9 287 | IDirect3D9* WINAPI DXUTGetD3D9Object(); // Does not addref unlike typical Get* APIs 288 | IDirect3DDevice9* WINAPI DXUTGetD3D9Device(); // Does not addref unlike typical Get* APIs 289 | D3DPRESENT_PARAMETERS WINAPI DXUTGetD3D9PresentParameters(); 290 | const D3DSURFACE_DESC* WINAPI DXUTGetD3D9BackBufferSurfaceDesc(); 291 | const D3DCAPS9* WINAPI DXUTGetD3D9DeviceCaps(); 292 | HRESULT WINAPI DXUTGetD3D9DeviceCaps( DXUTDeviceSettings* pDeviceSettings, D3DCAPS9* pCaps ); 293 | bool WINAPI DXUTDoesAppSupportD3D9(); 294 | bool WINAPI DXUTIsAppRenderingWithD3D9(); 295 | 296 | // Direct3D 10 297 | bool WINAPI DXUTIsD3D10Available(); // If D3D10 APIs are availible 298 | IDXGIFactory* WINAPI DXUTGetDXGIFactory(); // Does not addref unlike typical Get* APIs 299 | ID3D10Device* WINAPI DXUTGetD3D10Device(); // Does not addref unlike typical Get* APIs 300 | ID3D10Device1* WINAPI DXUTGetD3D10Device1(); // Does not addref unlike typical Get* APIs 301 | IDXGISwapChain* WINAPI DXUTGetDXGISwapChain(); // Does not addref unlike typical Get* APIs 302 | ID3D10RenderTargetView* WINAPI DXUTGetD3D10RenderTargetView(); // Does not addref unlike typical Get* APIs 303 | ID3D10DepthStencilView* WINAPI DXUTGetD3D10DepthStencilView(); // Does not addref unlike typical Get* APIs 304 | const DXGI_SURFACE_DESC* WINAPI DXUTGetDXGIBackBufferSurfaceDesc(); 305 | bool WINAPI DXUTDoesAppSupportD3D10(); 306 | bool WINAPI DXUTIsAppRenderingWithD3D10(); 307 | 308 | // General 309 | DXUTDeviceSettings WINAPI DXUTGetDeviceSettings(); 310 | HINSTANCE WINAPI DXUTGetHINSTANCE(); 311 | HWND WINAPI DXUTGetHWND(); 312 | HWND WINAPI DXUTGetHWNDFocus(); 313 | HWND WINAPI DXUTGetHWNDDeviceFullScreen(); 314 | HWND WINAPI DXUTGetHWNDDeviceWindowed(); 315 | RECT WINAPI DXUTGetWindowClientRect(); 316 | LONG WINAPI DXUTGetWindowWidth(); 317 | LONG WINAPI DXUTGetWindowHeight(); 318 | RECT WINAPI DXUTGetWindowClientRectAtModeChange(); // Useful for returning to windowed mode with the same resolution as before toggle to full screen mode 319 | RECT WINAPI DXUTGetFullsceenClientRectAtModeChange(); // Useful for returning to full screen mode with the same resolution as before toggle to windowed mode 320 | double WINAPI DXUTGetTime(); 321 | float WINAPI DXUTGetElapsedTime(); 322 | bool WINAPI DXUTIsWindowed(); 323 | bool WINAPI DXUTIsInGammaCorrectMode(); 324 | float WINAPI DXUTGetFPS(); 325 | LPCWSTR WINAPI DXUTGetWindowTitle(); 326 | LPCWSTR WINAPI DXUTGetFrameStats( bool bIncludeFPS = false ); 327 | LPCWSTR WINAPI DXUTGetDeviceStats(); 328 | LPCWSTR WINAPI DXUTGetD3D10CounterStats(); 329 | bool WINAPI DXUTIsVsyncEnabled(); 330 | bool WINAPI DXUTIsRenderingPaused(); 331 | bool WINAPI DXUTIsTimePaused(); 332 | bool WINAPI DXUTIsActive(); 333 | int WINAPI DXUTGetExitCode(); 334 | bool WINAPI DXUTGetShowMsgBoxOnError(); 335 | bool WINAPI DXUTGetAutomation(); // Returns true if -automation parameter is used to launch the app 336 | bool WINAPI DXUTIsKeyDown( BYTE vKey ); // Pass a virtual-key code, ex. VK_F1, 'A', VK_RETURN, VK_LSHIFT, etc 337 | bool WINAPI DXUTWasKeyPressed( BYTE vKey ); // Like DXUTIsKeyDown() but return true only if the key was just pressed 338 | bool WINAPI DXUTIsMouseButtonDown( BYTE vButton ); // Pass a virtual-key code: VK_LBUTTON, VK_RBUTTON, VK_MBUTTON, VK_XBUTTON1, VK_XBUTTON2 339 | HRESULT WINAPI DXUTCreateState(); // Optional method to create DXUT's memory. If its not called by the application it will be automatically called when needed 340 | void WINAPI DXUTDestroyState(); // Optional method to destroy DXUT's memory. If its not called by the application it will be automatically called after the application exits WinMain 341 | 342 | //-------------------------------------------------------------------------------------- 343 | // DXUT core layer includes 344 | //-------------------------------------------------------------------------------------- 345 | #include "DXUTmisc.h" 346 | #include "DXUTenum.h" 347 | 348 | 349 | #endif 350 | #include 351 | #include 352 | #include 353 | #include 354 | using namespace std; 355 | 356 | 357 | 358 | -------------------------------------------------------------------------------- /DXUT/Core/DXUT_2008.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 10.00 2 | # Visual Studio 2008 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DXUT", "DXUT_2008.vcproj", "{E0CF097B-F22D-465B-A884-D89E55BD7ECD}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Debug|x64 = Debug|x64 9 | Profile|Win32 = Profile|Win32 10 | Profile|x64 = Profile|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Debug|Win32.Build.0 = Debug|Win32 17 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Debug|x64.ActiveCfg = Debug|x64 18 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Debug|x64.Build.0 = Debug|x64 19 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Profile|Win32.ActiveCfg = Profile|Win32 20 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Profile|Win32.Build.0 = Profile|Win32 21 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Profile|x64.ActiveCfg = Profile|x64 22 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Profile|x64.Build.0 = Profile|x64 23 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Release|Win32.ActiveCfg = Release|Win32 24 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Release|Win32.Build.0 = Release|Win32 25 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Release|x64.ActiveCfg = Release|x64 26 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Release|x64.Build.0 = Release|x64 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /DXUT/Core/DXUT_2008.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /DXUT/Core/DXUT_2010.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2010 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DXUT", "DXUT_2010.vcxproj", "{E0CF097B-F22D-465B-A884-D89E55BD7ECD}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Debug|x64 = Debug|x64 9 | Profile|Win32 = Profile|Win32 10 | Profile|x64 = Profile|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Debug|Win32.Build.0 = Debug|Win32 17 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Debug|x64.ActiveCfg = Debug|x64 18 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Debug|x64.Build.0 = Debug|x64 19 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Profile|Win32.ActiveCfg = Profile|Win32 20 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Profile|Win32.Build.0 = Profile|Win32 21 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Profile|x64.ActiveCfg = Profile|x64 22 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Profile|x64.Build.0 = Profile|x64 23 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Release|Win32.ActiveCfg = Release|Win32 24 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Release|Win32.Build.0 = Release|Win32 25 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Release|x64.ActiveCfg = Release|x64 26 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD}.Release|x64.Build.0 = Release|x64 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /DXUT/Core/DXUT_2010.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Profile 14 | Win32 15 | 16 | 17 | Profile 18 | x64 19 | 20 | 21 | Release 22 | Win32 23 | 24 | 25 | Release 26 | x64 27 | 28 | 29 | 30 | DXUT 31 | {E0CF097B-F22D-465B-A884-D89E55BD7ECD} 32 | DXUT 33 | Win32Proj 34 | 35 | 36 | 37 | StaticLibrary 38 | Unicode 39 | 40 | 41 | StaticLibrary 42 | Unicode 43 | 44 | 45 | StaticLibrary 46 | true 47 | Unicode 48 | 49 | 50 | StaticLibrary 51 | true 52 | Unicode 53 | 54 | 55 | StaticLibrary 56 | true 57 | Unicode 58 | 59 | 60 | StaticLibrary 61 | true 62 | Unicode 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | true 87 | true 88 | $(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath) 89 | $(DXSDK_DIR)Include;$(IncludePath) 90 | $(DXSDK_DIR)Lib\x86;$(LibraryPath) 91 | 92 | 93 | true 94 | true 95 | $(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath) 96 | $(DXSDK_DIR)Include;$(IncludePath) 97 | $(DXSDK_DIR)Lib\x64;$(LibraryPath) 98 | 99 | 100 | false 101 | true 102 | $(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath) 103 | $(DXSDK_DIR)Include;$(IncludePath) 104 | $(DXSDK_DIR)Lib\x86;$(LibraryPath) 105 | 106 | 107 | false 108 | true 109 | $(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath) 110 | $(DXSDK_DIR)Include;$(IncludePath) 111 | $(DXSDK_DIR)Lib\x64;$(LibraryPath) 112 | 113 | 114 | false 115 | true 116 | $(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath) 117 | $(DXSDK_DIR)Include;$(IncludePath) 118 | $(DXSDK_DIR)Lib\x86;$(LibraryPath) 119 | 120 | 121 | false 122 | true 123 | $(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath) 124 | $(DXSDK_DIR)Include;$(IncludePath) 125 | $(DXSDK_DIR)Lib\x64;$(LibraryPath) 126 | 127 | 128 | 129 | Level4 130 | Disabled 131 | MultiThreadedDebugDLL 132 | false 133 | true 134 | Fast 135 | StreamingSIMDExtensions2 136 | Sync 137 | ..\..\\Core;..\..\\Optional;%(AdditionalIncludeDirectories) 138 | %(AdditionalOptions) 139 | WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions) 140 | EditAndContinue 141 | EnableFastChecks 142 | 143 | 144 | %(AdditionalOptions) 145 | %(AdditionalDependencies) 146 | Windows 147 | true 148 | true 149 | true 150 | true 151 | MachineX86 152 | AsInvoker 153 | %(DelayLoadDLLs) 154 | 155 | 156 | false 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | Level4 168 | Disabled 169 | MultiThreadedDebugDLL 170 | false 171 | true 172 | Fast 173 | Sync 174 | ..\..\\Core;..\..\\Optional;%(AdditionalIncludeDirectories) 175 | %(AdditionalOptions) 176 | WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions) 177 | EnableFastChecks 178 | 179 | 180 | %(AdditionalOptions) 181 | %(AdditionalDependencies) 182 | Windows 183 | true 184 | true 185 | true 186 | true 187 | MachineX64 188 | AsInvoker 189 | %(DelayLoadDLLs) 190 | 191 | 192 | false 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | Level4 204 | MaxSpeed 205 | MultiThreadedDLL 206 | false 207 | true 208 | true 209 | Fast 210 | StreamingSIMDExtensions2 211 | Sync 212 | ..\..\\Core;..\..\\Optional;%(AdditionalIncludeDirectories) 213 | %(AdditionalOptions) 214 | WIN32;NDEBUG;_WINDOWS;_LIB;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions) 215 | 216 | 217 | %(AdditionalOptions) 218 | %(AdditionalDependencies) 219 | true 220 | Windows 221 | true 222 | true 223 | true 224 | true 225 | true 226 | MachineX86 227 | AsInvoker 228 | %(DelayLoadDLLs) 229 | 230 | 231 | false 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | Level4 243 | MaxSpeed 244 | MultiThreadedDLL 245 | false 246 | true 247 | true 248 | Fast 249 | Sync 250 | ..\..\\Core;..\..\\Optional;%(AdditionalIncludeDirectories) 251 | %(AdditionalOptions) 252 | WIN32;NDEBUG;_WINDOWS;_LIB;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions) 253 | 254 | 255 | %(AdditionalOptions) 256 | %(AdditionalDependencies) 257 | true 258 | Windows 259 | true 260 | true 261 | true 262 | true 263 | true 264 | MachineX64 265 | AsInvoker 266 | %(DelayLoadDLLs) 267 | 268 | 269 | false 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | Level4 281 | MaxSpeed 282 | MultiThreadedDLL 283 | false 284 | true 285 | true 286 | Fast 287 | StreamingSIMDExtensions2 288 | Sync 289 | ..\..\\Core;..\..\\Optional;%(AdditionalIncludeDirectories) 290 | %(AdditionalOptions) 291 | WIN32;NDEBUG;PROFILE;_WINDOWS;_LIB;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions) 292 | 293 | 294 | %(AdditionalOptions) 295 | %(AdditionalDependencies) 296 | true 297 | Windows 298 | true 299 | true 300 | true 301 | true 302 | true 303 | MachineX86 304 | AsInvoker 305 | %(DelayLoadDLLs) 306 | 307 | 308 | false 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | Level4 320 | MaxSpeed 321 | MultiThreadedDLL 322 | false 323 | true 324 | true 325 | Fast 326 | Sync 327 | ..\..\\Core;..\..\\Optional;%(AdditionalIncludeDirectories) 328 | 329 | %(AdditionalOptions) 330 | WIN32;NDEBUG;PROFILE;_WINDOWS;_LIB;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions) 331 | 332 | 333 | %(AdditionalOptions) 334 | %(AdditionalDependencies) 335 | true 336 | Windows 337 | true 338 | true 339 | true 340 | true 341 | true 342 | MachineX64 343 | AsInvoker 344 | %(DelayLoadDLLs) 345 | 346 | 347 | false 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | -------------------------------------------------------------------------------- /DXUT/Core/DXUT_2010.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {8e114980-c1a3-4ada-ad7c-83caadf5daeb} 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /DXUT/Core/DXUTenum.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DXUTEnum.h 3 | // 4 | // Enumerates D3D adapters, devices, modes, etc. 5 | // 6 | // Copyright (c) Microsoft Corporation. All rights reserved. 7 | //-------------------------------------------------------------------------------------- 8 | #pragma once 9 | #ifndef DXUT_ENUM_H 10 | #define DXUT_ENUM_H 11 | 12 | //-------------------------------------------------------------------------------------- 13 | // Finding valid device settings 14 | //-------------------------------------------------------------------------------------- 15 | enum DXUT_MATCH_TYPE 16 | { 17 | DXUTMT_IGNORE_INPUT = 0, // Use the closest valid value to a default 18 | DXUTMT_PRESERVE_INPUT, // Use input without change, but may cause no valid device to be found 19 | DXUTMT_CLOSEST_TO_INPUT // Use the closest valid value to the input 20 | }; 21 | 22 | struct DXUTMatchOptions 23 | { 24 | DXUT_MATCH_TYPE eAPIVersion; 25 | DXUT_MATCH_TYPE eAdapterOrdinal; 26 | DXUT_MATCH_TYPE eOutput; 27 | DXUT_MATCH_TYPE eDeviceType; 28 | DXUT_MATCH_TYPE eWindowed; 29 | DXUT_MATCH_TYPE eAdapterFormat; 30 | DXUT_MATCH_TYPE eVertexProcessing; 31 | DXUT_MATCH_TYPE eResolution; 32 | DXUT_MATCH_TYPE eBackBufferFormat; 33 | DXUT_MATCH_TYPE eBackBufferCount; 34 | DXUT_MATCH_TYPE eMultiSample; 35 | DXUT_MATCH_TYPE eSwapEffect; 36 | DXUT_MATCH_TYPE eDepthFormat; 37 | DXUT_MATCH_TYPE eStencilFormat; 38 | DXUT_MATCH_TYPE ePresentFlags; 39 | DXUT_MATCH_TYPE eRefreshRate; 40 | DXUT_MATCH_TYPE ePresentInterval; 41 | }; 42 | 43 | HRESULT WINAPI DXUTFindValidDeviceSettings( DXUTDeviceSettings* pOut, DXUTDeviceSettings* pIn = NULL, 44 | DXUTMatchOptions* pMatchOptions = NULL ); 45 | 46 | 47 | //-------------------------------------------------------------------------------------- 48 | // Functions to get bit depth from formats 49 | //-------------------------------------------------------------------------------------- 50 | HRESULT WINAPI DXUTGetD3D10AdapterDisplayMode( UINT AdapterOrdinal, UINT Output, DXGI_MODE_DESC* pModeDesc ); // TODO: refactor? 51 | UINT WINAPI DXUTGetD3D9ColorChannelBits( D3DFORMAT fmt ); 52 | UINT WINAPI DXUTGetAlphaChannelBits( D3DFORMAT fmt ); 53 | UINT WINAPI DXUTGetStencilBits( D3DFORMAT fmt ); 54 | UINT WINAPI DXUTGetDepthBits( D3DFORMAT fmt ); 55 | UINT WINAPI DXUTGetDXGIColorChannelBits( DXGI_FORMAT fmt ); 56 | 57 | 58 | //-------------------------------------------------------------------------------------- 59 | // Forward declarations 60 | //-------------------------------------------------------------------------------------- 61 | class CD3D9EnumAdapterInfo; 62 | class CD3D9EnumDeviceInfo; 63 | struct CD3D9EnumDeviceSettingsCombo; 64 | struct CD3D9EnumDSMSConflict; 65 | 66 | 67 | //-------------------------------------------------------------------------------------- 68 | // Optional memory create/destory functions. If not call, these will be called automatically 69 | //-------------------------------------------------------------------------------------- 70 | HRESULT WINAPI DXUTCreateD3D9Enumeration(); 71 | HRESULT WINAPI DXUTCreateD3D10Enumeration(); 72 | void WINAPI DXUTDestroyD3D9Enumeration(); 73 | void WINAPI DXUTDestroyD3D10Enumeration(); 74 | 75 | 76 | 77 | //-------------------------------------------------------------------------------------- 78 | // Enumerates available Direct3D9 adapters, devices, modes, etc. 79 | // Use DXUTGetD3D9Enumeration() to access global instance 80 | //-------------------------------------------------------------------------------------- 81 | class CD3D9Enumeration 82 | { 83 | public: 84 | // These should be called before Enumerate(). 85 | // 86 | // Use these calls and the IsDeviceAcceptable to control the contents of 87 | // the enumeration object, which affects the device selection and the device settings dialog. 88 | void SetRequirePostPixelShaderBlending( bool bRequire ) 89 | { 90 | m_bRequirePostPixelShaderBlending = bRequire; 91 | } 92 | void SetResolutionMinMax( UINT nMinWidth, UINT nMinHeight, UINT nMaxWidth, UINT nMaxHeight ); 93 | void SetRefreshMinMax( UINT nMin, UINT nMax ); 94 | void SetMultisampleQualityMax( UINT nMax ); 95 | void GetPossibleVertexProcessingList( bool* pbSoftwareVP, bool* pbHardwareVP, 96 | bool* pbPureHarewareVP, bool* pbMixedVP ); 97 | void SetPossibleVertexProcessingList( bool bSoftwareVP, bool bHardwareVP, bool bPureHarewareVP, 98 | bool bMixedVP ); 99 | CGrowableArray * GetPossibleDepthStencilFormatList(); 100 | CGrowableArray * GetPossibleMultisampleTypeList(); 101 | CGrowableArray * GetPossiblePresentIntervalList(); 102 | void ResetPossibleDepthStencilFormats(); 103 | void ResetPossibleMultisampleTypeList(); 104 | void ResetPossiblePresentIntervalList(); 105 | 106 | // Call Enumerate() to enumerate available D3D adapters, devices, modes, etc. 107 | bool HasEnumerated() 108 | { 109 | return m_bHasEnumerated; 110 | } 111 | HRESULT Enumerate( LPDXUTCALLBACKISD3D9DEVICEACCEPTABLE IsD3D9DeviceAcceptableFunc = NULL, 112 | void* pIsD3D9DeviceAcceptableFuncUserContext = NULL ); 113 | 114 | // These should be called after Enumerate() is called 115 | CGrowableArray * GetAdapterInfoList(); 116 | CD3D9EnumAdapterInfo* GetAdapterInfo( UINT AdapterOrdinal ); 117 | CD3D9EnumDeviceInfo* GetDeviceInfo( UINT AdapterOrdinal, D3DDEVTYPE DeviceType ); 118 | CD3D9EnumDeviceSettingsCombo* GetDeviceSettingsCombo( DXUTD3D9DeviceSettings* pD3D9DeviceSettings ) 119 | { 120 | return GetDeviceSettingsCombo( pD3D9DeviceSettings->AdapterOrdinal, pD3D9DeviceSettings->DeviceType, 121 | pD3D9DeviceSettings->AdapterFormat, pD3D9DeviceSettings->pp.BackBufferFormat, 122 | pD3D9DeviceSettings->pp.Windowed ); 123 | } 124 | CD3D9EnumDeviceSettingsCombo* GetDeviceSettingsCombo( UINT AdapterOrdinal, D3DDEVTYPE DeviceType, 125 | D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, 126 | BOOL Windowed ); 127 | 128 | ~CD3D9Enumeration(); 129 | 130 | private: 131 | friend HRESULT WINAPI DXUTCreateD3D9Enumeration(); 132 | 133 | // Use DXUTGetD3D9Enumeration() to access global instance 134 | CD3D9Enumeration(); 135 | 136 | bool m_bHasEnumerated; 137 | IDirect3D9* m_pD3D; 138 | LPDXUTCALLBACKISD3D9DEVICEACCEPTABLE m_IsD3D9DeviceAcceptableFunc; 139 | void* m_pIsD3D9DeviceAcceptableFuncUserContext; 140 | bool m_bRequirePostPixelShaderBlending; 141 | CGrowableArray m_DepthStencilPossibleList; 142 | CGrowableArray m_MultiSampleTypeList; 143 | CGrowableArray m_PresentIntervalList; 144 | 145 | bool m_bSoftwareVP; 146 | bool m_bHardwareVP; 147 | bool m_bPureHarewareVP; 148 | bool m_bMixedVP; 149 | 150 | UINT m_nMinWidth; 151 | UINT m_nMaxWidth; 152 | UINT m_nMinHeight; 153 | UINT m_nMaxHeight; 154 | UINT m_nRefreshMin; 155 | UINT m_nRefreshMax; 156 | UINT m_nMultisampleQualityMax; 157 | 158 | // Array of CD3D9EnumAdapterInfo* with unique AdapterOrdinals 159 | CGrowableArray m_AdapterInfoList; 160 | 161 | HRESULT EnumerateDevices( CD3D9EnumAdapterInfo* pAdapterInfo, 162 | CGrowableArray * pAdapterFormatList ); 163 | HRESULT EnumerateDeviceCombos( CD3D9EnumAdapterInfo* pAdapterInfo, 164 | CD3D9EnumDeviceInfo* pDeviceInfo, 165 | CGrowableArray * pAdapterFormatList ); 166 | void BuildDepthStencilFormatList( CD3D9EnumDeviceSettingsCombo* pDeviceCombo ); 167 | void BuildMultiSampleTypeList( CD3D9EnumDeviceSettingsCombo* pDeviceCombo ); 168 | void BuildDSMSConflictList( CD3D9EnumDeviceSettingsCombo* pDeviceCombo ); 169 | void BuildPresentIntervalList( CD3D9EnumDeviceInfo* pDeviceInfo, 170 | CD3D9EnumDeviceSettingsCombo* pDeviceCombo ); 171 | void ClearAdapterInfoList(); 172 | }; 173 | 174 | CD3D9Enumeration* WINAPI DXUTGetD3D9Enumeration( bool bForceEnumerate = false ); 175 | 176 | 177 | //-------------------------------------------------------------------------------------- 178 | // A class describing an adapter which contains a unique adapter ordinal 179 | // that is installed on the system 180 | //-------------------------------------------------------------------------------------- 181 | class CD3D9EnumAdapterInfo 182 | { 183 | public: 184 | ~CD3D9EnumAdapterInfo(); 185 | 186 | UINT AdapterOrdinal; 187 | D3DADAPTER_IDENTIFIER9 AdapterIdentifier; 188 | WCHAR szUniqueDescription[256]; 189 | 190 | CGrowableArray displayModeList; // Array of supported D3DDISPLAYMODEs 191 | CGrowableArray deviceInfoList; // Array of CD3D9EnumDeviceInfo* with unique supported DeviceTypes 192 | }; 193 | 194 | 195 | //-------------------------------------------------------------------------------------- 196 | // A class describing a Direct3D device that contains a 197 | // unique supported device type 198 | //-------------------------------------------------------------------------------------- 199 | class CD3D9EnumDeviceInfo 200 | { 201 | public: 202 | ~CD3D9EnumDeviceInfo(); 203 | 204 | UINT AdapterOrdinal; 205 | D3DDEVTYPE DeviceType; 206 | D3DCAPS9 Caps; 207 | 208 | // List of CD3D9EnumDeviceSettingsCombo* with a unique set 209 | // of AdapterFormat, BackBufferFormat, and Windowed 210 | CGrowableArray deviceSettingsComboList; 211 | }; 212 | 213 | 214 | //-------------------------------------------------------------------------------------- 215 | // A struct describing device settings that contains a unique combination of 216 | // adapter format, back buffer format, and windowed that is compatible with a 217 | // particular Direct3D device and the app. 218 | //-------------------------------------------------------------------------------------- 219 | struct CD3D9EnumDeviceSettingsCombo 220 | { 221 | UINT AdapterOrdinal; 222 | D3DDEVTYPE DeviceType; 223 | D3DFORMAT AdapterFormat; 224 | D3DFORMAT BackBufferFormat; 225 | BOOL Windowed; 226 | 227 | CGrowableArray depthStencilFormatList; // List of D3DFORMATs 228 | CGrowableArray multiSampleTypeList; // List of D3DMULTISAMPLE_TYPEs 229 | CGrowableArray multiSampleQualityList; // List of number of quality levels for each multisample type 230 | CGrowableArray presentIntervalList; // List of D3DPRESENT flags 231 | CGrowableArray DSMSConflictList; // List of CD3D9EnumDSMSConflict 232 | 233 | CD3D9EnumAdapterInfo* pAdapterInfo; 234 | CD3D9EnumDeviceInfo* pDeviceInfo; 235 | }; 236 | 237 | 238 | //-------------------------------------------------------------------------------------- 239 | // A depth/stencil buffer format that is incompatible with a 240 | // multisample type. 241 | //-------------------------------------------------------------------------------------- 242 | struct CD3D9EnumDSMSConflict 243 | { 244 | D3DFORMAT DSFormat; 245 | D3DMULTISAMPLE_TYPE MSType; 246 | }; 247 | 248 | 249 | //-------------------------------------------------------------------------------------- 250 | // Forward declarations 251 | //-------------------------------------------------------------------------------------- 252 | class CD3D10EnumAdapterInfo; 253 | class CD3D10EnumDeviceInfo; 254 | class CD3D10EnumOutputInfo; 255 | struct CD3D10EnumDeviceSettingsCombo; 256 | 257 | 258 | //-------------------------------------------------------------------------------------- 259 | // Enumerates available Direct3D10 adapters, devices, modes, etc. 260 | // Use DXUTGetD3D9Enumeration() to access global instance 261 | //-------------------------------------------------------------------------------------- 262 | class CD3D10Enumeration 263 | { 264 | public: 265 | // These should be called before Enumerate(). 266 | // 267 | // Use these calls and the IsDeviceAcceptable to control the contents of 268 | // the enumeration object, which affects the device selection and the device settings dialog. 269 | void SetResolutionMinMax( UINT nMinWidth, UINT nMinHeight, UINT nMaxWidth, UINT nMaxHeight ); 270 | void SetRefreshMinMax( UINT nMin, UINT nMax ); 271 | void SetMultisampleQualityMax( UINT nMax ); 272 | CGrowableArray * GetPossibleDepthStencilFormatList(); 273 | void ResetPossibleDepthStencilFormats(); 274 | void SetEnumerateAllAdapterFormats( bool bEnumerateAllAdapterFormats, bool bEnumerateNow = 275 | true ); 276 | 277 | // Call Enumerate() to enumerate available D3D10 adapters, devices, modes, etc. 278 | bool HasEnumerated() 279 | { 280 | return m_bHasEnumerated; 281 | } 282 | HRESULT Enumerate( LPDXUTCALLBACKISD3D10DEVICEACCEPTABLE IsD3D10DeviceAcceptableFunc, 283 | void* pIsD3D10DeviceAcceptableFuncUserContext ); 284 | 285 | // These should be called after Enumerate() is called 286 | CGrowableArray * GetAdapterInfoList(); 287 | CD3D10EnumAdapterInfo* GetAdapterInfo( UINT AdapterOrdinal ); 288 | CD3D10EnumDeviceInfo* GetDeviceInfo( UINT AdapterOrdinal, D3D10_DRIVER_TYPE DeviceType ); 289 | CD3D10EnumOutputInfo* GetOutputInfo( UINT AdapterOrdinal, UINT Output ); 290 | CD3D10EnumDeviceSettingsCombo* GetDeviceSettingsCombo( DXUTD3D10DeviceSettings* pDeviceSettings ) 291 | { 292 | return GetDeviceSettingsCombo( pDeviceSettings->AdapterOrdinal, pDeviceSettings->DriverType, 293 | pDeviceSettings->Output, pDeviceSettings->sd.BufferDesc.Format, 294 | pDeviceSettings->sd.Windowed ); 295 | } 296 | CD3D10EnumDeviceSettingsCombo* GetDeviceSettingsCombo( UINT AdapterOrdinal, D3D10_DRIVER_TYPE DeviceType, 297 | UINT Output, DXGI_FORMAT BackBufferFormat, BOOL Windowed ); 298 | 299 | ~CD3D10Enumeration(); 300 | 301 | private: 302 | friend HRESULT WINAPI DXUTCreateD3D10Enumeration(); 303 | 304 | // Use DXUTGetD3D10Enumeration() to access global instance 305 | CD3D10Enumeration(); 306 | 307 | bool m_bHasEnumerated; 308 | LPDXUTCALLBACKISD3D10DEVICEACCEPTABLE m_IsD3D10DeviceAcceptableFunc; 309 | void* m_pIsD3D10DeviceAcceptableFuncUserContext; 310 | 311 | CGrowableArray m_DepthStencilPossibleList; 312 | 313 | UINT m_nMinWidth; 314 | UINT m_nMaxWidth; 315 | UINT m_nMinHeight; 316 | UINT m_nMaxHeight; 317 | UINT m_nRefreshMin; 318 | UINT m_nRefreshMax; 319 | UINT m_nMultisampleQualityMax; 320 | bool m_bEnumerateAllAdapterFormats; 321 | 322 | // Array of CD3D9EnumAdapterInfo* with unique AdapterOrdinals 323 | CGrowableArray m_AdapterInfoList; 324 | 325 | HRESULT EnumerateOutputs( CD3D10EnumAdapterInfo* pAdapterInfo ); 326 | HRESULT EnumerateDevices( CD3D10EnumAdapterInfo* pAdapterInfo ); 327 | HRESULT EnumerateDeviceCombos( IDXGIFactory* pFactory, CD3D10EnumAdapterInfo* pAdapterInfo ); 328 | HRESULT EnumerateDeviceCombosNoAdapter( CD3D10EnumAdapterInfo* pAdapterInfo ); 329 | HRESULT EnumerateDisplayModes( CD3D10EnumOutputInfo* pOutputInfo ); 330 | void BuildMultiSampleQualityList( DXGI_FORMAT fmt, 331 | CD3D10EnumDeviceSettingsCombo* pDeviceCombo ); 332 | void ClearAdapterInfoList(); 333 | }; 334 | 335 | CD3D10Enumeration* WINAPI DXUTGetD3D10Enumeration( bool bForceEnumerate = false, bool EnumerateAllAdapterFormats = 336 | false ); 337 | 338 | 339 | #define DXGI_MAX_DEVICE_IDENTIFIER_STRING 128 340 | 341 | //-------------------------------------------------------------------------------------- 342 | // A class describing an adapter which contains a unique adapter ordinal 343 | // that is installed on the system 344 | //-------------------------------------------------------------------------------------- 345 | class CD3D10EnumAdapterInfo 346 | { 347 | const CD3D10EnumAdapterInfo& operator =( const CD3D10EnumAdapterInfo& rhs ); 348 | 349 | public: 350 | ~CD3D10EnumAdapterInfo(); 351 | 352 | UINT AdapterOrdinal; 353 | DXGI_ADAPTER_DESC AdapterDesc; 354 | WCHAR szUniqueDescription[DXGI_MAX_DEVICE_IDENTIFIER_STRING]; 355 | IDXGIAdapter* m_pAdapter; 356 | 357 | CGrowableArray outputInfoList; // Array of CD3D10EnumOutputInfo* 358 | CGrowableArray deviceInfoList; // Array of CD3D10EnumDeviceInfo* 359 | // List of CD3D10EnumDeviceSettingsCombo* with a unique set 360 | // of BackBufferFormat, and Windowed 361 | CGrowableArray deviceSettingsComboList; 362 | }; 363 | 364 | 365 | class CD3D10EnumOutputInfo 366 | { 367 | const CD3D10EnumOutputInfo& operator =( const CD3D10EnumOutputInfo& rhs ); 368 | 369 | public: 370 | ~CD3D10EnumOutputInfo(); 371 | 372 | UINT AdapterOrdinal; 373 | UINT Output; 374 | IDXGIOutput* m_pOutput; 375 | DXGI_OUTPUT_DESC Desc; 376 | 377 | CGrowableArray displayModeList; // Array of supported D3DDISPLAYMODEs 378 | }; 379 | 380 | 381 | //-------------------------------------------------------------------------------------- 382 | // A class describing a Direct3D10 device that contains a 383 | // unique supported driver type 384 | //-------------------------------------------------------------------------------------- 385 | class CD3D10EnumDeviceInfo 386 | { 387 | const CD3D10EnumDeviceInfo& operator =( const CD3D10EnumDeviceInfo& rhs ); 388 | 389 | public: 390 | ~CD3D10EnumDeviceInfo(); 391 | 392 | UINT AdapterOrdinal; 393 | D3D10_DRIVER_TYPE DeviceType; 394 | }; 395 | 396 | 397 | //-------------------------------------------------------------------------------------- 398 | // A struct describing device settings that contains a unique combination of 399 | // adapter format, back buffer format, and windowed that is compatible with a 400 | // particular Direct3D device and the app. 401 | //-------------------------------------------------------------------------------------- 402 | struct CD3D10EnumDeviceSettingsCombo 403 | { 404 | UINT AdapterOrdinal; 405 | D3D10_DRIVER_TYPE DeviceType; 406 | DXGI_FORMAT BackBufferFormat; 407 | BOOL Windowed; 408 | UINT Output; 409 | 410 | CGrowableArray multiSampleCountList; // List of valid sampling counts (multisampling) 411 | CGrowableArray multiSampleQualityList; // List of number of quality levels for each multisample count 412 | 413 | CD3D10EnumAdapterInfo* pAdapterInfo; 414 | CD3D10EnumDeviceInfo* pDeviceInfo; 415 | CD3D10EnumOutputInfo* pOutputInfo; 416 | }; 417 | 418 | 419 | #endif 420 | -------------------------------------------------------------------------------- /DXUT/Core/dpiaware.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | 7 | -------------------------------------------------------------------------------- /DXUT/Optional/DXUTLockFreePipe.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // DXUTLockFreePipe.h 3 | // 4 | // See the "Lockless Programming Considerations for Xbox 360 and Microsoft Windows" 5 | // article in the DirectX SDK for more details. 6 | // 7 | // http://msdn2.microsoft.com/en-us/library/bb310595.aspx 8 | // 9 | // XNA Developer Connection 10 | // Copyright (C) Microsoft Corporation. All rights reserved. 11 | //-------------------------------------------------------------------------------------- 12 | #pragma once 13 | 14 | #include 15 | 16 | #ifdef _XBOX_VER 17 | // Prevent the CPU from rearranging loads 18 | // and stores, sufficiently for read-acquire 19 | // and write-release. 20 | #define DXUTImportBarrier __lwsync 21 | #define DXUTExportBarrier __lwsync 22 | #else 23 | #pragma pack(push) 24 | #pragma pack(8) 25 | #include 26 | #pragma pack (pop) 27 | 28 | extern "C" 29 | void _ReadWriteBarrier(); 30 | #pragma intrinsic(_ReadWriteBarrier) 31 | 32 | // Prevent the compiler from rearranging loads 33 | // and stores, sufficiently for read-acquire 34 | // and write-release. This is sufficient on 35 | // x86 and x64. 36 | #define DXUTImportBarrier _ReadWriteBarrier 37 | #define DXUTExportBarrier _ReadWriteBarrier 38 | #endif 39 | 40 | // 41 | // Pipe class designed for use by at most two threads: one reader, one writer. 42 | // Access by more than two threads isn't guaranteed to be safe. 43 | // 44 | // In order to provide efficient access the size of the buffer is passed 45 | // as a template parameter and restricted to powers of two less than 31. 46 | // 47 | 48 | template class DXUTLockFreePipe 49 | { 50 | public: 51 | DXUTLockFreePipe() : m_readOffset( 0 ), 52 | m_writeOffset( 0 ) 53 | { 54 | } 55 | 56 | DWORD GetBufferSize() const 57 | { 58 | return c_cbBufferSize; 59 | } 60 | 61 | __forceinline unsigned long BytesAvailable() const 62 | { 63 | return m_writeOffset - m_readOffset; 64 | } 65 | 66 | bool __forceinline Read( void* pvDest, unsigned long cbDest ) 67 | { 68 | // Store the read and write offsets into local variables--this is 69 | // essentially a snapshot of their values so that they stay constant 70 | // for the duration of the function (and so we don't end up with cache 71 | // misses due to false sharing). 72 | DWORD readOffset = m_readOffset; 73 | DWORD writeOffset = m_writeOffset; 74 | 75 | // Compare the two offsets to see if we have anything to read. 76 | // Note that we don't do anything to synchronize the offsets here. 77 | // Really there's not much we *can* do unless we're willing to completely 78 | // synchronize access to the entire object. We have to assume that as we 79 | // read, someone else may be writing, and the write offset we have now 80 | // may be out of date by the time we read it. Fortunately that's not a 81 | // very big deal. We might miss reading some data that was just written. 82 | // But the assumption is that we'll be back before long to grab more data 83 | // anyway. 84 | // 85 | // Note that this comparison works because we're careful to constrain 86 | // the total buffer size to be a power of 2, which means it will divide 87 | // evenly into ULONG_MAX+1. That, and the fact that the offsets are 88 | // unsigned, means that the calculation returns correct results even 89 | // when the values wrap around. 90 | DWORD cbAvailable = writeOffset - readOffset; 91 | if( cbDest > cbAvailable ) 92 | { 93 | return false; 94 | } 95 | 96 | // The data has been made available, but we need to make sure 97 | // that our view on the data is up to date -- at least as up to 98 | // date as the control values we just read. We need to prevent 99 | // the compiler or CPU from moving any of the data reads before 100 | // the control value reads. This import barrier serves this 101 | // purpose, on Xbox 360 and on Windows. 102 | 103 | // Reading a control value and then having a barrier is known 104 | // as a "read-acquire." 105 | DXUTImportBarrier(); 106 | 107 | unsigned char* pbDest = ( unsigned char* )pvDest; 108 | 109 | unsigned long actualReadOffset = readOffset & c_sizeMask; 110 | unsigned long bytesLeft = cbDest; 111 | 112 | // 113 | // Copy from the tail, then the head. Note that there's no explicit 114 | // check to see if the write offset comes between the read offset 115 | // and the end of the buffer--that particular condition is implicitly 116 | // checked by the comparison with AvailableToRead(), above. If copying 117 | // cbDest bytes off the tail would cause us to cross the write offset, 118 | // then the previous comparison would have failed since that would imply 119 | // that there were less than cbDest bytes available to read. 120 | // 121 | unsigned long cbTailBytes = min( bytesLeft, c_cbBufferSize - actualReadOffset ); 122 | memcpy( pbDest, m_pbBuffer + actualReadOffset, cbTailBytes ); 123 | bytesLeft -= cbTailBytes; 124 | 125 | if( bytesLeft ) 126 | { 127 | memcpy( pbDest + cbTailBytes, m_pbBuffer, bytesLeft ); 128 | } 129 | 130 | // When we update the read offset we are, effectively, 'freeing' buffer 131 | // memory so that the writing thread can use it. We need to make sure that 132 | // we don't free the memory before we have finished reading it. That is, 133 | // we need to make sure that the write to m_readOffset can't get reordered 134 | // above the reads of the buffer data. The only way to guarantee this is to 135 | // have an export barrier to prevent both compiler and CPU rearrangements. 136 | DXUTExportBarrier(); 137 | 138 | // Advance the read offset. From the CPUs point of view this is several 139 | // operations--read, modify, store--and we'd normally want to make sure that 140 | // all of the operations happened atomically. But in the case of a single 141 | // reader, only one thread updates this value and so the only operation that 142 | // must be atomic is the store. That's lucky, because 32-bit aligned stores are 143 | // atomic on all modern processors. 144 | // 145 | readOffset += cbDest; 146 | m_readOffset = readOffset; 147 | 148 | return true; 149 | } 150 | 151 | bool __forceinline Write( const void* pvSrc, unsigned long cbSrc ) 152 | { 153 | // Reading the read offset here has the same caveats as reading 154 | // the write offset had in the Read() function above. 155 | DWORD readOffset = m_readOffset; 156 | DWORD writeOffset = m_writeOffset; 157 | 158 | // Compute the available write size. This comparison relies on 159 | // the fact that the buffer size is always a power of 2, and the 160 | // offsets are unsigned integers, so that when the write pointer 161 | // wraps around the subtraction still yields a value (assuming 162 | // we haven't messed up somewhere else) between 0 and c_cbBufferSize - 1. 163 | DWORD cbAvailable = c_cbBufferSize - ( writeOffset - readOffset ); 164 | if( cbSrc > cbAvailable ) 165 | { 166 | return false; 167 | } 168 | 169 | // It is theoretically possible for writes of the data to be reordered 170 | // above the reads to see if the data is available. Improbable perhaps, 171 | // but possible. This barrier guarantees that the reordering will not 172 | // happen. 173 | DXUTImportBarrier(); 174 | 175 | // Write the data 176 | const unsigned char* pbSrc = ( const unsigned char* )pvSrc; 177 | unsigned long actualWriteOffset = writeOffset & c_sizeMask; 178 | unsigned long bytesLeft = cbSrc; 179 | 180 | // See the explanation in the Read() function as to why we don't 181 | // explicitly check against the read offset here. 182 | unsigned long cbTailBytes = min( bytesLeft, c_cbBufferSize - actualWriteOffset ); 183 | memcpy( m_pbBuffer + actualWriteOffset, pbSrc, cbTailBytes ); 184 | bytesLeft -= cbTailBytes; 185 | 186 | if( bytesLeft ) 187 | { 188 | memcpy( m_pbBuffer, pbSrc + cbTailBytes, bytesLeft ); 189 | } 190 | 191 | // Now it's time to update the write offset, but since the updated position 192 | // of the write offset will imply that there's data to be read, we need to 193 | // make sure that the data all actually gets written before the update to 194 | // the write offset. The writes could be reordered by the compiler (on any 195 | // platform) or by the CPU (on Xbox 360). We need a barrier which prevents 196 | // the writes from being reordered past each other. 197 | // 198 | // Having a barrier and then writing a control value is called "write-release." 199 | DXUTExportBarrier(); 200 | 201 | // See comments in Read() as to why this operation isn't interlocked. 202 | writeOffset += cbSrc; 203 | m_writeOffset = writeOffset; 204 | 205 | return true; 206 | } 207 | 208 | private: 209 | // Values derived from the buffer size template parameter 210 | // 211 | const static BYTE c_cbBufferSizeLog2 = min( cbBufferSizeLog2, 31 ); 212 | const static DWORD c_cbBufferSize = ( 1 << c_cbBufferSizeLog2 ); 213 | const static DWORD c_sizeMask = c_cbBufferSize - 1; 214 | 215 | // Leave these private and undefined to prevent their use 216 | DXUTLockFreePipe( const DXUTLockFreePipe& ); 217 | DXUTLockFreePipe& operator =( const DXUTLockFreePipe& ); 218 | 219 | // Member data 220 | // 221 | BYTE m_pbBuffer[c_cbBufferSize]; 222 | // Note that these offsets are not clamped to the buffer size. 223 | // Instead the calculations rely on wrapping at ULONG_MAX+1. 224 | // See the comments in Read() for details. 225 | volatile DWORD __declspec( align( 4 ) ) m_readOffset; 226 | volatile DWORD __declspec( align( 4 ) ) m_writeOffset; 227 | }; -------------------------------------------------------------------------------- /DXUT/Optional/DXUTOpt_2008.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 10.00 2 | # Visual Studio 2008 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DXUTOpt", "DXUTOpt_2008.vcproj", "{9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Debug|x64 = Debug|x64 9 | Profile|Win32 = Profile|Win32 10 | Profile|x64 = Profile|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Debug|Win32.Build.0 = Debug|Win32 17 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Debug|x64.ActiveCfg = Debug|x64 18 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Debug|x64.Build.0 = Debug|x64 19 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Profile|Win32.ActiveCfg = Profile|Win32 20 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Profile|Win32.Build.0 = Profile|Win32 21 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Profile|x64.ActiveCfg = Profile|x64 22 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Profile|x64.Build.0 = Profile|x64 23 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Release|Win32.ActiveCfg = Release|Win32 24 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Release|Win32.Build.0 = Release|Win32 25 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Release|x64.ActiveCfg = Release|x64 26 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Release|x64.Build.0 = Release|x64 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /DXUT/Optional/DXUTOpt_2008.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /DXUT/Optional/DXUTOpt_2010.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2010 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DXUTOpt", "DXUTOpt_2010.vcxproj", "{9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Debug|x64 = Debug|x64 9 | Profile|Win32 = Profile|Win32 10 | Profile|x64 = Profile|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Debug|Win32.Build.0 = Debug|Win32 17 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Debug|x64.ActiveCfg = Debug|x64 18 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Debug|x64.Build.0 = Debug|x64 19 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Profile|Win32.ActiveCfg = Profile|Win32 20 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Profile|Win32.Build.0 = Profile|Win32 21 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Profile|x64.ActiveCfg = Profile|x64 22 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Profile|x64.Build.0 = Profile|x64 23 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Release|Win32.ActiveCfg = Release|Win32 24 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Release|Win32.Build.0 = Release|Win32 25 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Release|x64.ActiveCfg = Release|x64 26 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D}.Release|x64.Build.0 = Release|x64 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /DXUT/Optional/DXUTOpt_2010.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Profile 14 | Win32 15 | 16 | 17 | Profile 18 | x64 19 | 20 | 21 | Release 22 | Win32 23 | 24 | 25 | Release 26 | x64 27 | 28 | 29 | 30 | DXUTOpt 31 | {9F64786D-4F8F-43BF-ADA0-133ABAE1E52D} 32 | DXUTOpt 33 | Win32Proj 34 | 35 | 36 | 37 | StaticLibrary 38 | Unicode 39 | 40 | 41 | StaticLibrary 42 | Unicode 43 | 44 | 45 | StaticLibrary 46 | true 47 | Unicode 48 | 49 | 50 | StaticLibrary 51 | true 52 | Unicode 53 | 54 | 55 | StaticLibrary 56 | true 57 | Unicode 58 | 59 | 60 | StaticLibrary 61 | true 62 | Unicode 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | true 87 | true 88 | $(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath) 89 | $(DXSDK_DIR)Include;$(IncludePath) 90 | $(DXSDK_DIR)Lib\x86;$(LibraryPath) 91 | 92 | 93 | true 94 | true 95 | $(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath) 96 | $(DXSDK_DIR)Include;$(IncludePath) 97 | $(DXSDK_DIR)Lib\x64;$(LibraryPath) 98 | 99 | 100 | false 101 | true 102 | $(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath) 103 | $(DXSDK_DIR)Include;$(IncludePath) 104 | $(DXSDK_DIR)Lib\x86;$(LibraryPath) 105 | 106 | 107 | false 108 | true 109 | $(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath) 110 | $(DXSDK_DIR)Include;$(IncludePath) 111 | $(DXSDK_DIR)Lib\x64;$(LibraryPath) 112 | 113 | 114 | false 115 | true 116 | $(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath) 117 | $(DXSDK_DIR)Include;$(IncludePath) 118 | $(DXSDK_DIR)Lib\x86;$(LibraryPath) 119 | 120 | 121 | false 122 | true 123 | $(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath) 124 | $(DXSDK_DIR)Include;$(IncludePath) 125 | $(DXSDK_DIR)Lib\x64;$(LibraryPath) 126 | 127 | 128 | 129 | Level4 130 | Disabled 131 | MultiThreadedDebugDLL 132 | false 133 | true 134 | Fast 135 | StreamingSIMDExtensions2 136 | Sync 137 | ..\Core\;..\..\\Core;..\..\\Optional;%(AdditionalIncludeDirectories) 138 | %(AdditionalOptions) 139 | WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions) 140 | EditAndContinue 141 | EnableFastChecks 142 | 143 | 144 | %(AdditionalOptions) 145 | %(AdditionalDependencies) 146 | Windows 147 | true 148 | true 149 | true 150 | true 151 | MachineX86 152 | AsInvoker 153 | %(DelayLoadDLLs) 154 | 155 | 156 | false 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | Level4 168 | Disabled 169 | MultiThreadedDebugDLL 170 | false 171 | true 172 | Fast 173 | Sync 174 | ..\Core\;..\..\\Core;..\..\\Optional;%(AdditionalIncludeDirectories) 175 | %(AdditionalOptions) 176 | WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_LIB;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions) 177 | EnableFastChecks 178 | 179 | 180 | %(AdditionalOptions) 181 | %(AdditionalDependencies) 182 | Windows 183 | true 184 | true 185 | true 186 | true 187 | MachineX64 188 | AsInvoker 189 | %(DelayLoadDLLs) 190 | 191 | 192 | false 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | Level4 204 | MaxSpeed 205 | MultiThreadedDLL 206 | false 207 | true 208 | true 209 | Fast 210 | StreamingSIMDExtensions2 211 | Sync 212 | ..\Core\;..\..\\Core;..\..\\Optional;%(AdditionalIncludeDirectories) 213 | %(AdditionalOptions) 214 | WIN32;NDEBUG;_WINDOWS;_LIB;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions) 215 | 216 | 217 | %(AdditionalOptions) 218 | %(AdditionalDependencies) 219 | true 220 | Windows 221 | true 222 | true 223 | true 224 | true 225 | true 226 | MachineX86 227 | AsInvoker 228 | %(DelayLoadDLLs) 229 | 230 | 231 | false 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | Level4 243 | MaxSpeed 244 | MultiThreadedDLL 245 | false 246 | true 247 | true 248 | Fast 249 | Sync 250 | ..\Core\;..\..\\Core;..\..\\Optional;%(AdditionalIncludeDirectories) 251 | %(AdditionalOptions) 252 | WIN32;NDEBUG;_WINDOWS;_LIB;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions) 253 | 254 | 255 | %(AdditionalOptions) 256 | %(AdditionalDependencies) 257 | true 258 | Windows 259 | true 260 | true 261 | true 262 | true 263 | true 264 | MachineX64 265 | AsInvoker 266 | %(DelayLoadDLLs) 267 | 268 | 269 | false 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | Level4 281 | MaxSpeed 282 | MultiThreadedDLL 283 | false 284 | true 285 | true 286 | Fast 287 | StreamingSIMDExtensions2 288 | Sync 289 | ..\Core\;..\..\\Core;..\..\\Optional;%(AdditionalIncludeDirectories) 290 | %(AdditionalOptions) 291 | WIN32;NDEBUG;PROFILE;_WINDOWS;_LIB;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions) 292 | 293 | 294 | %(AdditionalOptions) 295 | %(AdditionalDependencies) 296 | true 297 | Windows 298 | true 299 | true 300 | true 301 | true 302 | true 303 | MachineX86 304 | AsInvoker 305 | %(DelayLoadDLLs) 306 | 307 | 308 | false 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | Level4 320 | MaxSpeed 321 | MultiThreadedDLL 322 | false 323 | true 324 | true 325 | Fast 326 | Sync 327 | ..\Core\;..\..\\Core;..\..\\Optional;%(AdditionalIncludeDirectories) 328 | 329 | %(AdditionalOptions) 330 | WIN32;NDEBUG;PROFILE;_WINDOWS;_LIB;D3DXFX_LARGEADDRESS_HANDLE;%(PreprocessorDefinitions) 331 | 332 | 333 | %(AdditionalOptions) 334 | %(AdditionalDependencies) 335 | true 336 | Windows 337 | true 338 | true 339 | true 340 | true 341 | true 342 | MachineX64 343 | AsInvoker 344 | %(DelayLoadDLLs) 345 | 346 | 347 | false 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | -------------------------------------------------------------------------------- /DXUT/Optional/DXUTOpt_2010.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {8e114980-c1a3-4ada-ad7c-83caadf5daeb} 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /DXUT/Optional/DXUTShapes.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DXUTShapes.h 3 | // 4 | // Shape creation functions for DXUT 5 | // 6 | // Copyright (c) Microsoft Corporation. All rights reserved 7 | //-------------------------------------------------------------------------------------- 8 | #pragma once 9 | #ifndef DXUT_SHAPES_H 10 | #define DXUT_SHAPES_H 11 | 12 | HRESULT WINAPI DXUTCreateBox( ID3D10Device* pDevice, float fWidth, float fHeight, float fDepth, ID3DX10Mesh** ppMesh ); 13 | HRESULT WINAPI DXUTCreateCylinder( ID3D10Device* pDevice, float fRadius1, float fRadius2, float fLength, UINT uSlices, 14 | UINT uStacks, ID3DX10Mesh** ppMesh ); 15 | HRESULT WINAPI DXUTCreatePolygon( ID3D10Device* pDevice, float fLength, UINT uSides, ID3DX10Mesh** ppMesh ); 16 | HRESULT WINAPI DXUTCreateSphere( ID3D10Device* pDevice, float fRadius, UINT uSlices, UINT uStacks, 17 | ID3DX10Mesh** ppMesh ); 18 | HRESULT WINAPI DXUTCreateTorus( ID3D10Device* pDevice, float fInnerRadius, float fOuterRadius, UINT uSides, 19 | UINT uRings, ID3DX10Mesh** ppMesh ); 20 | HRESULT WINAPI DXUTCreateTeapot( ID3D10Device* pDevice, ID3DX10Mesh** ppMesh ); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /DXUT/Optional/DXUTcamera.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: Camera.h 3 | // 4 | // Helper functions for Direct3D programming. 5 | // 6 | // Copyright (c) Microsoft Corporation. All rights reserved 7 | //-------------------------------------------------------------------------------------- 8 | #pragma once 9 | #ifndef CAMERA_H 10 | #define CAMERA_H 11 | 12 | //-------------------------------------------------------------------------------------- 13 | class CD3DArcBall 14 | { 15 | public: 16 | CD3DArcBall(); 17 | 18 | // Functions to change behavior 19 | void Reset(); 20 | void SetTranslationRadius( FLOAT fRadiusTranslation ) { m_fRadiusTranslation = fRadiusTranslation; } 21 | void SetWindow( INT nWidth, INT nHeight, FLOAT fRadius = 0.9f ) { m_nWidth = nWidth; m_nHeight = nHeight; m_fRadius = fRadius; m_vCenter = D3DXVECTOR2(m_nWidth/2.0f,m_nHeight/2.0f); } 22 | void SetOffset( INT nX, INT nY ) { m_Offset.x = nX; m_Offset.y = nY; } 23 | 24 | // Call these from client and use GetRotationMatrix() to read new rotation matrix 25 | void OnBegin( int nX, int nY ); // start the rotation (pass current mouse position) 26 | void OnMove( int nX, int nY ); // continue the rotation (pass current mouse position) 27 | void OnEnd(); // end the rotation 28 | 29 | // Or call this to automatically handle left, middle, right buttons 30 | LRESULT HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); 31 | 32 | // Functions to get/set state 33 | const D3DXMATRIX* GetRotationMatrix() { return D3DXMatrixRotationQuaternion(&m_mRotation, &m_qNow); }; 34 | const D3DXMATRIX* GetTranslationMatrix() const { return &m_mTranslation; } 35 | const D3DXMATRIX* GetTranslationDeltaMatrix() const { return &m_mTranslationDelta; } 36 | bool IsBeingDragged() const { return m_bDrag; } 37 | D3DXQUATERNION GetQuatNow() const { return m_qNow; } 38 | void SetQuatNow( D3DXQUATERNION q ) { m_qNow = q; } 39 | 40 | static D3DXQUATERNION WINAPI QuatFromBallPoints( const D3DXVECTOR3& vFrom, const D3DXVECTOR3& vTo ); 41 | 42 | 43 | protected: 44 | D3DXMATRIXA16 m_mRotation; // Matrix for arc ball's orientation 45 | D3DXMATRIXA16 m_mTranslation; // Matrix for arc ball's position 46 | D3DXMATRIXA16 m_mTranslationDelta; // Matrix for arc ball's position 47 | 48 | POINT m_Offset; // window offset, or upper-left corner of window 49 | INT m_nWidth; // arc ball's window width 50 | INT m_nHeight; // arc ball's window height 51 | D3DXVECTOR2 m_vCenter; // center of arc ball 52 | FLOAT m_fRadius; // arc ball's radius in screen coords 53 | FLOAT m_fRadiusTranslation; // arc ball's radius for translating the target 54 | 55 | D3DXQUATERNION m_qDown; // Quaternion before button down 56 | D3DXQUATERNION m_qNow; // Composite quaternion for current drag 57 | bool m_bDrag; // Whether user is dragging arc ball 58 | 59 | POINT m_ptLastMouse; // position of last mouse point 60 | D3DXVECTOR3 m_vDownPt; // starting point of rotation arc 61 | D3DXVECTOR3 m_vCurrentPt; // current point of rotation arc 62 | 63 | D3DXVECTOR3 ScreenToVector( float fScreenPtX, float fScreenPtY ); 64 | }; 65 | 66 | 67 | //-------------------------------------------------------------------------------------- 68 | // used by CCamera to map WM_KEYDOWN keys 69 | //-------------------------------------------------------------------------------------- 70 | enum D3DUtil_CameraKeys 71 | { 72 | CAM_STRAFE_LEFT = 0, 73 | CAM_STRAFE_RIGHT, 74 | CAM_MOVE_FORWARD, 75 | CAM_MOVE_BACKWARD, 76 | CAM_MOVE_UP, 77 | CAM_MOVE_DOWN, 78 | CAM_RESET, 79 | CAM_CONTROLDOWN, 80 | CAM_MAX_KEYS, 81 | CAM_UNKNOWN = 0xFF 82 | }; 83 | 84 | #define KEY_WAS_DOWN_MASK 0x80 85 | #define KEY_IS_DOWN_MASK 0x01 86 | 87 | #define MOUSE_LEFT_BUTTON 0x01 88 | #define MOUSE_MIDDLE_BUTTON 0x02 89 | #define MOUSE_RIGHT_BUTTON 0x04 90 | #define MOUSE_WHEEL 0x08 91 | 92 | 93 | //-------------------------------------------------------------------------------------- 94 | // Simple base camera class that moves and rotates. The base class 95 | // records mouse and keyboard input for use by a derived class, and 96 | // keeps common state. 97 | //-------------------------------------------------------------------------------------- 98 | class CBaseCamera 99 | { 100 | public: 101 | CBaseCamera(); 102 | 103 | // Call these from client and use Get*Matrix() to read new matrices 104 | virtual LRESULT HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); 105 | virtual void FrameMove( FLOAT fElapsedTime ) = 0; 106 | 107 | // Functions to change camera matrices 108 | virtual void Reset(); 109 | virtual void SetViewParams( D3DXVECTOR3* pvEyePt, D3DXVECTOR3* pvLookatPt ); 110 | virtual void SetProjParams( FLOAT fFOV, FLOAT fAspect, FLOAT fNearPlane, FLOAT fFarPlane ); 111 | 112 | // Functions to change behavior 113 | virtual void SetDragRect( RECT &rc ) { m_rcDrag = rc; } 114 | void SetInvertPitch( bool bInvertPitch ) { m_bInvertPitch = bInvertPitch; } 115 | void SetDrag( bool bMovementDrag, FLOAT fTotalDragTimeToZero = 0.25f ) { m_bMovementDrag = bMovementDrag; m_fTotalDragTimeToZero = fTotalDragTimeToZero; } 116 | void SetEnableYAxisMovement( bool bEnableYAxisMovement ) { m_bEnableYAxisMovement = bEnableYAxisMovement; } 117 | void SetEnablePositionMovement( bool bEnablePositionMovement ) { m_bEnablePositionMovement = bEnablePositionMovement; } 118 | void SetClipToBoundary( bool bClipToBoundary, D3DXVECTOR3* pvMinBoundary, D3DXVECTOR3* pvMaxBoundary ) { m_bClipToBoundary = bClipToBoundary; if( pvMinBoundary ) m_vMinBoundary = *pvMinBoundary; if( pvMaxBoundary ) m_vMaxBoundary = *pvMaxBoundary; } 119 | void SetScalers( FLOAT fRotationScaler = 0.01f, FLOAT fMoveScaler = 5.0f ) { m_fRotationScaler = fRotationScaler; m_fMoveScaler = fMoveScaler; } 120 | void SetNumberOfFramesToSmoothMouseData( int nFrames ) { if( nFrames > 0 ) m_fFramesToSmoothMouseData = (float)nFrames; } 121 | void SetResetCursorAfterMove( bool bResetCursorAfterMove ) { m_bResetCursorAfterMove = bResetCursorAfterMove; } 122 | 123 | // Functions to get state 124 | const D3DXMATRIX* GetViewMatrix() const { return &m_mView; } 125 | const D3DXMATRIX* GetProjMatrix() const { return &m_mProj; } 126 | const D3DXVECTOR3* GetEyePt() const { return &m_vEye; } 127 | const D3DXVECTOR3* GetLookAtPt() const { return &m_vLookAt; } 128 | float GetNearClip() const { return m_fNearPlane; } 129 | float GetFarClip() const { return m_fFarPlane; } 130 | 131 | bool IsBeingDragged() const { return (m_bMouseLButtonDown || m_bMouseMButtonDown || m_bMouseRButtonDown); } 132 | bool IsMouseLButtonDown() const { return m_bMouseLButtonDown; } 133 | bool IsMouseMButtonDown() const { return m_bMouseMButtonDown; } 134 | bool IsMouseRButtonDown() const { return m_bMouseRButtonDown; } 135 | 136 | protected: 137 | // Functions to map a WM_KEYDOWN key to a D3DUtil_CameraKeys enum 138 | virtual D3DUtil_CameraKeys MapKey( UINT nKey ); 139 | bool IsKeyDown( BYTE key ) const { return( (key & KEY_IS_DOWN_MASK) == KEY_IS_DOWN_MASK ); } 140 | bool WasKeyDown( BYTE key ) const { return( (key & KEY_WAS_DOWN_MASK) == KEY_WAS_DOWN_MASK ); } 141 | 142 | void ConstrainToBoundary( D3DXVECTOR3* pV ); 143 | void UpdateMouseDelta(); 144 | void UpdateVelocity( float fElapsedTime ); 145 | void GetInput( bool bGetKeyboardInput, bool bGetMouseInput, bool bGetGamepadInput, bool bResetCursorAfterMove ); 146 | 147 | D3DXMATRIX m_mView; // View matrix 148 | D3DXMATRIX m_mProj; // Projection matrix 149 | 150 | DXUT_GAMEPAD m_GamePad[DXUT_MAX_CONTROLLERS]; // XInput controller state 151 | D3DXVECTOR3 m_vGamePadLeftThumb; 152 | D3DXVECTOR3 m_vGamePadRightThumb; 153 | double m_GamePadLastActive[DXUT_MAX_CONTROLLERS]; 154 | 155 | int m_cKeysDown; // Number of camera keys that are down. 156 | BYTE m_aKeys[CAM_MAX_KEYS]; // State of input - KEY_WAS_DOWN_MASK|KEY_IS_DOWN_MASK 157 | D3DXVECTOR3 m_vKeyboardDirection; // Direction vector of keyboard input 158 | POINT m_ptLastMousePosition; // Last absolute position of mouse cursor 159 | bool m_bMouseLButtonDown; // True if left button is down 160 | bool m_bMouseMButtonDown; // True if middle button is down 161 | bool m_bMouseRButtonDown; // True if right button is down 162 | int m_nCurrentButtonMask; // mask of which buttons are down 163 | int m_nMouseWheelDelta; // Amount of middle wheel scroll (+/-) 164 | D3DXVECTOR2 m_vMouseDelta; // Mouse relative delta smoothed over a few frames 165 | float m_fFramesToSmoothMouseData; // Number of frames to smooth mouse data over 166 | 167 | D3DXVECTOR3 m_vDefaultEye; // Default camera eye position 168 | D3DXVECTOR3 m_vDefaultLookAt; // Default LookAt position 169 | D3DXVECTOR3 m_vEye; // Camera eye position 170 | D3DXVECTOR3 m_vLookAt; // LookAt position 171 | float m_fCameraYawAngle; // Yaw angle of camera 172 | float m_fCameraPitchAngle; // Pitch angle of camera 173 | 174 | RECT m_rcDrag; // Rectangle within which a drag can be initiated. 175 | D3DXVECTOR3 m_vVelocity; // Velocity of camera 176 | bool m_bMovementDrag; // If true, then camera movement will slow to a stop otherwise movement is instant 177 | D3DXVECTOR3 m_vVelocityDrag; // Velocity drag force 178 | FLOAT m_fDragTimer; // Countdown timer to apply drag 179 | FLOAT m_fTotalDragTimeToZero; // Time it takes for velocity to go from full to 0 180 | D3DXVECTOR2 m_vRotVelocity; // Velocity of camera 181 | 182 | float m_fFOV; // Field of view 183 | float m_fAspect; // Aspect ratio 184 | float m_fNearPlane; // Near plane 185 | float m_fFarPlane; // Far plane 186 | 187 | float m_fRotationScaler; // Scaler for rotation 188 | float m_fMoveScaler; // Scaler for movement 189 | 190 | bool m_bInvertPitch; // Invert the pitch axis 191 | bool m_bEnablePositionMovement; // If true, then the user can translate the camera/model 192 | bool m_bEnableYAxisMovement; // If true, then camera can move in the y-axis 193 | 194 | bool m_bClipToBoundary; // If true, then the camera will be clipped to the boundary 195 | D3DXVECTOR3 m_vMinBoundary; // Min point in clip boundary 196 | D3DXVECTOR3 m_vMaxBoundary; // Max point in clip boundary 197 | 198 | bool m_bResetCursorAfterMove;// If true, the class will reset the cursor position so that the cursor always has space to move 199 | }; 200 | 201 | 202 | //-------------------------------------------------------------------------------------- 203 | // Simple first person camera class that moves and rotates. 204 | // It allows yaw and pitch but not roll. It uses WM_KEYDOWN and 205 | // GetCursorPos() to respond to keyboard and mouse input and updates the 206 | // view matrix based on input. 207 | //-------------------------------------------------------------------------------------- 208 | class CFirstPersonCamera : public CBaseCamera 209 | { 210 | public: 211 | CFirstPersonCamera(); 212 | 213 | // Call these from client and use Get*Matrix() to read new matrices 214 | virtual void FrameMove( FLOAT fElapsedTime ); 215 | 216 | // Functions to change behavior 217 | void SetRotateButtons( bool bLeft, bool bMiddle, bool bRight, bool bRotateWithoutButtonDown = false ); 218 | 219 | // Functions to get state 220 | D3DXMATRIX* GetWorldMatrix() { return &m_mCameraWorld; } 221 | 222 | const D3DXVECTOR3* GetWorldRight() const { return (D3DXVECTOR3*)&m_mCameraWorld._11; } 223 | const D3DXVECTOR3* GetWorldUp() const { return (D3DXVECTOR3*)&m_mCameraWorld._21; } 224 | const D3DXVECTOR3* GetWorldAhead() const { return (D3DXVECTOR3*)&m_mCameraWorld._31; } 225 | const D3DXVECTOR3* GetEyePt() const { return (D3DXVECTOR3*)&m_mCameraWorld._41; } 226 | 227 | protected: 228 | D3DXMATRIX m_mCameraWorld; // World matrix of the camera (inverse of the view matrix) 229 | 230 | int m_nActiveButtonMask; // Mask to determine which button to enable for rotation 231 | bool m_bRotateWithoutButtonDown; 232 | }; 233 | 234 | 235 | //-------------------------------------------------------------------------------------- 236 | // Simple model viewing camera class that rotates around the object. 237 | //-------------------------------------------------------------------------------------- 238 | class CModelViewerCamera : public CBaseCamera 239 | { 240 | public: 241 | CModelViewerCamera(); 242 | 243 | // Call these from client and use Get*Matrix() to read new matrices 244 | virtual LRESULT HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); 245 | virtual void FrameMove( FLOAT fElapsedTime ); 246 | 247 | 248 | // Functions to change behavior 249 | virtual void SetDragRect( RECT& rc ); 250 | void Reset(); 251 | void SetViewParams( D3DXVECTOR3* pvEyePt, D3DXVECTOR3* pvLookatPt ); 252 | void SetButtonMasks( int nRotateModelButtonMask = MOUSE_LEFT_BUTTON, int nZoomButtonMask = MOUSE_WHEEL, int nRotateCameraButtonMask = MOUSE_RIGHT_BUTTON ) { m_nRotateModelButtonMask = nRotateModelButtonMask, m_nZoomButtonMask = nZoomButtonMask; m_nRotateCameraButtonMask = nRotateCameraButtonMask; } 253 | void SetAttachCameraToModel( bool bEnable = false ) { m_bAttachCameraToModel = bEnable; } 254 | void SetWindow( int nWidth, int nHeight, float fArcballRadius=0.9f ) { m_WorldArcBall.SetWindow( nWidth, nHeight, fArcballRadius ); m_ViewArcBall.SetWindow( nWidth, nHeight, fArcballRadius ); } 255 | void SetRadius( float fDefaultRadius=5.0f, float fMinRadius=1.0f, float fMaxRadius=FLT_MAX ) { m_fDefaultRadius = m_fRadius = fDefaultRadius; m_fMinRadius = fMinRadius; m_fMaxRadius = fMaxRadius; m_bDragSinceLastUpdate = true; } 256 | void SetModelCenter( D3DXVECTOR3 vModelCenter ) { m_vModelCenter = vModelCenter; } 257 | void SetLimitPitch( bool bLimitPitch ) { m_bLimitPitch = bLimitPitch; } 258 | void SetViewQuat( D3DXQUATERNION q ) { m_ViewArcBall.SetQuatNow( q ); m_bDragSinceLastUpdate = true; } 259 | void SetWorldQuat( D3DXQUATERNION q ) { m_WorldArcBall.SetQuatNow( q ); m_bDragSinceLastUpdate = true; } 260 | 261 | // Functions to get state 262 | const D3DXMATRIX* GetWorldMatrix() const { return &m_mWorld; } 263 | void SetWorldMatrix( D3DXMATRIX &mWorld ) { m_mWorld = mWorld; m_bDragSinceLastUpdate = true; } 264 | 265 | protected: 266 | CD3DArcBall m_WorldArcBall; 267 | CD3DArcBall m_ViewArcBall; 268 | D3DXVECTOR3 m_vModelCenter; 269 | D3DXMATRIX m_mModelLastRot; // Last arcball rotation matrix for model 270 | D3DXMATRIX m_mModelRot; // Rotation matrix of model 271 | D3DXMATRIX m_mWorld; // World matrix of model 272 | 273 | int m_nRotateModelButtonMask; 274 | int m_nZoomButtonMask; 275 | int m_nRotateCameraButtonMask; 276 | 277 | bool m_bAttachCameraToModel; 278 | bool m_bLimitPitch; 279 | float m_fRadius; // Distance from the camera to model 280 | float m_fDefaultRadius; // Distance from the camera to model 281 | float m_fMinRadius; // Min radius 282 | float m_fMaxRadius; // Max radius 283 | bool m_bDragSinceLastUpdate; // True if mouse drag has happened since last time FrameMove is called. 284 | 285 | D3DXMATRIX m_mCameraRotLast; 286 | 287 | }; 288 | 289 | //-------------------------------------------------------------------------------------- 290 | // Manages the mesh, direction, mouse events of a directional arrow that 291 | // rotates around a radius controlled by an arcball 292 | //-------------------------------------------------------------------------------------- 293 | class CDXUTDirectionWidget 294 | { 295 | public: 296 | CDXUTDirectionWidget(); 297 | 298 | static HRESULT WINAPI StaticOnD3D9CreateDevice( IDirect3DDevice9* pd3dDevice ); 299 | HRESULT OnD3D9ResetDevice( const D3DSURFACE_DESC* pBackBufferSurfaceDesc ); 300 | HRESULT OnRender9( D3DXCOLOR color, const D3DXMATRIX* pmView, const D3DXMATRIX* pmProj, const D3DXVECTOR3* pEyePt ); 301 | LRESULT HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); 302 | static void WINAPI StaticOnD3D9LostDevice(); 303 | static void WINAPI StaticOnD3D9DestroyDevice(); 304 | 305 | static HRESULT WINAPI StaticOnD3D10CreateDevice( ID3D10Device* pd3dDevice ); 306 | HRESULT OnRender10( D3DXCOLOR color, const D3DXMATRIX* pmView, const D3DXMATRIX* pmProj, const D3DXVECTOR3* pEyePt ); 307 | static void WINAPI StaticOnD3D10DestroyDevice(); 308 | 309 | D3DXVECTOR3 GetLightDirection() { return m_vCurrentDir; }; 310 | void SetLightDirection( D3DXVECTOR3 vDir ) { m_vDefaultDir = m_vCurrentDir = vDir; }; 311 | void SetButtonMask( int nRotate = MOUSE_RIGHT_BUTTON ) { m_nRotateMask = nRotate; } 312 | 313 | float GetRadius() { return m_fRadius; }; 314 | void SetRadius( float fRadius ) { m_fRadius = fRadius; }; 315 | 316 | bool IsBeingDragged() { return m_ArcBall.IsBeingDragged(); }; 317 | 318 | protected: 319 | HRESULT UpdateLightDir(); 320 | 321 | // D3D9 objects 322 | static IDirect3DDevice9* s_pd3d9Device; 323 | static ID3DXEffect* s_pD3D9Effect; 324 | static ID3DXMesh* s_pD3D9Mesh; 325 | static D3DXHANDLE s_hRenderWith1LightNoTexture; 326 | static D3DXHANDLE s_hMaterialDiffuseColor; 327 | static D3DXHANDLE s_hLightDir; 328 | static D3DXHANDLE s_hWorldViewProjection; 329 | static D3DXHANDLE s_hWorld; 330 | 331 | // D3D10 objects 332 | static ID3D10Device* s_pd3d10Device; 333 | static ID3D10Effect* s_pD3D10Effect; 334 | //TODO: add some sort of d3d10 mesh object here 335 | static ID3D10InputLayout* s_pVertexLayout; 336 | static ID3D10EffectTechnique* s_pRenderTech; 337 | static ID3D10EffectVectorVariable* g_pMaterialDiffuseColor; 338 | static ID3D10EffectVectorVariable* g_pLightDir; 339 | static ID3D10EffectMatrixVariable* g_pmWorld; 340 | static ID3D10EffectMatrixVariable* g_pmWorldViewProjection; 341 | 342 | D3DXMATRIXA16 m_mRot; 343 | D3DXMATRIXA16 m_mRotSnapshot; 344 | float m_fRadius; 345 | int m_nRotateMask; 346 | CD3DArcBall m_ArcBall; 347 | D3DXVECTOR3 m_vDefaultDir; 348 | D3DXVECTOR3 m_vCurrentDir; 349 | D3DXMATRIX m_mView; 350 | }; 351 | 352 | 353 | 354 | #endif 355 | -------------------------------------------------------------------------------- /DXUT/Optional/DXUTguiIME.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DXUTguiIME.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | //-------------------------------------------------------------------------------------- 6 | #pragma once 7 | #ifndef DXUT_IME_H 8 | #define DXUT_IME_H 9 | 10 | #include 11 | #include 12 | #include "ImeUi.h" 13 | 14 | 15 | //-------------------------------------------------------------------------------------- 16 | // Forward declarations 17 | //-------------------------------------------------------------------------------------- 18 | class CDXUTIMEEditBox; 19 | 20 | 21 | //----------------------------------------------------------------------------- 22 | // IME-enabled EditBox control 23 | //----------------------------------------------------------------------------- 24 | #define MAX_COMPSTRING_SIZE 256 25 | 26 | 27 | class CDXUTIMEEditBox : public CDXUTEditBox 28 | { 29 | public: 30 | 31 | static HRESULT CreateIMEEditBox( CDXUTDialog* pDialog, int ID, LPCWSTR strText, int x, int y, int width, 32 | int height, bool bIsDefault=false, CDXUTIMEEditBox** ppCreated=NULL ); 33 | 34 | CDXUTIMEEditBox( CDXUTDialog* pDialog = NULL ); 35 | virtual ~CDXUTIMEEditBox(); 36 | 37 | static void InitDefaultElements( CDXUTDialog* pDialog ); 38 | 39 | static void WINAPI Initialize( HWND hWnd ); 40 | static void WINAPI Uninitialize(); 41 | 42 | static HRESULT WINAPI StaticOnCreateDevice(); 43 | static bool WINAPI StaticMsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); 44 | 45 | static void WINAPI SetImeEnableFlag( bool bFlag ); 46 | 47 | virtual void Render( float fElapsedTime ); 48 | virtual bool MsgProc( UINT uMsg, WPARAM wParam, LPARAM lParam ); 49 | virtual bool HandleMouse( UINT uMsg, POINT pt, WPARAM wParam, LPARAM lParam ); 50 | virtual void UpdateRects(); 51 | virtual void OnFocusIn(); 52 | virtual void OnFocusOut(); 53 | 54 | void PumpMessage(); 55 | 56 | virtual void RenderCandidateReadingWindow( float fElapsedTime, bool bReading ); 57 | virtual void RenderComposition( float fElapsedTime ); 58 | virtual void RenderIndicator( float fElapsedTime ); 59 | 60 | protected: 61 | static void WINAPI EnableImeSystem( bool bEnable ); 62 | 63 | static WORD WINAPI GetLanguage() 64 | { 65 | return ImeUi_GetLanguage(); 66 | } 67 | static WORD WINAPI GetPrimaryLanguage() 68 | { 69 | return ImeUi_GetPrimaryLanguage(); 70 | } 71 | static void WINAPI SendKey( BYTE nVirtKey ); 72 | static DWORD WINAPI GetImeId( UINT uIndex = 0 ) 73 | { 74 | return ImeUi_GetImeId( uIndex ); 75 | }; 76 | static void WINAPI CheckInputLocale(); 77 | static void WINAPI CheckToggleState(); 78 | static void WINAPI SetupImeApi(); 79 | static void WINAPI ResetCompositionString(); 80 | 81 | 82 | static void SetupImeUiCallback(); 83 | 84 | protected: 85 | enum 86 | { 87 | INDICATOR_NON_IME, 88 | INDICATOR_CHS, 89 | INDICATOR_CHT, 90 | INDICATOR_KOREAN, 91 | INDICATOR_JAPANESE 92 | }; 93 | 94 | struct CCandList 95 | { 96 | CUniBuffer HoriCand; // Candidate list string (for horizontal candidate window) 97 | int nFirstSelected; // First character position of the selected string in HoriCand 98 | int nHoriSelectedLen; // Length of the selected string in HoriCand 99 | RECT rcCandidate; // Candidate rectangle computed and filled each time before rendered 100 | }; 101 | 102 | static POINT s_ptCompString; // Composition string position. Updated every frame. 103 | static int s_nFirstTargetConv; // Index of the first target converted char in comp string. If none, -1. 104 | static CUniBuffer s_CompString; // Buffer to hold the composition string (we fix its length) 105 | static DWORD s_adwCompStringClause[MAX_COMPSTRING_SIZE]; 106 | static CCandList s_CandList; // Data relevant to the candidate list 107 | static WCHAR s_wszReadingString[32];// Used only with horizontal reading window (why?) 108 | static bool s_bImeFlag; // Is ime enabled 109 | 110 | // Color of various IME elements 111 | D3DCOLOR m_ReadingColor; // Reading string color 112 | D3DCOLOR m_ReadingWinColor; // Reading window color 113 | D3DCOLOR m_ReadingSelColor; // Selected character in reading string 114 | D3DCOLOR m_ReadingSelBkColor; // Background color for selected char in reading str 115 | D3DCOLOR m_CandidateColor; // Candidate string color 116 | D3DCOLOR m_CandidateWinColor; // Candidate window color 117 | D3DCOLOR m_CandidateSelColor; // Selected candidate string color 118 | D3DCOLOR m_CandidateSelBkColor; // Selected candidate background color 119 | D3DCOLOR m_CompColor; // Composition string color 120 | D3DCOLOR m_CompWinColor; // Composition string window color 121 | D3DCOLOR m_CompCaretColor; // Composition string caret color 122 | D3DCOLOR m_CompTargetColor; // Composition string target converted color 123 | D3DCOLOR m_CompTargetBkColor; // Composition string target converted background 124 | D3DCOLOR m_CompTargetNonColor; // Composition string target non-converted color 125 | D3DCOLOR m_CompTargetNonBkColor;// Composition string target non-converted background 126 | D3DCOLOR m_IndicatorImeColor; // Indicator text color for IME 127 | D3DCOLOR m_IndicatorEngColor; // Indicator text color for English 128 | D3DCOLOR m_IndicatorBkColor; // Indicator text background color 129 | 130 | // Edit-control-specific data 131 | int m_nIndicatorWidth; // Width of the indicator symbol 132 | RECT m_rcIndicator; // Rectangle for drawing the indicator button 133 | 134 | #if defined(DEBUG) || defined(_DEBUG) 135 | static bool m_bIMEStaticMsgProcCalled; 136 | #endif 137 | }; 138 | 139 | 140 | 141 | #endif // DXUT_IME_H 142 | -------------------------------------------------------------------------------- /DXUT/Optional/DXUTres.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // File: dxutres.h 3 | // 4 | // Functions to create DXUT media from arrays in memory 5 | // 6 | // Copyright (c) Microsoft Corp. All rights reserved. 7 | //----------------------------------------------------------------------------- 8 | #pragma once 9 | #ifndef DXUT_RES_H 10 | #define DXUT_RES_H 11 | 12 | HRESULT WINAPI DXUTCreateGUITextureFromInternalArray9( LPDIRECT3DDEVICE9 pd3dDevice, IDirect3DTexture9** ppTexture, 13 | D3DXIMAGE_INFO* pInfo ); 14 | HRESULT WINAPI DXUTCreateGUITextureFromInternalArray10( ID3D10Device* pd3dDevice, ID3D10Texture2D** ppTexture, 15 | D3DX10_IMAGE_INFO* pInfo ); 16 | HRESULT WINAPI DXUTCreateArrowMeshFromInternalArray( LPDIRECT3DDEVICE9 pd3dDevice, ID3DXMesh** ppMesh ); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /DXUT/Optional/DXUTsettingsdlg.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DXUTSettingsDlg.cpp 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved 5 | //-------------------------------------------------------------------------------------- 6 | #pragma once 7 | #ifndef DXUT_SETTINGS_H 8 | #define DXUT_SETTINGS_H 9 | 10 | //-------------------------------------------------------------------------------------- 11 | // Header Includes 12 | //-------------------------------------------------------------------------------------- 13 | #include "DXUTgui.h" 14 | 15 | //-------------------------------------------------------------------------------------- 16 | // Control IDs 17 | //-------------------------------------------------------------------------------------- 18 | #define DXUTSETTINGSDLG_STATIC -1 19 | #define DXUTSETTINGSDLG_OK 1 20 | #define DXUTSETTINGSDLG_CANCEL 2 21 | #define DXUTSETTINGSDLG_ADAPTER 3 22 | #define DXUTSETTINGSDLG_DEVICE_TYPE 4 23 | #define DXUTSETTINGSDLG_WINDOWED 5 24 | #define DXUTSETTINGSDLG_FULLSCREEN 6 25 | #define DXUTSETTINGSDLG_ADAPTER_FORMAT 7 26 | #define DXUTSETTINGSDLG_ADAPTER_FORMAT_LABEL 8 27 | #define DXUTSETTINGSDLG_RESOLUTION 9 28 | #define DXUTSETTINGSDLG_RESOLUTION_LABEL 10 29 | #define DXUTSETTINGSDLG_REFRESH_RATE 11 30 | #define DXUTSETTINGSDLG_REFRESH_RATE_LABEL 12 31 | #define DXUTSETTINGSDLG_BACK_BUFFER_FORMAT 13 32 | #define DXUTSETTINGSDLG_BACK_BUFFER_FORMAT_LABEL 14 33 | #define DXUTSETTINGSDLG_DEPTH_STENCIL 15 34 | #define DXUTSETTINGSDLG_DEPTH_STENCIL_LABEL 16 35 | #define DXUTSETTINGSDLG_MULTISAMPLE_TYPE 17 36 | #define DXUTSETTINGSDLG_MULTISAMPLE_TYPE_LABEL 18 37 | #define DXUTSETTINGSDLG_MULTISAMPLE_QUALITY 19 38 | #define DXUTSETTINGSDLG_MULTISAMPLE_QUALITY_LABEL 20 39 | #define DXUTSETTINGSDLG_VERTEX_PROCESSING 21 40 | #define DXUTSETTINGSDLG_VERTEX_PROCESSING_LABEL 22 41 | #define DXUTSETTINGSDLG_PRESENT_INTERVAL 23 42 | #define DXUTSETTINGSDLG_PRESENT_INTERVAL_LABEL 24 43 | #define DXUTSETTINGSDLG_DEVICECLIP 25 44 | #define DXUTSETTINGSDLG_RESOLUTION_SHOW_ALL 26 45 | #define DXUTSETTINGSDLG_API_VERSION 27 46 | #define DXUTSETTINGSDLG_D3D10_ADAPTER_OUTPUT 28 47 | #define DXUTSETTINGSDLG_D3D10_ADAPTER_OUTPUT_LABEL 29 48 | #define DXUTSETTINGSDLG_D3D10_RESOLUTION 30 49 | #define DXUTSETTINGSDLG_D3D10_RESOLUTION_LABEL 31 50 | #define DXUTSETTINGSDLG_D3D10_REFRESH_RATE 32 51 | #define DXUTSETTINGSDLG_D3D10_REFRESH_RATE_LABEL 33 52 | #define DXUTSETTINGSDLG_D3D10_BACK_BUFFER_FORMAT 34 53 | #define DXUTSETTINGSDLG_D3D10_BACK_BUFFER_FORMAT_LABEL 35 54 | #define DXUTSETTINGSDLG_D3D10_MULTISAMPLE_COUNT 36 55 | #define DXUTSETTINGSDLG_D3D10_MULTISAMPLE_COUNT_LABEL 37 56 | #define DXUTSETTINGSDLG_D3D10_MULTISAMPLE_QUALITY 38 57 | #define DXUTSETTINGSDLG_D3D10_MULTISAMPLE_QUALITY_LABEL 39 58 | #define DXUTSETTINGSDLG_D3D10_PRESENT_INTERVAL 40 59 | #define DXUTSETTINGSDLG_D3D10_PRESENT_INTERVAL_LABEL 41 60 | #define DXUTSETTINGSDLG_D3D10_DEBUG_DEVICE 42 61 | #define DXUTSETTINGSDLG_MODE_CHANGE_ACCEPT 43 62 | #define DXUTSETTINGSDLG_MODE_CHANGE_REVERT 44 63 | #define DXUTSETTINGSDLG_STATIC_MODE_CHANGE_TIMEOUT 45 64 | #define DXUTSETTINGSDLG_WINDOWED_GROUP 0x0100 65 | 66 | 67 | //-------------------------------------------------------------------------------------- 68 | // Dialog for selection of device settings 69 | // Use DXUTGetD3DSettingsDialog() to access global instance 70 | // To control the contents of the dialog, use the CD3D9Enumeration class. 71 | //-------------------------------------------------------------------------------------- 72 | class CD3DSettingsDlg 73 | { 74 | public: 75 | CD3DSettingsDlg(); 76 | ~CD3DSettingsDlg(); 77 | 78 | void Init( CDXUTDialogResourceManager* pManager ); 79 | void Init( CDXUTDialogResourceManager* pManager, LPCWSTR szControlTextureFileName ); 80 | void Init( CDXUTDialogResourceManager* pManager, LPCWSTR pszControlTextureResourcename, 81 | HMODULE hModule ); 82 | 83 | HRESULT Refresh(); 84 | void OnRender( float fElapsedTime ); 85 | void OnRender9( float fElapsedTime ); 86 | void OnRender10( float fElapsedTime ); 87 | 88 | HRESULT OnD3D9CreateDevice( IDirect3DDevice9* pd3dDevice ); 89 | HRESULT OnD3D9ResetDevice(); 90 | void OnD3D9LostDevice(); 91 | void OnD3D9DestroyDevice(); 92 | 93 | HRESULT OnD3D10CreateDevice( ID3D10Device* pd3dDevice ); 94 | HRESULT OnD3D10ResizedSwapChain( ID3D10Device* pd3dDevice, 95 | const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc ); 96 | void OnD3D10DestroyDevice(); 97 | 98 | CDXUTDialog* GetDialogControl() 99 | { 100 | return &m_Dialog; 101 | } 102 | bool IsActive() 103 | { 104 | return m_bActive; 105 | } 106 | void SetActive( bool bActive ) 107 | { 108 | m_bActive = bActive; if( bActive ) Refresh(); 109 | } 110 | void ShowControlSet( DXUTDeviceVersion ver ); 111 | 112 | LRESULT MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); 113 | 114 | protected: 115 | friend CD3DSettingsDlg* WINAPI DXUTGetD3DSettingsDialog(); 116 | 117 | void CreateControls(); 118 | HRESULT SetDeviceSettingsFromUI(); 119 | void SetSelectedD3D10RefreshRate( DXGI_RATIONAL RefreshRate ); 120 | HRESULT UpdateD3D10Resolutions(); 121 | 122 | void OnEvent( UINT nEvent, int nControlID, CDXUTControl* pControl ); 123 | static void WINAPI StaticOnEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserData ); 124 | static void WINAPI StaticOnModeChangeTimer( UINT nIDEvent, void* pUserContext ); 125 | 126 | CD3D9EnumAdapterInfo* GetCurrentAdapterInfo(); 127 | CD3D9EnumDeviceInfo* GetCurrentDeviceInfo(); 128 | CD3D9EnumDeviceSettingsCombo* GetCurrentDeviceSettingsCombo(); 129 | CD3D10EnumAdapterInfo* GetCurrentD3D10AdapterInfo(); 130 | CD3D10EnumDeviceInfo* GetCurrentD3D10DeviceInfo(); 131 | CD3D10EnumOutputInfo* GetCurrentD3D10OutputInfo(); 132 | CD3D10EnumDeviceSettingsCombo* GetCurrentD3D10DeviceSettingsCombo(); 133 | 134 | void AddAPIVersion( DXUTDeviceVersion version ); 135 | DXUTDeviceVersion GetSelectedAPIVersion(); 136 | 137 | void AddAdapter( const WCHAR* strDescription, UINT iAdapter ); 138 | UINT GetSelectedAdapter(); 139 | 140 | void AddDeviceType( D3DDEVTYPE devType ); 141 | D3DDEVTYPE GetSelectedDeviceType(); 142 | 143 | void SetWindowed( bool bWindowed ); 144 | bool IsWindowed(); 145 | 146 | void AddAdapterFormat( D3DFORMAT format ); 147 | D3DFORMAT GetSelectedAdapterFormat(); 148 | 149 | void AddResolution( DWORD dwWidth, DWORD dwHeight ); 150 | void GetSelectedResolution( DWORD* pdwWidth, DWORD* pdwHeight ); 151 | 152 | void AddRefreshRate( DWORD dwRate ); 153 | DWORD GetSelectedRefreshRate(); 154 | 155 | void AddBackBufferFormat( D3DFORMAT format ); 156 | D3DFORMAT GetSelectedBackBufferFormat(); 157 | 158 | void AddDepthStencilBufferFormat( D3DFORMAT format ); 159 | D3DFORMAT GetSelectedDepthStencilBufferFormat(); 160 | 161 | void AddMultisampleType( D3DMULTISAMPLE_TYPE type ); 162 | D3DMULTISAMPLE_TYPE GetSelectedMultisampleType(); 163 | 164 | void AddMultisampleQuality( DWORD dwQuality ); 165 | DWORD GetSelectedMultisampleQuality(); 166 | 167 | void AddVertexProcessingType( DWORD dwType ); 168 | DWORD GetSelectedVertexProcessingType(); 169 | 170 | DWORD GetSelectedPresentInterval(); 171 | 172 | void SetDeviceClip( bool bDeviceClip ); 173 | bool IsDeviceClip(); 174 | 175 | // D3D10 176 | void AddD3D10DeviceType( D3D10_DRIVER_TYPE devType ); 177 | D3D10_DRIVER_TYPE GetSelectedD3D10DeviceType(); 178 | 179 | void AddD3D10AdapterOutput( const WCHAR* strName, UINT nOutput ); 180 | UINT GetSelectedD3D10AdapterOutput(); 181 | 182 | void AddD3D10Resolution( DWORD dwWidth, DWORD dwHeight ); 183 | void GetSelectedD3D10Resolution( DWORD* pdwWidth, DWORD* pdwHeight ); 184 | 185 | void AddD3D10RefreshRate( DXGI_RATIONAL RefreshRate ); 186 | DXGI_RATIONAL GetSelectedD3D10RefreshRate(); 187 | 188 | void AddD3D10BackBufferFormat( DXGI_FORMAT format ); 189 | DXGI_FORMAT GetSelectedD3D10BackBufferFormat(); 190 | 191 | void AddD3D10MultisampleCount( UINT count ); 192 | UINT GetSelectedD3D10MultisampleCount(); 193 | 194 | void AddD3D10MultisampleQuality( UINT Quality ); 195 | UINT GetSelectedD3D10MultisampleQuality(); 196 | 197 | DWORD GetSelectedD3D10PresentInterval(); 198 | bool GetSelectedDebugDeviceValue(); 199 | 200 | HRESULT OnAPIVersionChanged( bool bRefresh=false ); 201 | HRESULT OnAdapterChanged(); 202 | HRESULT OnDeviceTypeChanged(); 203 | HRESULT OnWindowedFullScreenChanged(); 204 | HRESULT OnAdapterOutputChanged(); 205 | HRESULT OnAdapterFormatChanged(); 206 | HRESULT OnResolutionChanged(); 207 | HRESULT OnD3D10ResolutionChanged(); 208 | HRESULT OnRefreshRateChanged(); 209 | HRESULT OnBackBufferFormatChanged(); 210 | HRESULT OnDepthStencilBufferFormatChanged(); 211 | HRESULT OnMultisampleTypeChanged(); 212 | HRESULT OnMultisampleQualityChanged(); 213 | HRESULT OnVertexProcessingChanged(); 214 | HRESULT OnPresentIntervalChanged(); 215 | HRESULT OnDebugDeviceChanged(); 216 | HRESULT OnDeviceClipChanged(); 217 | 218 | void UpdateModeChangeTimeoutText( int nSecRemaining ); 219 | 220 | IDirect3DStateBlock9* m_pStateBlock; 221 | ID3D10StateBlock* m_pStateBlock10; 222 | CDXUTDialog* m_pActiveDialog; 223 | CDXUTDialog m_Dialog; 224 | CDXUTDialog m_RevertModeDialog; 225 | int m_nRevertModeTimeout; 226 | UINT m_nIDEvent; 227 | bool m_bActive; 228 | }; 229 | 230 | 231 | CD3DSettingsDlg* WINAPI DXUTGetD3DSettingsDialog(); 232 | 233 | 234 | 235 | #endif 236 | 237 | -------------------------------------------------------------------------------- /DXUT/Optional/ImeUi.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: ImeUi.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | //-------------------------------------------------------------------------------------- 6 | #ifndef _IMEUI_H_ 7 | #define _IMEUI_H_ 8 | #if _WIN32_WINNT < 0x0400 9 | #error IMEUI requires _WIN32_WINNT to be 0x0400 or higher. Please add "_WIN32_WINNT=0x0400" to your project's preprocessor setting. 10 | #endif 11 | #include 12 | 13 | class CImeUiFont_Base 14 | { 15 | public: 16 | virtual void SetHeight( UINT uHeight ) { uHeight; }; // for backward compatibility 17 | virtual void SetColor( DWORD color ) = 0; 18 | virtual void SetPosition( int x, int y ) = 0; 19 | virtual void GetTextExtent( LPCTSTR szText, DWORD* puWidth, DWORD* puHeight ) = 0; 20 | virtual void DrawText( LPCTSTR pszText ) = 0; 21 | }; 22 | 23 | typedef struct 24 | { 25 | // symbol (Henkan-kyu) 26 | DWORD symbolColor; 27 | DWORD symbolColorOff; 28 | DWORD symbolColorText; 29 | BYTE symbolHeight; 30 | BYTE symbolTranslucence; 31 | BYTE symbolPlacement; 32 | CImeUiFont_Base* symbolFont; 33 | 34 | // candidate list 35 | DWORD candColorBase; 36 | DWORD candColorBorder; 37 | DWORD candColorText; 38 | 39 | // composition string 40 | DWORD compColorInput; 41 | DWORD compColorTargetConv; 42 | DWORD compColorConverted; 43 | DWORD compColorTargetNotConv; 44 | DWORD compColorInputErr; 45 | BYTE compTranslucence; 46 | DWORD compColorText; 47 | 48 | // caret 49 | BYTE caretWidth; 50 | BYTE caretYMargin; 51 | } IMEUI_APPEARANCE; 52 | 53 | typedef struct // D3DTLVERTEX compatible 54 | { 55 | float sx; 56 | float sy; 57 | float sz; 58 | float rhw; 59 | DWORD color; 60 | DWORD specular; 61 | float tu; 62 | float tv; 63 | } IMEUI_VERTEX; 64 | 65 | // IME States 66 | #define IMEUI_STATE_OFF 0 67 | #define IMEUI_STATE_ON 1 68 | #define IMEUI_STATE_ENGLISH 2 69 | 70 | // IME const 71 | #define MAX_CANDLIST 10 72 | 73 | // IME Flags 74 | #define IMEUI_FLAG_SUPPORT_CARET 0x00000001 75 | 76 | bool ImeUi_Initialize( HWND hwnd, bool bDisable = false ); 77 | void ImeUi_Uninitialize(); 78 | void ImeUi_SetAppearance( const IMEUI_APPEARANCE* pia ); 79 | void ImeUi_GetAppearance( IMEUI_APPEARANCE* pia ); 80 | bool ImeUi_IgnoreHotKey( const MSG* pmsg ); 81 | LPARAM ImeUi_ProcessMessage( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM& lParam, bool * trapped ); 82 | void ImeUi_SetScreenDimension( UINT width, UINT height ); 83 | void ImeUi_RenderUI( bool bDrawCompAttr = true, bool bDrawOtherUi = true ); 84 | void ImeUi_SetCaretPosition( UINT x, UINT y ); 85 | void ImeUi_SetCompStringAppearance( CImeUiFont_Base* pFont, DWORD color, const RECT* prc ); 86 | bool ImeUi_GetCaretStatus(); 87 | void ImeUi_SetInsertMode( bool bInsert ); 88 | void ImeUi_SetState( DWORD dwState ); 89 | DWORD ImeUi_GetState(); 90 | void ImeUi_EnableIme( bool bEnable ); 91 | bool ImeUi_IsEnabled( void ); 92 | void ImeUi_FinalizeString( bool bSend = false ); 93 | void ImeUi_ToggleLanguageBar( BOOL bRestore ); 94 | bool ImeUi_IsSendingKeyMessage(); 95 | void ImeUi_SetWindow( HWND hwnd ); 96 | UINT ImeUi_GetInputCodePage(); 97 | DWORD ImeUi_GetFlags(); 98 | void ImeUi_SetFlags( DWORD dwFlags, bool bSet ); 99 | 100 | WORD ImeUi_GetPrimaryLanguage(); 101 | DWORD ImeUi_GetImeId(UINT uIndex); 102 | WORD ImeUi_GetLanguage(); 103 | LPTSTR ImeUi_GetIndicatior(); 104 | bool ImeUi_IsShowReadingWindow(); 105 | bool ImeUi_IsShowCandListWindow(); 106 | bool ImeUi_IsVerticalCand(); 107 | bool ImeUi_IsHorizontalReading(); 108 | TCHAR* ImeUi_GetCandidate(UINT idx); 109 | TCHAR* ImeUi_GetCompositionString(); 110 | DWORD ImeUi_GetCandidateSelection(); 111 | DWORD ImeUi_GetCandidateCount(); 112 | BYTE* ImeUi_GetCompStringAttr(); 113 | DWORD ImeUi_GetImeCursorChars(); 114 | 115 | extern void (CALLBACK *ImeUiCallback_DrawRect )( int x1, int y1, int x2, int y2, DWORD color ); 116 | extern void* (__cdecl *ImeUiCallback_Malloc )( size_t bytes ); 117 | extern void (__cdecl *ImeUiCallback_Free )( void* ptr ); 118 | extern void (CALLBACK *ImeUiCallback_DrawFans )( const IMEUI_VERTEX* paVertex, UINT uNum ); 119 | extern void (CALLBACK *ImeUiCallback_OnChar )( WCHAR wc ); 120 | 121 | #endif //_IMEUI_H_ 122 | -------------------------------------------------------------------------------- /DXUT/Optional/SDKmisc.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: SDKMisc.h 3 | // 4 | // Various helper functionality that is shared between SDK samples 5 | // 6 | // Copyright (c) Microsoft Corporation. All rights reserved 7 | //-------------------------------------------------------------------------------------- 8 | #pragma once 9 | #ifndef SDKMISC_H 10 | #define SDKMISC_H 11 | 12 | 13 | //----------------------------------------------------------------------------- 14 | // Resource cache for textures, fonts, meshs, and effects. 15 | // Use DXUTGetGlobalResourceCache() to access the global cache 16 | //----------------------------------------------------------------------------- 17 | 18 | enum DXUTCACHE_SOURCELOCATION 19 | { 20 | DXUTCACHE_LOCATION_FILE, 21 | DXUTCACHE_LOCATION_RESOURCE 22 | }; 23 | 24 | struct DXUTCache_Texture 25 | { 26 | DXUTCACHE_SOURCELOCATION Location; 27 | WCHAR wszSource[MAX_PATH]; 28 | HMODULE hSrcModule; 29 | UINT Width; 30 | UINT Height; 31 | UINT Depth; 32 | UINT MipLevels; 33 | UINT MiscFlags; 34 | union 35 | { 36 | DWORD Usage9; 37 | D3D10_USAGE Usage10; 38 | }; 39 | union 40 | { 41 | D3DFORMAT Format9; 42 | DXGI_FORMAT Format10; 43 | }; 44 | union 45 | { 46 | D3DPOOL Pool9; 47 | UINT CpuAccessFlags; 48 | }; 49 | union 50 | { 51 | D3DRESOURCETYPE Type9; 52 | UINT BindFlags; 53 | }; 54 | IDirect3DBaseTexture9* pTexture9; 55 | ID3D10ShaderResourceView* pSRV10; 56 | 57 | DXUTCache_Texture() 58 | { 59 | pTexture9 = NULL; 60 | pSRV10 = NULL; 61 | } 62 | }; 63 | 64 | struct DXUTCache_Font : public D3DXFONT_DESC 65 | { 66 | ID3DXFont* pFont; 67 | }; 68 | 69 | struct DXUTCache_Effect 70 | { 71 | DXUTCACHE_SOURCELOCATION Location; 72 | WCHAR wszSource[MAX_PATH]; 73 | HMODULE hSrcModule; 74 | DWORD dwFlags; 75 | ID3DXEffect* pEffect; 76 | }; 77 | 78 | 79 | class CDXUTResourceCache 80 | { 81 | public: 82 | ~CDXUTResourceCache(); 83 | 84 | HRESULT CreateTextureFromFile( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, 85 | LPDIRECT3DTEXTURE9* ppTexture ); 86 | HRESULT CreateTextureFromFile( LPDIRECT3DDEVICE9 pDevice, LPCSTR pSrcFile, 87 | LPDIRECT3DTEXTURE9* ppTexture ); 88 | HRESULT CreateTextureFromFile( ID3D10Device* pDevice, LPCTSTR pSrcFile, 89 | ID3D10ShaderResourceView** ppOutputRV, bool bSRGB=false ); 90 | HRESULT CreateTextureFromFile( ID3D10Device* pDevice, LPCSTR pSrcFile, 91 | ID3D10ShaderResourceView** ppOutputRV, bool bSRGB=false ); 92 | HRESULT CreateTextureFromFileEx( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, UINT Width, 93 | UINT Height, UINT MipLevels, DWORD Usage, D3DFORMAT Format, 94 | D3DPOOL Pool, DWORD Filter, DWORD MipFilter, D3DCOLOR ColorKey, 95 | D3DXIMAGE_INFO* pSrcInfo, PALETTEENTRY* pPalette, 96 | LPDIRECT3DTEXTURE9* ppTexture ); 97 | HRESULT CreateTextureFromFileEx( ID3D10Device* pDevice, LPCTSTR pSrcFile, 98 | D3DX10_IMAGE_LOAD_INFO* pLoadInfo, ID3DX10ThreadPump* pPump, 99 | ID3D10ShaderResourceView** ppOutputRV, bool bSRGB ); 100 | HRESULT CreateTextureFromResource( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, 101 | LPCTSTR pSrcResource, LPDIRECT3DTEXTURE9* ppTexture ); 102 | HRESULT CreateTextureFromResourceEx( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, 103 | LPCTSTR pSrcResource, UINT Width, UINT Height, UINT MipLevels, 104 | DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, DWORD Filter, 105 | DWORD MipFilter, D3DCOLOR ColorKey, D3DXIMAGE_INFO* pSrcInfo, 106 | PALETTEENTRY* pPalette, LPDIRECT3DTEXTURE9* ppTexture ); 107 | HRESULT CreateCubeTextureFromFile( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, 108 | LPDIRECT3DCUBETEXTURE9* ppCubeTexture ); 109 | HRESULT CreateCubeTextureFromFileEx( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, UINT Size, 110 | UINT MipLevels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, 111 | DWORD Filter, DWORD MipFilter, D3DCOLOR ColorKey, 112 | D3DXIMAGE_INFO* pSrcInfo, PALETTEENTRY* pPalette, 113 | LPDIRECT3DCUBETEXTURE9* ppCubeTexture ); 114 | HRESULT CreateCubeTextureFromResource( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, 115 | LPCTSTR pSrcResource, 116 | LPDIRECT3DCUBETEXTURE9* ppCubeTexture ); 117 | HRESULT CreateCubeTextureFromResourceEx( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, 118 | LPCTSTR pSrcResource, UINT Size, UINT MipLevels, 119 | DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, DWORD Filter, 120 | DWORD MipFilter, D3DCOLOR ColorKey, 121 | D3DXIMAGE_INFO* pSrcInfo, PALETTEENTRY* pPalette, 122 | LPDIRECT3DCUBETEXTURE9* ppCubeTexture ); 123 | HRESULT CreateVolumeTextureFromFile( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, 124 | LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture ); 125 | HRESULT CreateVolumeTextureFromFileEx( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, UINT Width, 126 | UINT Height, UINT Depth, UINT MipLevels, DWORD Usage, 127 | D3DFORMAT Format, D3DPOOL Pool, DWORD Filter, 128 | DWORD MipFilter, D3DCOLOR ColorKey, 129 | D3DXIMAGE_INFO* pSrcInfo, PALETTEENTRY* pPalette, 130 | LPDIRECT3DVOLUMETEXTURE9* ppTexture ); 131 | HRESULT CreateVolumeTextureFromResource( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, 132 | LPCTSTR pSrcResource, 133 | LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture ); 134 | HRESULT CreateVolumeTextureFromResourceEx( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, 135 | LPCTSTR pSrcResource, UINT Width, UINT Height, 136 | UINT Depth, UINT MipLevels, DWORD Usage, 137 | D3DFORMAT Format, D3DPOOL Pool, DWORD Filter, 138 | DWORD MipFilter, D3DCOLOR ColorKey, 139 | D3DXIMAGE_INFO* pSrcInfo, PALETTEENTRY* pPalette, 140 | LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture ); 141 | HRESULT CreateFont( LPDIRECT3DDEVICE9 pDevice, UINT Height, UINT Width, UINT Weight, 142 | UINT MipLevels, BOOL Italic, DWORD CharSet, DWORD OutputPrecision, 143 | DWORD Quality, DWORD PitchAndFamily, LPCTSTR pFacename, LPD3DXFONT* ppFont ); 144 | HRESULT CreateFontIndirect( LPDIRECT3DDEVICE9 pDevice, CONST D3DXFONT_DESC *pDesc, LPD3DXFONT *ppFont ); 145 | HRESULT CreateEffectFromFile( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pSrcFile, 146 | const D3DXMACRO* pDefines, LPD3DXINCLUDE pInclude, DWORD Flags, 147 | LPD3DXEFFECTPOOL pPool, LPD3DXEFFECT* ppEffect, 148 | LPD3DXBUFFER* ppCompilationErrors ); 149 | HRESULT CreateEffectFromResource( LPDIRECT3DDEVICE9 pDevice, HMODULE hSrcModule, 150 | LPCTSTR pSrcResource, const D3DXMACRO* pDefines, 151 | LPD3DXINCLUDE pInclude, DWORD Flags, LPD3DXEFFECTPOOL pPool, 152 | LPD3DXEFFECT* ppEffect, LPD3DXBUFFER* ppCompilationErrors ); 153 | 154 | public: 155 | HRESULT OnCreateDevice( IDirect3DDevice9* pd3dDevice ); 156 | HRESULT OnResetDevice( IDirect3DDevice9* pd3dDevice ); 157 | HRESULT OnLostDevice(); 158 | HRESULT OnDestroyDevice(); 159 | 160 | protected: 161 | friend CDXUTResourceCache& WINAPI DXUTGetGlobalResourceCache(); 162 | friend HRESULT WINAPI DXUTInitialize3DEnvironment(); 163 | friend HRESULT WINAPI DXUTReset3DEnvironment(); 164 | friend void WINAPI DXUTCleanup3DEnvironment( bool bReleaseSettings ); 165 | 166 | CDXUTResourceCache() 167 | { 168 | } 169 | 170 | CGrowableArray m_TextureCache; 171 | CGrowableArray m_EffectCache; 172 | CGrowableArray m_FontCache; 173 | }; 174 | 175 | CDXUTResourceCache& WINAPI DXUTGetGlobalResourceCache(); 176 | 177 | 178 | //-------------------------------------------------------------------------------------- 179 | // Manages the insertion point when drawing text 180 | //-------------------------------------------------------------------------------------- 181 | class CDXUTTextHelper 182 | { 183 | public: 184 | CDXUTTextHelper( ID3DXFont* pFont9 = NULL, ID3DXSprite* pSprite9 = NULL, ID3DX10Font* pFont10 = NULL, 185 | ID3DX10Sprite* pSprite10 = NULL, int nLineHeight = 15 ); 186 | CDXUTTextHelper( ID3DXFont* pFont9, ID3DXSprite* pSprite9, int nLineHeight = 15 ); 187 | CDXUTTextHelper( ID3DX10Font* pFont10, ID3DX10Sprite* pSprite10, int nLineHeight = 15 ); 188 | ~CDXUTTextHelper(); 189 | 190 | void Init( ID3DXFont* pFont9 = NULL, ID3DXSprite* pSprite9 = NULL, ID3DX10Font* pFont10 = NULL, 191 | ID3DX10Sprite* pSprite10 = NULL, int nLineHeight = 15 ); 192 | 193 | void SetInsertionPos( int x, int y ) 194 | { 195 | m_pt.x = x; m_pt.y = y; 196 | } 197 | void SetForegroundColor( D3DXCOLOR clr ) 198 | { 199 | m_clr = clr; 200 | } 201 | 202 | void Begin(); 203 | HRESULT DrawFormattedTextLine( const WCHAR* strMsg, ... ); 204 | HRESULT DrawTextLine( const WCHAR* strMsg ); 205 | HRESULT DrawFormattedTextLine( RECT& rc, DWORD dwFlags, const WCHAR* strMsg, ... ); 206 | HRESULT DrawTextLine( RECT& rc, DWORD dwFlags, const WCHAR* strMsg ); 207 | void End(); 208 | 209 | protected: 210 | ID3DXFont* m_pFont9; 211 | ID3DXSprite* m_pSprite9; 212 | ID3DX10Font* m_pFont10; 213 | ID3DX10Sprite* m_pSprite10; 214 | D3DXCOLOR m_clr; 215 | POINT m_pt; 216 | int m_nLineHeight; 217 | 218 | ID3D10BlendState* m_pFontBlendState10; 219 | }; 220 | 221 | 222 | //-------------------------------------------------------------------------------------- 223 | // Manages a persistent list of lines and draws them using ID3DXLine 224 | //-------------------------------------------------------------------------------------- 225 | class CDXUTLineManager 226 | { 227 | public: 228 | CDXUTLineManager(); 229 | ~CDXUTLineManager(); 230 | 231 | HRESULT OnCreatedDevice( IDirect3DDevice9* pd3dDevice ); 232 | HRESULT OnResetDevice(); 233 | HRESULT OnRender(); 234 | HRESULT OnLostDevice(); 235 | HRESULT OnDeletedDevice(); 236 | 237 | HRESULT AddLine( int* pnLineID, D3DXVECTOR2* pVertexList, DWORD dwVertexListCount, D3DCOLOR Color, float fWidth, 238 | float fScaleRatio, bool bAntiAlias ); 239 | HRESULT AddRect( int* pnLineID, RECT rc, D3DCOLOR Color, float fWidth, float fScaleRatio, bool bAntiAlias ); 240 | HRESULT RemoveLine( int nLineID ); 241 | HRESULT RemoveAllLines(); 242 | 243 | protected: 244 | struct LINE_NODE 245 | { 246 | int nLineID; 247 | D3DCOLOR Color; 248 | float fWidth; 249 | bool bAntiAlias; 250 | float fScaleRatio; 251 | D3DXVECTOR2* pVertexList; 252 | DWORD dwVertexListCount; 253 | }; 254 | 255 | CGrowableArray m_LinesList; 256 | IDirect3DDevice9* m_pd3dDevice; 257 | ID3DXLine* m_pD3DXLine; 258 | }; 259 | 260 | 261 | //-------------------------------------------------------------------------------------- 262 | // Shared code for samples to ask user if they want to use a REF device or quit 263 | //-------------------------------------------------------------------------------------- 264 | void WINAPI DXUTDisplaySwitchingToREFWarning( DXUTDeviceVersion ver ); 265 | 266 | //-------------------------------------------------------------------------------------- 267 | // Tries to finds a media file by searching in common locations 268 | //-------------------------------------------------------------------------------------- 269 | HRESULT WINAPI DXUTFindDXSDKMediaFileCch( __out_ecount(cchDest) WCHAR* strDestPath, 270 | __in int cchDest, 271 | __in LPCWSTR strFilename ); 272 | HRESULT WINAPI DXUTSetMediaSearchPath( LPCWSTR strPath ); 273 | LPCWSTR WINAPI DXUTGetMediaSearchPath(); 274 | 275 | 276 | //-------------------------------------------------------------------------------------- 277 | // Returns a view matrix for rendering to a face of a cubemap. 278 | //-------------------------------------------------------------------------------------- 279 | D3DXMATRIX WINAPI DXUTGetCubeMapViewMatrix( DWORD dwFace ); 280 | 281 | 282 | //-------------------------------------------------------------------------------------- 283 | // Takes a screen shot of a 32bit D3D10 back buffer and saves the images to a BMP file 284 | //-------------------------------------------------------------------------------------- 285 | HRESULT DXUTSnapD3D9Screenshot( LPCTSTR szFileName ); 286 | HRESULT DXUTSnapD3D10Screenshot( LPCTSTR szFileName ); 287 | 288 | //-------------------------------------------------------------------------------------- 289 | // Simple helper stack class 290 | //-------------------------------------------------------------------------------------- 291 | template class CDXUTStack 292 | { 293 | private: 294 | UINT m_MemorySize; 295 | UINT m_NumElements; 296 | T* m_pData; 297 | 298 | bool EnsureStackSize( UINT64 iElements ) 299 | { 300 | if( m_MemorySize > iElements ) 301 | return true; 302 | 303 | T* pTemp = new T[ ( size_t )( iElements * 2 + 256 ) ]; 304 | if( !pTemp ) 305 | return false; 306 | 307 | if( m_NumElements ) 308 | { 309 | CopyMemory( pTemp, m_pData, ( size_t )( m_NumElements * sizeof( T ) ) ); 310 | } 311 | 312 | if( m_pData ) delete []m_pData; 313 | m_pData = pTemp; 314 | return true; 315 | } 316 | 317 | public: 318 | CDXUTStack() 319 | { 320 | m_pData = NULL; m_NumElements = 0; m_MemorySize = 0; 321 | } 322 | ~CDXUTStack() 323 | { 324 | if( m_pData ) delete []m_pData; 325 | } 326 | 327 | UINT GetCount() 328 | { 329 | return m_NumElements; 330 | } 331 | T GetAt( UINT i ) 332 | { 333 | return m_pData[i]; 334 | } 335 | T GetTop() 336 | { 337 | if( m_NumElements < 1 ) 338 | return NULL; 339 | 340 | return m_pData[ m_NumElements - 1 ]; 341 | } 342 | 343 | T GetRelative( INT i ) 344 | { 345 | INT64 iVal = m_NumElements - 1 + i; 346 | if( iVal < 0 ) 347 | return NULL; 348 | return m_pData[ iVal ]; 349 | } 350 | 351 | bool Push( T pElem ) 352 | { 353 | if( !EnsureStackSize( m_NumElements + 1 ) ) 354 | return false; 355 | 356 | m_pData[m_NumElements] = pElem; 357 | m_NumElements++; 358 | 359 | return true; 360 | } 361 | 362 | T Pop() 363 | { 364 | if( m_NumElements < 1 ) 365 | return NULL; 366 | 367 | m_NumElements --; 368 | return m_pData[m_NumElements]; 369 | } 370 | }; 371 | 372 | 373 | #endif 374 | -------------------------------------------------------------------------------- /DXUT/Optional/SDKsound.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // File: DXUTsound.h 3 | // 4 | // Copyright (c) Microsoft Corp. All rights reserved. 5 | //----------------------------------------------------------------------------- 6 | #ifndef DXUTSOUND_H 7 | #define DXUTSOUND_H 8 | 9 | //----------------------------------------------------------------------------- 10 | // Header Includes 11 | //----------------------------------------------------------------------------- 12 | #include 13 | #define _KS_NO_ANONYMOUS_STRUCTURES_ // avoids most nameless structure in ks.h 14 | #pragma warning( disable : 4201 ) // disable nonstandard extension used : nameless struct/union 15 | #include 16 | #pragma warning( default : 4201 ) 17 | 18 | //----------------------------------------------------------------------------- 19 | // Classes used by this header 20 | //----------------------------------------------------------------------------- 21 | class CSoundManager; 22 | class CSound; 23 | class CStreamingSound; 24 | class CWaveFile; 25 | 26 | 27 | //----------------------------------------------------------------------------- 28 | // Typing macros 29 | //----------------------------------------------------------------------------- 30 | #define DXUT_StopSound(s) { if(s) s->Stop(); } 31 | #define DXUT_PlaySound(s) { if(s) s->Play( 0, 0 ); } 32 | #define DXUT_PlaySoundLooping(s) { if(s) s->Play( 0, DSBPLAY_LOOPING ); } 33 | 34 | 35 | //----------------------------------------------------------------------------- 36 | // Name: class CSoundManager 37 | // Desc: 38 | //----------------------------------------------------------------------------- 39 | class CSoundManager 40 | { 41 | protected: 42 | IDirectSound8* m_pDS; 43 | 44 | public: 45 | CSoundManager(); 46 | ~CSoundManager(); 47 | 48 | HRESULT Initialize( HWND hWnd, DWORD dwCoopLevel ); 49 | inline LPDIRECTSOUND8 GetDirectSound() 50 | { 51 | return m_pDS; 52 | } 53 | HRESULT SetPrimaryBufferFormat( DWORD dwPrimaryChannels, DWORD dwPrimaryFreq, 54 | DWORD dwPrimaryBitRate ); 55 | HRESULT Get3DListenerInterface( LPDIRECTSOUND3DLISTENER* ppDSListener ); 56 | 57 | HRESULT Create( CSound** ppSound, LPWSTR strWaveFileName, DWORD dwCreationFlags = 0, 58 | GUID guid3DAlgorithm = GUID_NULL, DWORD dwNumBuffers = 1 ); 59 | HRESULT CreateFromMemory( CSound** ppSound, BYTE* pbData, ULONG ulDataSize, LPWAVEFORMATEX pwfx, 60 | DWORD dwCreationFlags = 0, GUID guid3DAlgorithm = GUID_NULL, 61 | DWORD dwNumBuffers = 1 ); 62 | HRESULT CreateStreaming( CStreamingSound** ppStreamingSound, LPWSTR strWaveFileName, 63 | DWORD dwCreationFlags, GUID guid3DAlgorithm, DWORD dwNotifyCount, 64 | DWORD dwNotifySize, HANDLE hNotifyEvent ); 65 | }; 66 | 67 | 68 | //----------------------------------------------------------------------------- 69 | // Name: class CSound 70 | // Desc: Encapsulates functionality of a DirectSound buffer. 71 | //----------------------------------------------------------------------------- 72 | class CSound 73 | { 74 | protected: 75 | LPDIRECTSOUNDBUFFER* m_apDSBuffer; 76 | DWORD m_dwDSBufferSize; 77 | CWaveFile* m_pWaveFile; 78 | DWORD m_dwNumBuffers; 79 | DWORD m_dwCreationFlags; 80 | 81 | HRESULT RestoreBuffer( LPDIRECTSOUNDBUFFER pDSB, BOOL* pbWasRestored ); 82 | 83 | public: 84 | CSound( LPDIRECTSOUNDBUFFER* apDSBuffer, DWORD dwDSBufferSize, DWORD dwNumBuffers, 85 | CWaveFile* pWaveFile, DWORD dwCreationFlags ); 86 | virtual ~CSound(); 87 | 88 | HRESULT Get3DBufferInterface( DWORD dwIndex, LPDIRECTSOUND3DBUFFER* ppDS3DBuffer ); 89 | HRESULT FillBufferWithSound( LPDIRECTSOUNDBUFFER pDSB, BOOL bRepeatWavIfBufferLarger ); 90 | LPDIRECTSOUNDBUFFER GetFreeBuffer(); 91 | LPDIRECTSOUNDBUFFER GetBuffer( DWORD dwIndex ); 92 | 93 | HRESULT Play( DWORD dwPriority = 0, DWORD dwFlags = 0, LONG lVolume = 0, LONG lFrequency = -1, 94 | LONG lPan = 0 ); 95 | HRESULT Play3D( LPDS3DBUFFER p3DBuffer, DWORD dwPriority = 0, DWORD dwFlags = 0, LONG lFrequency = 0 ); 96 | HRESULT Stop(); 97 | HRESULT Reset(); 98 | BOOL IsSoundPlaying(); 99 | }; 100 | 101 | 102 | //----------------------------------------------------------------------------- 103 | // Name: class CStreamingSound 104 | // Desc: Encapsulates functionality to play a wave file with DirectSound. 105 | // The Create() method loads a chunk of wave file into the buffer, 106 | // and as sound plays more is written to the buffer by calling 107 | // HandleWaveStreamNotification() whenever hNotifyEvent is signaled. 108 | //----------------------------------------------------------------------------- 109 | class CStreamingSound : public CSound 110 | { 111 | protected: 112 | DWORD m_dwLastPlayPos; 113 | DWORD m_dwPlayProgress; 114 | DWORD m_dwNotifySize; 115 | DWORD m_dwNextWriteOffset; 116 | BOOL m_bFillNextNotificationWithSilence; 117 | 118 | public: 119 | CStreamingSound( LPDIRECTSOUNDBUFFER pDSBuffer, DWORD dwDSBufferSize, CWaveFile* pWaveFile, 120 | DWORD dwNotifySize ); 121 | ~CStreamingSound(); 122 | 123 | HRESULT HandleWaveStreamNotification( BOOL bLoopedPlay ); 124 | HRESULT Reset(); 125 | }; 126 | 127 | #endif // DXUTSOUND_H 128 | -------------------------------------------------------------------------------- /DXUT/Optional/SDKwavefile.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // File: WaveFile.h 3 | // 4 | // Copyright (c) Microsoft Corp. All rights reserved. 5 | //----------------------------------------------------------------------------- 6 | #ifndef DXUTWAVEFILE_H 7 | #define DXUTWAVEFILE_H 8 | 9 | //----------------------------------------------------------------------------- 10 | // Typing macros 11 | //----------------------------------------------------------------------------- 12 | #define WAVEFILE_READ 1 13 | #define WAVEFILE_WRITE 2 14 | 15 | //----------------------------------------------------------------------------- 16 | // Name: class CWaveFile 17 | // Desc: Encapsulates reading or writing sound data to or from a wave file 18 | //----------------------------------------------------------------------------- 19 | class CWaveFile 20 | { 21 | public: 22 | WAVEFORMATEX* m_pwfx; // Pointer to WAVEFORMATEX structure 23 | HMMIO m_hmmio; // MM I/O handle for the WAVE 24 | MMCKINFO m_ck; // Multimedia RIFF chunk 25 | MMCKINFO m_ckRiff; // Use in opening a WAVE file 26 | DWORD m_dwSize; // The size of the wave file 27 | MMIOINFO m_mmioinfoOut; 28 | DWORD m_dwFlags; 29 | BOOL m_bIsReadingFromMemory; 30 | BYTE* m_pbData; 31 | BYTE* m_pbDataCur; 32 | ULONG m_ulDataSize; 33 | CHAR* m_pResourceBuffer; 34 | 35 | protected: 36 | HRESULT ReadMMIO(); 37 | HRESULT WriteMMIO( WAVEFORMATEX* pwfxDest ); 38 | 39 | public: 40 | CWaveFile(); 41 | ~CWaveFile(); 42 | 43 | HRESULT Open( LPWSTR strFileName, WAVEFORMATEX* pwfx, DWORD dwFlags ); 44 | HRESULT OpenFromMemory( BYTE* pbData, ULONG ulDataSize, WAVEFORMATEX* pwfx, DWORD dwFlags ); 45 | HRESULT Close(); 46 | 47 | HRESULT Read( BYTE* pBuffer, DWORD dwSizeToRead, DWORD* pdwSizeRead ); 48 | HRESULT Write( UINT nSizeToWrite, BYTE* pbData, UINT* pnSizeWrote ); 49 | 50 | DWORD GetSize(); 51 | HRESULT ResetFile(); 52 | WAVEFORMATEX* GetFormat() 53 | { 54 | return m_pwfx; 55 | }; 56 | }; 57 | 58 | 59 | #endif // DXUTWAVEFILE_H 60 | -------------------------------------------------------------------------------- /DXUT/Optional/directx.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taehwan642/KeyLogger/33b4a5edf5f5d9da0355979d5dd1de4ee761b53b/DXUT/Optional/directx.ico -------------------------------------------------------------------------------- /KeyLogger.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taehwan642/KeyLogger/33b4a5edf5f5d9da0355979d5dd1de4ee761b53b/KeyLogger.cpp -------------------------------------------------------------------------------- /KeyLogger.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #define IDC_STATIC -1 11 | #include 12 | 13 | 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | #undef APSTUDIO_READONLY_SYMBOLS 17 | 18 | ///////////////////////////////////////////////////////////////////////////// 19 | // English (U.S.) resources 20 | 21 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 22 | #ifdef _WIN32 23 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 24 | #pragma code_page(1252) 25 | #endif //_WIN32 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | // 29 | // Icon 30 | // 31 | 32 | // Icon with lowest ID value placed first to ensure application icon 33 | // remains consistent on all systems. 34 | IDI_MAIN_ICON ICON "keyicon.ico" 35 | 36 | #ifdef APSTUDIO_INVOKED 37 | ///////////////////////////////////////////////////////////////////////////// 38 | // 39 | // TEXTINCLUDE 40 | // 41 | 42 | 1 TEXTINCLUDE 43 | BEGIN 44 | "resource.h\0" 45 | END 46 | 47 | 2 TEXTINCLUDE 48 | BEGIN 49 | "#define IDC_STATIC -1\r\n" 50 | "#include \r\n" 51 | "\r\n" 52 | "\r\n" 53 | "\0" 54 | END 55 | 56 | 3 TEXTINCLUDE 57 | BEGIN 58 | "\r\n" 59 | "\0" 60 | END 61 | 62 | #endif // APSTUDIO_INVOKED 63 | 64 | #endif // English (U.S.) resources 65 | ///////////////////////////////////////////////////////////////////////////// 66 | 67 | 68 | 69 | #ifndef APSTUDIO_INVOKED 70 | ///////////////////////////////////////////////////////////////////////////// 71 | // 72 | // Generated from the TEXTINCLUDE 3 resource. 73 | // 74 | 75 | 76 | ///////////////////////////////////////////////////////////////////////////// 77 | #endif // not APSTUDIO_INVOKED 78 | 79 | -------------------------------------------------------------------------------- /KeyLogger_2008.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 10.00 2 | # Visual Studio 2008 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyLogger", "KeyLogger_2008.vcproj", "{D3D09108-96D0-4629-88B8-122C0256058C}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Debug|x64 = Debug|x64 9 | Profile|Win32 = Profile|Win32 10 | Profile|x64 = Profile|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {D3D09108-96D0-4629-88B8-122C0256058C}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {D3D09108-96D0-4629-88B8-122C0256058C}.Debug|Win32.Build.0 = Debug|Win32 17 | {D3D09108-96D0-4629-88B8-122C0256058C}.Debug|x64.ActiveCfg = Debug|x64 18 | {D3D09108-96D0-4629-88B8-122C0256058C}.Debug|x64.Build.0 = Debug|x64 19 | {D3D09108-96D0-4629-88B8-122C0256058C}.Profile|Win32.ActiveCfg = Profile|Win32 20 | {D3D09108-96D0-4629-88B8-122C0256058C}.Profile|Win32.Build.0 = Profile|Win32 21 | {D3D09108-96D0-4629-88B8-122C0256058C}.Profile|x64.ActiveCfg = Profile|x64 22 | {D3D09108-96D0-4629-88B8-122C0256058C}.Profile|x64.Build.0 = Profile|x64 23 | {D3D09108-96D0-4629-88B8-122C0256058C}.Release|Win32.ActiveCfg = Release|Win32 24 | {D3D09108-96D0-4629-88B8-122C0256058C}.Release|Win32.Build.0 = Release|Win32 25 | {D3D09108-96D0-4629-88B8-122C0256058C}.Release|x64.ActiveCfg = Release|x64 26 | {D3D09108-96D0-4629-88B8-122C0256058C}.Release|x64.Build.0 = Release|x64 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /KeyLogger_2008.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /KeyLogger_2010.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2010 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyLogger", "KeyLogger_2010.vcxproj", "{D3D09108-96D0-4629-88B8-122C0256058C}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Debug|x64 = Debug|x64 9 | Profile|Win32 = Profile|Win32 10 | Profile|x64 = Profile|x64 11 | Release|Win32 = Release|Win32 12 | Release|x64 = Release|x64 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {D3D09108-96D0-4629-88B8-122C0256058C}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {D3D09108-96D0-4629-88B8-122C0256058C}.Debug|Win32.Build.0 = Debug|Win32 17 | {D3D09108-96D0-4629-88B8-122C0256058C}.Debug|x64.ActiveCfg = Debug|x64 18 | {D3D09108-96D0-4629-88B8-122C0256058C}.Debug|x64.Build.0 = Debug|x64 19 | {D3D09108-96D0-4629-88B8-122C0256058C}.Profile|Win32.ActiveCfg = Profile|Win32 20 | {D3D09108-96D0-4629-88B8-122C0256058C}.Profile|Win32.Build.0 = Profile|Win32 21 | {D3D09108-96D0-4629-88B8-122C0256058C}.Profile|x64.ActiveCfg = Profile|x64 22 | {D3D09108-96D0-4629-88B8-122C0256058C}.Profile|x64.Build.0 = Profile|x64 23 | {D3D09108-96D0-4629-88B8-122C0256058C}.Release|Win32.ActiveCfg = Release|Win32 24 | {D3D09108-96D0-4629-88B8-122C0256058C}.Release|Win32.Build.0 = Release|Win32 25 | {D3D09108-96D0-4629-88B8-122C0256058C}.Release|x64.ActiveCfg = Release|x64 26 | {D3D09108-96D0-4629-88B8-122C0256058C}.Release|x64.Build.0 = Release|x64 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /KeyLogger_2010.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {8e114980-c1a3-4ada-ad7c-83caadf5daeb} 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 7 | 8 | 9 | {a43c5c25-0e86-4a20-b64a-883785ff74fd} 10 | 11 | 12 | {2c3d4c8c-5d1a-459a-a05a-a4e4b608a44e} 13 | fx;fxh;hlsl 14 | 15 | 16 | 17 | 18 | Resource Files 19 | 20 | 21 | DXUT 22 | 23 | 24 | DXUT 25 | 26 | 27 | DXUT 28 | 29 | 30 | DXUT 31 | 32 | 33 | DXUT 34 | 35 | 36 | DXUT 37 | 38 | 39 | DXUT 40 | 41 | 42 | DXUT 43 | 44 | 45 | DXUT 46 | 47 | 48 | DXUT 49 | 50 | 51 | DXUT 52 | 53 | 54 | DXUT 55 | 56 | 57 | DXUT 58 | 59 | 60 | DXUT 61 | 62 | 63 | DXUT 64 | 65 | 66 | DXUT 67 | 68 | 69 | DXUT 70 | 71 | 72 | DXUT 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | Resource Files 83 | 84 | 85 | Resource Files 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /KeyLogger_2010.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KeyLogger 2 | 3 | ![1598978247](https://user-images.githubusercontent.com/49132911/92013020-2e849f00-ed88-11ea-80a4-ba5ac371274a.png) 4 | 5 | 6 | This program allows you to see how many times you pressed a specific key. 7 | 8 | If you want to remove your logs, just delete KeyLogger.txt. 9 | 10 | *DO NOT USE THIS PROGRAM FOR OTHER USE* 11 | -------------------------------------------------------------------------------- /keyboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taehwan642/KeyLogger/33b4a5edf5f5d9da0355979d5dd1de4ee761b53b/keyboard.png -------------------------------------------------------------------------------- /keyicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taehwan642/KeyLogger/33b4a5edf5f5d9da0355979d5dd1de4ee761b53b/keyicon.ico -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by KeyLogger.rc 4 | // 5 | #define IDI_MAIN_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 113 12 | #define _APS_NEXT_COMMAND_VALUE 40029 13 | #define _APS_NEXT_CONTROL_VALUE 1000 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | --------------------------------------------------------------------------------