Advertisement
Guest User

Untitled

a guest
May 29th, 2015
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.12 KB | None | 0 0
  1. #pragma comment (lib, "D3D10_1.lib")
  2. #pragma comment (lib, "DXGI.lib")
  3. #pragma comment (lib, "D2D1.lib")
  4. #pragma comment (lib, "dwrite.lib")
  5.  
  6. #include <windows.h>
  7. #include <d3d11.h>
  8. #include <d3dx11.h>
  9. #include <D3DX10.h>
  10. #include <xnamath.h>
  11. #include <D3D10_1.h>
  12. #include <DXGI.h>
  13. #include <D2D1.h>
  14. #include <sstream>
  15. #include <dwrite.h>
  16.  
  17. //Global Declarations - Interfaces//
  18. IDXGISwapChain* SwapChain;
  19. ID3D11Device* d3d11Device;
  20. ID3D11DeviceContext* d3d11DevCon;
  21. ID3D11RenderTargetView* renderTargetView;
  22. ID3D11Buffer* squareIndexBuffer;
  23. ID3D11Buffer* squareVertBuffer;
  24. ID3D11VertexShader* VS;
  25. ID3D11PixelShader* PS;
  26. ID3D10Blob* VS_Buffer;
  27. ID3D10Blob* PS_Buffer;
  28. ID3D11InputLayout* vertLayout;
  29. ID3D11DepthStencilView* depthStencilView;
  30. ID3D11Texture2D* depthStencilBuffer;
  31. ID3D11Buffer* cbPerObjectBuffer;
  32. ID3D11BlendState* Transparency;
  33. ID3D11RasterizerState* CCWcullMode;
  34. ID3D11RasterizerState* CWcullMode;
  35. ID3D11ShaderResourceView* CubesTexture;
  36. ID3D11SamplerState* CubesTexSamplerState;
  37. ID3D11Buffer* cbPerFrameBuffer;
  38. ID3D11PixelShader* D2D_PS;
  39. ID3D10Blob* D2D_PS_Buffer;
  40.  
  41.  
  42. ID3D10Device1 *d3d101Device;
  43. IDXGIKeyedMutex *keyedMutex11;
  44. IDXGIKeyedMutex *keyedMutex10;
  45. ID2D1RenderTarget *D2DRenderTarget;
  46. ID2D1SolidColorBrush *Brush;
  47. ID3D11Texture2D *BackBuffer11;
  48. ID3D11Texture2D *sharedTex11;
  49. ID3D11Buffer *d2dVertBuffer;
  50. ID3D11Buffer *d2dIndexBuffer;
  51. ID3D11ShaderResourceView *d2dTexture;
  52. IDWriteFactory *DWriteFactory;
  53. IDWriteTextFormat *TextFormat;
  54. std::wstring printText;
  55.  
  56.  
  57. //Global Declarations - Others//
  58. LPCTSTR WndClassName = L"firstwindow";
  59. HWND hwnd = NULL;
  60. HRESULT hr;
  61.  
  62. const int Width = 300;
  63. const int Height = 300;
  64.  
  65.  
  66. ///////////////Cameras/////////////
  67. XMMATRIX WVP;
  68. XMMATRIX cube1World;
  69. XMMATRIX cube2World;
  70. XMMATRIX camView;
  71. XMMATRIX camProjection;
  72.  
  73. XMVECTOR camPosition;
  74. XMVECTOR camTarget;
  75. XMVECTOR camUp;
  76.  
  77. XMMATRIX Rotation;
  78. XMMATRIX Scale;
  79. XMMATRIX Translation;
  80. float rot = 0.01f;
  81.  
  82.  
  83.  
  84. double countsPerSecond = 0.0;
  85. __int64 CounterStart = 0;
  86.  
  87. int frameCount = 0;
  88. int fps = 0;
  89.  
  90. __int64 frameTimeOld = 0;
  91. double frameTime;
  92.  
  93.  
  94. //Function Prototypes//
  95. bool InitializeDirect3d11App(HINSTANCE hInstance);
  96. void CleanUp();
  97. bool InitScene();
  98. void UpdateScene();
  99. void DrawScene();
  100. bool InitD2D_D3D101_DWrite(IDXGIAdapter1 *Adapter);
  101. void InitD2DScreenTexture();
  102.  
  103. void UpdateScene(double time);
  104.  
  105. void RenderText(std::wstring text, int inInt);
  106.  
  107. void StartTimer();
  108. double GetTime();
  109. double GetFrameTime();
  110.  
  111.  
  112. bool InitializeWindow(HINSTANCE hInstance,
  113. int ShowWnd,
  114. int width, int height,
  115. bool windowed);
  116. int messageloop();
  117.  
  118. LRESULT CALLBACK WndProc(HWND hWnd,
  119. UINT msg,
  120. WPARAM wParam,
  121. LPARAM lParam);
  122.  
  123. // Create effects constant buffer's structure
  124. struct cbPerObject
  125. {
  126. XMMATRIX WVP;
  127. XMMATRIX World;
  128. };
  129.  
  130. cbPerObject cbPerObj;
  131.  
  132. struct Light
  133. {
  134. Light()
  135. {
  136. ZeroMemory(this, sizeof(Light));
  137. }
  138. XMFLOAT3 dir;
  139. float pad1;
  140. ///////////////**************new**************////////////////////
  141. XMFLOAT3 pos;
  142. float range;
  143. XMFLOAT3 att;
  144. float pad2;
  145. ///////////////**************new**************////////////////////
  146. XMFLOAT4 ambient;
  147. XMFLOAT4 diffuse;
  148. };
  149.  
  150. Light light;
  151.  
  152. struct cbPerFrame
  153. {
  154. Light light;
  155. };
  156.  
  157. cbPerFrame constbuffPerFrame;
  158.  
  159. //Vertex Structure and Vertex Layout (Input Layout)
  160. struct Vertex //Overloaded Vertex Structure
  161. {
  162. Vertex(){}
  163. Vertex(float x, float y, float z,
  164. float u, float v,
  165. float nx, float ny, float nz)
  166. : pos(x,y,z), texCoord(u, v), normal(nx, ny, nz){}
  167. XMFLOAT3 pos;
  168. XMFLOAT2 texCoord;
  169. XMFLOAT3 normal;
  170. };
  171.  
  172. D3D11_INPUT_ELEMENT_DESC layout[] =
  173. {
  174. { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  175. { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
  176. { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0}
  177. };
  178.  
  179. UINT numElements = ARRAYSIZE(layout);
  180.  
  181.  
  182. int WINAPI WinMain(HINSTANCE hInstance, //Main windows function
  183. HINSTANCE hPrevInstance,
  184. LPSTR lpCmdLine,
  185. int nShowCmd)
  186. {
  187.  
  188. if(!InitializeWindow(hInstance, nShowCmd, Width, Height, true))
  189. {
  190. MessageBox(0, L"Window Initialization - Failed",
  191. L"Error", MB_OK);
  192. return 0;
  193. }
  194.  
  195. if(!InitializeDirect3d11App(hInstance)) //Initialize Direct3D
  196. {
  197. MessageBox(0, L"Direct3D Initialization - Failed",
  198. L"Error", MB_OK);
  199. return 0;
  200. }
  201.  
  202. if(!InitScene()) //Initialize our scene
  203. {
  204. MessageBox(0, L"Scene Initialization - Failed",
  205. L"Error", MB_OK);
  206. return 0;
  207. }
  208.  
  209. messageloop();
  210.  
  211. CleanUp();
  212.  
  213. return 0;
  214. }
  215.  
  216. bool InitializeWindow(HINSTANCE hInstance,
  217. int ShowWnd,
  218. int width, int height,
  219. bool windowed)
  220. {
  221. typedef struct _WNDCLASS {
  222. UINT cbSize;
  223. UINT style;
  224. WNDPROC lpfnWndProc;
  225. int cbClsExtra;
  226. int cbWndExtra;
  227. HANDLE hInstance;
  228. HICON hIcon;
  229. HCURSOR hCursor;
  230. HBRUSH hbrBackground;
  231. LPCTSTR lpszMenuName;
  232. LPCTSTR lpszClassName;
  233. } WNDCLASS;
  234.  
  235. WNDCLASSEX wc;
  236.  
  237. wc.cbSize = sizeof(WNDCLASSEX);
  238. wc.style = CS_HREDRAW | CS_VREDRAW;
  239. wc.lpfnWndProc = WndProc;
  240. wc.cbClsExtra = NULL;
  241. wc.cbWndExtra = NULL;
  242. wc.hInstance = hInstance;
  243. wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
  244. wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  245. wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 2);
  246. wc.lpszMenuName = NULL;
  247. wc.lpszClassName = WndClassName;
  248. wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
  249.  
  250. if (!RegisterClassEx(&wc))
  251. {
  252. MessageBox(NULL, L"Error registering class",
  253. L"Error", MB_OK | MB_ICONERROR);
  254. return 1;
  255. }
  256.  
  257. hwnd = CreateWindowEx(
  258. NULL,
  259. WndClassName,
  260. L"Lesson 4 - Begin Drawing",
  261. WS_OVERLAPPEDWINDOW,
  262. CW_USEDEFAULT, CW_USEDEFAULT,
  263. width, height,
  264. NULL,
  265. NULL,
  266. hInstance,
  267. NULL
  268. );
  269.  
  270. if (!hwnd)
  271. {
  272. MessageBox(NULL, L"Error creating window",
  273. L"Error", MB_OK | MB_ICONERROR);
  274. return 1;
  275. }
  276.  
  277. ShowWindow(hwnd, ShowWnd);
  278. UpdateWindow(hwnd);
  279.  
  280. return true;
  281. }
  282.  
  283. bool InitializeDirect3d11App(HINSTANCE hInstance)
  284. {
  285. //Describe our Buffer
  286. DXGI_MODE_DESC bufferDesc;
  287.  
  288. ZeroMemory(&bufferDesc, sizeof(DXGI_MODE_DESC));
  289.  
  290. bufferDesc.Width = Width;
  291. bufferDesc.Height = Height;
  292. bufferDesc.RefreshRate.Numerator = 60;
  293. bufferDesc.RefreshRate.Denominator = 1;
  294. bufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
  295. bufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
  296. bufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
  297.  
  298. //Describe our SwapChain
  299. DXGI_SWAP_CHAIN_DESC swapChainDesc;
  300.  
  301. ZeroMemory(&swapChainDesc, sizeof(DXGI_SWAP_CHAIN_DESC));
  302.  
  303. swapChainDesc.BufferDesc = bufferDesc;
  304. swapChainDesc.SampleDesc.Count = 1;
  305. swapChainDesc.SampleDesc.Quality = 0;
  306. swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
  307. swapChainDesc.BufferCount = 1;
  308. swapChainDesc.OutputWindow = hwnd;
  309. swapChainDesc.Windowed = TRUE;
  310. swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
  311.  
  312. // Create DXGI factory to enumerate adapters//////////////////////
  313. IDXGIFactory1 *IDXGIFactory;
  314.  
  315. HRESULT hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&IDXGIFactory);
  316.  
  317. // Use the first adapter
  318. IDXGIAdapter1 *Adapter;
  319.  
  320. hr = IDXGIFactory->EnumAdapters1(0, &Adapter);
  321.  
  322. IDXGIFactory->Release();
  323.  
  324. //Create our D3D11 device SwapChain
  325. hr = D3D11CreateDeviceAndSwapChain(Adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, D3D11_CREATE_DEVICE_DEBUG | D3D11_CREATE_DEVICE_BGRA_SUPPORT, NULL, NULL,
  326. D3D11_SDK_VERSION, &swapChainDesc, &SwapChain, &d3d11Device, NULL, &d3d11DevCon);
  327.  
  328. //Initialize Direct2d, Direct3d 10.1, DirectWrite
  329. InitD2D_D3D101_DWrite(Adapter);
  330.  
  331. //Release teh Adapter interface
  332. Adapter->Release();
  333.  
  334. //Create our BackBuffer
  335. ID3D11Texture2D* BackBuffer;
  336. hr = SwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), (void**)&BackBuffer );
  337.  
  338. //Create our Render Target
  339. hr = d3d11Device->CreateRenderTargetView( BackBuffer, NULL, &renderTargetView );
  340. BackBuffer->Release();
  341.  
  342.  
  343. D3D11_TEXTURE2D_DESC depthStencilDesc;
  344.  
  345. depthStencilDesc.Width = Width;
  346. depthStencilDesc.Height = Height;
  347. depthStencilDesc.MipLevels = 1;
  348. depthStencilDesc.ArraySize = 1;
  349. depthStencilDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
  350. depthStencilDesc.SampleDesc.Count = 1;
  351. depthStencilDesc.SampleDesc.Quality = 0;
  352. depthStencilDesc.Usage = D3D11_USAGE_DEFAULT;
  353. depthStencilDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
  354. depthStencilDesc.CPUAccessFlags = 0;
  355. depthStencilDesc.MiscFlags = 0;
  356.  
  357. //Create teh Depth/Stencil View
  358. d3d11Device->CreateTexture2D(&depthStencilDesc, NULL, &depthStencilBuffer);
  359. d3d11Device->CreateDepthStencilView(depthStencilBuffer, NULL, &depthStencilView);
  360.  
  361. //Set our Render Target
  362. //ADD IN our depthStencilView for our render target
  363. d3d11DevCon->OMSetRenderTargets( 1, &renderTargetView, depthStencilView );
  364.  
  365. return true;
  366. }
  367.  
  368. bool InitD2D_D3D101_DWrite(IDXGIAdapter1 *Adapter)
  369. {
  370. //Create our D3D 10.1 Device/////////
  371. hr = D3D10CreateDevice1(Adapter, D3D10_DRIVER_TYPE_HARDWARE, NULL, D3D10_CREATE_DEVICE_DEBUG | D3D10_CREATE_DEVICE_BGRA_SUPPORT,
  372. D3D10_FEATURE_LEVEL_9_3, D3D10_1_SDK_VERSION, &d3d101Device);
  373.  
  374. //Create shared texture that D3d 10.1 will render on///////////
  375. D3D11_TEXTURE2D_DESC sharedTexDesc;
  376.  
  377. ZeroMemory(&sharedTexDesc, sizeof(sharedTexDesc));
  378.  
  379. sharedTexDesc.Width = Width;
  380. sharedTexDesc.Height = Height;
  381. sharedTexDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
  382. sharedTexDesc.MipLevels = 1;
  383. sharedTexDesc.ArraySize = 1;
  384. sharedTexDesc.SampleDesc.Count = 1;
  385. sharedTexDesc.Usage = D3D11_USAGE_DEFAULT;
  386. sharedTexDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
  387. sharedTexDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
  388.  
  389. hr = d3d11Device->CreateTexture2D(&sharedTexDesc, NULL, &sharedTex11);
  390.  
  391.  
  392. //Get the keyed mutex for the shared texture (for D3D11)
  393. hr = sharedTex11->QueryInterface(__uuidof(IDXGIKeyedMutex), (void**)&keyedMutex11);
  394.  
  395. // Get the shared handle needed to open the shared texture in d3d10.1
  396. IDXGIResource *sharedResource10;
  397. HANDLE sharedHandle10;
  398.  
  399. hr = sharedTex11->QueryInterface(__uuidof(IDXGIResource), (void**)&sharedResource10);
  400.  
  401. hr = sharedResource10->GetSharedHandle(&sharedHandle10);
  402.  
  403. sharedResource10->Release();
  404.  
  405. //Open the surface for the shared texture in d3d10.1///////
  406. IDXGISurface1 *sharedSurface10;
  407.  
  408. hr = d3d101Device->OpenSharedResource(sharedHandle10, __uuidof(IDXGISurface1), (void**)(&sharedSurface10));
  409.  
  410. hr = sharedSurface10->QueryInterface(__uuidof(IDXGIKeyedMutex), (void**)&keyedMutex10);
  411.  
  412.  
  413. // Create D2D Factory /////////
  414. ID2D1Factory *D2DFactory;
  415. hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof(ID2D1Factory), (void**)&D2DFactory);
  416.  
  417. D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties;
  418.  
  419. ZeroMemory(&renderTargetProperties, sizeof(renderTargetProperties));
  420.  
  421. renderTargetProperties.type = D2D1_RENDER_TARGET_TYPE_HARDWARE;
  422. renderTargetProperties.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED);
  423.  
  424. hr = D2DFactory->CreateDxgiSurfaceRenderTarget(sharedSurface10, &renderTargetProperties, &D2DRenderTarget);
  425.  
  426. sharedSurface10->Release();
  427. D2DFactory->Release();
  428.  
  429. //Create a solid color brush to draw something with
  430. hr = D2DRenderTarget->CreateSolidColorBrush(D2D1::ColorF(1.0f, 1.0f, 0.0f, 1.0f), &Brush);
  431.  
  432. //DirectWrite//////////////
  433. hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory),
  434. reinterpret_cast<IUnknown**>(&DWriteFactory));
  435.  
  436. hr = DWriteFactory->CreateTextFormat(
  437. L"Script",
  438. NULL,
  439. DWRITE_FONT_WEIGHT_REGULAR,
  440. DWRITE_FONT_STYLE_NORMAL,
  441. DWRITE_FONT_STRETCH_NORMAL,
  442. 24.0f,
  443. L"en-us",
  444. &TextFormat
  445. );
  446.  
  447. hr = TextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);
  448. hr = TextFormat->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR);
  449.  
  450. d3d101Device->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_POINTLIST);
  451. return true;
  452. }
  453.  
  454. void CleanUp()
  455. {
  456. //Release the COM Objects we created
  457. SwapChain->Release();
  458. d3d11Device->Release();
  459. d3d11DevCon->Release();
  460. renderTargetView->Release();
  461. squareVertBuffer->Release();
  462. squareIndexBuffer->Release();
  463. VS->Release();
  464. PS->Release();
  465. VS_Buffer->Release();
  466. PS_Buffer->Release();
  467. vertLayout->Release();
  468. depthStencilBuffer->Release();
  469. depthStencilView->Release();
  470. cbPerObjectBuffer->Release();
  471. Transparency->Release();
  472. CCWcullMode->Release();
  473. CWcullMode->Release();
  474.  
  475. d3d101Device->Release();
  476. keyedMutex11->Release();
  477. keyedMutex10->Release();
  478. D2DRenderTarget->Release();
  479. Brush->Release();
  480. if(BackBuffer11)BackBuffer11->Release();
  481. sharedTex11->Release();
  482. DWriteFactory->Release();
  483. TextFormat->Release();
  484. d2dTexture->Release();
  485.  
  486.  
  487. cbPerFrameBuffer->Release();
  488.  
  489. }
  490.  
  491. void InitD2DScreenTexture()
  492. {
  493. //Create the vertex buffer
  494. Vertex v[]=
  495. {
  496. // Front Face
  497. Vertex(-1.0f, -1.0f, -1.0f, 0.0f, 1.0f,-1.0f, -1.0f, -1.0f),
  498. Vertex(-1.0f, 1.0f, -1.0f, 0.0f, 0.0f,-1.0f, 1.0f, -1.0f),
  499. Vertex( 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, -1.0f),
  500. Vertex( 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f),
  501. };
  502.  
  503. DWORD indices[] = {
  504. // Front Face
  505. 0, 1, 2,
  506. 0, 2, 3,
  507. };
  508.  
  509. D3D11_BUFFER_DESC indexBufferDesc;
  510. ZeroMemory( &indexBufferDesc, sizeof(indexBufferDesc) );
  511.  
  512. indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
  513. indexBufferDesc.ByteWidth = sizeof(DWORD) * 2 *3;
  514. indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
  515. indexBufferDesc.CPUAccessFlags = 0;
  516. indexBufferDesc.MiscFlags = 0;
  517.  
  518. D3D11_SUBRESOURCE_DATA iinitData;
  519.  
  520. iinitData.pSysMem = indices;
  521. d3d11Device->CreateBuffer(&indexBufferDesc, &iinitData, &d2dIndexBuffer);
  522.  
  523. D3D11_BUFFER_DESC vertexBufferDesc;
  524. ZeroMemory( &vertexBufferDesc, sizeof(vertexBufferDesc));
  525.  
  526. vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
  527. vertexBufferDesc.ByteWidth = sizeof( Vertex ) * 4;
  528. vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
  529. vertexBufferDesc.CPUAccessFlags = 0;
  530. vertexBufferDesc.MiscFlags = 0;
  531.  
  532. D3D11_SUBRESOURCE_DATA vertexBufferData;
  533.  
  534. ZeroMemory( &vertexBufferData, sizeof(vertexBufferData));
  535. vertexBufferData.pSysMem = v;
  536. hr = d3d11Device->CreateBuffer( &vertexBufferDesc, &vertexBufferData, &d2dVertBuffer);
  537.  
  538. //Create a shader resource view from teh texture d2d will render to,
  539. //So we can use it to texture a square which overlays our scene
  540. d3d11Device->CreateShaderResourceView(sharedTex11, NULL, &d2dTexture);
  541. }
  542.  
  543. bool InitScene()
  544. {
  545. InitD2DScreenTexture();
  546.  
  547. //Compile Shaders from shader file
  548. hr = D3DX11CompileFromFile(L"Effects.fx", 0, 0, "VS", "vs_4_0", 0, 0, 0, &VS_Buffer, 0, 0);
  549. hr = D3DX11CompileFromFile(L"Effects.fx", 0, 0, "PS", "ps_4_0", 0, 0, 0, &PS_Buffer, 0, 0);
  550.  
  551. hr = D3DX11CompileFromFile(L"Effects.fx", 0, 0, "D2D_PS", "ps_4_0", 0, 0, 0, &D2D_PS_Buffer, 0, 0);
  552.  
  553.  
  554. //Create the Shader Objects
  555. hr = d3d11Device->CreateVertexShader(VS_Buffer->GetBufferPointer(), VS_Buffer->GetBufferSize(), NULL, &VS);
  556. hr = d3d11Device->CreatePixelShader(PS_Buffer->GetBufferPointer(), PS_Buffer->GetBufferSize(), NULL, &PS);
  557.  
  558. hr = d3d11Device->CreatePixelShader(D2D_PS_Buffer->GetBufferPointer(), D2D_PS_Buffer->GetBufferSize(), NULL, &D2D_PS);
  559.  
  560.  
  561. //Set Vertex and Pixel Shaders
  562. d3d11DevCon->VSSetShader(VS, 0, 0);
  563. d3d11DevCon->PSSetShader(PS, 0, 0);
  564.  
  565. ///////////////**************new**************////////////////////
  566. light.pos = XMFLOAT3(0.0f, 0.0f, 0.0f);
  567. light.range = 100.0f;
  568. light.att = XMFLOAT3(0.0f, 0.2f, 0.0f);
  569. light.ambient = XMFLOAT4(0.3f, 0.3f, 0.3f, 1.0f);
  570. light.diffuse = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f);
  571.  
  572.  
  573. //Changed the buffer
  574. Vertex v[] =
  575. {
  576. // Front Face
  577. Vertex(-1.0f, -1.0f, -1.0f, 0.0f, 1.0f,-1.0f, -1.0f, -1.0f),
  578. Vertex(-1.0f, 1.0f, -1.0f, 0.0f, 0.0f,-1.0f, 1.0f, -1.0f),
  579. Vertex( 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, -1.0f),
  580. Vertex( 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f),
  581.  
  582. // Back Face
  583. Vertex(-1.0f, -1.0f, 1.0f, 1.0f, 1.0f,-1.0f, -1.0f, 1.0f),
  584. Vertex( 1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f),
  585. Vertex( 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f),
  586. Vertex(-1.0f, 1.0f, 1.0f, 1.0f, 0.0f,-1.0f, 1.0f, 1.0f),
  587.  
  588. // Top Face
  589. Vertex(-1.0f, 1.0f, -1.0f, 0.0f, 1.0f,-1.0f, 1.0f, -1.0f),
  590. Vertex(-1.0f, 1.0f, 1.0f, 0.0f, 0.0f,-1.0f, 1.0f, 1.0f),
  591. Vertex( 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f),
  592. Vertex( 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f),
  593.  
  594. // Bottom Face
  595. Vertex(-1.0f, -1.0f, -1.0f, 1.0f, 1.0f,-1.0f, -1.0f, -1.0f),
  596. Vertex( 1.0f, -1.0f, -1.0f, 0.0f, 1.0f, 1.0f, -1.0f, -1.0f),
  597. Vertex( 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f),
  598. Vertex(-1.0f, -1.0f, 1.0f, 1.0f, 0.0f,-1.0f, -1.0f, 1.0f),
  599.  
  600. // Left Face
  601. Vertex(-1.0f, -1.0f, 1.0f, 0.0f, 1.0f,-1.0f, -1.0f, 1.0f),
  602. Vertex(-1.0f, 1.0f, 1.0f, 0.0f, 0.0f,-1.0f, 1.0f, 1.0f),
  603. Vertex(-1.0f, 1.0f, -1.0f, 1.0f, 0.0f,-1.0f, 1.0f, -1.0f),
  604. Vertex(-1.0f, -1.0f, -1.0f, 1.0f, 1.0f,-1.0f, -1.0f, -1.0f),
  605.  
  606. // Right Face
  607. Vertex( 1.0f, -1.0f, -1.0f, 0.0f, 1.0f, 1.0f, -1.0f, -1.0f),
  608. Vertex( 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, -1.0f),
  609. Vertex( 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f),
  610. Vertex( 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f),
  611. };
  612.  
  613.  
  614. // This is where we create the index buffer
  615. DWORD indices[] = {
  616. // Front Face
  617. 0, 1, 2,
  618. 0, 2, 3,
  619.  
  620. // Back Face
  621. 4, 5, 6,
  622. 4, 6, 7,
  623.  
  624. // Top Face
  625. 8, 9, 10,
  626. 8, 10, 11,
  627.  
  628. // Bottom Face
  629. 12, 13, 14,
  630. 12, 14, 15,
  631.  
  632. // Left Face
  633. 16, 17, 18,
  634. 16, 18, 19,
  635.  
  636. // Right Face
  637. 20, 21, 22,
  638. 20, 22, 23
  639. };
  640.  
  641. D3D11_BUFFER_DESC indexBufferDesc;
  642. ZeroMemory( &indexBufferDesc, sizeof(indexBufferDesc) );
  643.  
  644. indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
  645. indexBufferDesc.ByteWidth = sizeof(DWORD) * 12 * 3;
  646. indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
  647. indexBufferDesc.CPUAccessFlags = 0;
  648. indexBufferDesc.MiscFlags = 0;
  649.  
  650. //End index buffer
  651. //Put the index array into a d3d11_subresource
  652. D3D11_SUBRESOURCE_DATA iinitData;
  653.  
  654. iinitData.pSysMem = indices;
  655. d3d11Device->CreateBuffer(&indexBufferDesc, &iinitData, &squareIndexBuffer);
  656.  
  657. D3D11_BUFFER_DESC vertexBufferDesc;
  658. ZeroMemory( &vertexBufferDesc, sizeof(vertexBufferDesc) );
  659.  
  660. vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
  661. vertexBufferDesc.ByteWidth = sizeof( Vertex ) * 24; // Updated to 24 vertex
  662. vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
  663. vertexBufferDesc.CPUAccessFlags = 0;
  664. vertexBufferDesc.MiscFlags = 0;
  665.  
  666. D3D11_SUBRESOURCE_DATA vertexBufferData;
  667.  
  668. ZeroMemory( &vertexBufferData, sizeof(vertexBufferData) );
  669. vertexBufferData.pSysMem = v;
  670. hr = d3d11Device->CreateBuffer( &vertexBufferDesc, &vertexBufferData, &squareVertBuffer);
  671.  
  672. //Create the Input Layout
  673. d3d11Device->CreateInputLayout( layout, numElements, VS_Buffer->GetBufferPointer(),
  674. VS_Buffer->GetBufferSize(), &vertLayout );
  675.  
  676. //Set the Input Layout
  677. d3d11DevCon->IASetInputLayout( vertLayout );
  678.  
  679. //Set Primitive Topology
  680. d3d11DevCon->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
  681.  
  682. //Create the Viewport
  683. D3D11_VIEWPORT viewport;
  684. ZeroMemory(&viewport, sizeof(D3D11_VIEWPORT));
  685.  
  686. viewport.TopLeftX = 0;
  687. viewport.TopLeftY = 0;
  688. viewport.Width = Width;
  689. viewport.Height = Height;
  690. viewport.MinDepth = 0.0f;
  691. viewport.MaxDepth = 1.0f;
  692.  
  693. //Set the Viewport
  694. d3d11DevCon->RSSetViewports(1, &viewport);
  695.  
  696. //Create the buffer to send to teh cbuffer in effect file
  697. D3D11_BUFFER_DESC cbbd;
  698. ZeroMemory(&cbbd, sizeof(D3D11_BUFFER_DESC));
  699.  
  700. cbbd.Usage = D3D11_USAGE_DEFAULT;
  701. cbbd.ByteWidth = sizeof(cbPerObject);
  702. cbbd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
  703. cbbd.CPUAccessFlags = 0;
  704. cbbd.MiscFlags = 0;
  705.  
  706. hr = d3d11Device->CreateBuffer(&cbbd, NULL, &cbPerObjectBuffer);
  707.  
  708.  
  709. //Create the buffer to send to the cbuffer per frame in effect file
  710. ZeroMemory(&cbbd, sizeof(D3D11_BUFFER_DESC));
  711.  
  712. cbbd.Usage = D3D11_USAGE_DEFAULT;
  713. cbbd.ByteWidth = sizeof(cbPerFrame);
  714. cbbd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
  715. cbbd.CPUAccessFlags = 0;
  716. cbbd.MiscFlags = 0;
  717.  
  718. hr = d3d11Device->CreateBuffer(&cbbd, NULL, &cbPerFrameBuffer);
  719.  
  720.  
  721. //Camera information
  722. camPosition = XMVectorSet( 0.0f, 3.0f, -8.0f, 0.0f );
  723. camTarget = XMVectorSet( 0.0f, 0.0f, 0.0f, 0.0f );
  724. camUp = XMVectorSet( 0.0f, 1.0f, 0.0f, 0.0f );
  725.  
  726. //Set the view matrix
  727. camView = XMMatrixLookAtLH( camPosition, camTarget, camUp );
  728.  
  729. //Set the projection matrix
  730. camProjection = XMMatrixPerspectiveFovLH( 0.4f*3.14f, (float)Width/Height, 1.0f, 1000.0f);
  731.  
  732. //Define the Blending Equation
  733. D3D11_BLEND_DESC blendDesc;
  734. ZeroMemory( &blendDesc, sizeof(blendDesc));
  735.  
  736. D3D11_RENDER_TARGET_BLEND_DESC rtbd;
  737. ZeroMemory( &rtbd, sizeof(rtbd) );
  738.  
  739. rtbd.BlendEnable = true;
  740. rtbd.SrcBlend = D3D11_BLEND_SRC_COLOR;
  741. rtbd.DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
  742. rtbd.BlendOp = D3D11_BLEND_OP_ADD;
  743. rtbd.SrcBlendAlpha = D3D11_BLEND_ONE;
  744. rtbd.DestBlendAlpha = D3D11_BLEND_ZERO;
  745. rtbd.BlendOpAlpha = D3D11_BLEND_OP_ADD;
  746. rtbd.RenderTargetWriteMask = D3D10_COLOR_WRITE_ENABLE_ALL;
  747.  
  748. blendDesc.AlphaToCoverageEnable = false;
  749. blendDesc.RenderTarget[0] = rtbd;
  750.  
  751. hr = D3DX11CreateShaderResourceViewFromFile( d3d11Device, L"linda.jpg",
  752. NULL, NULL, &CubesTexture, NULL);
  753.  
  754. //Describe the Sample State
  755. D3D11_SAMPLER_DESC sampDesc;
  756. ZeroMemory( &sampDesc, sizeof(sampDesc) );
  757. sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
  758. sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
  759. sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
  760. sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
  761. sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
  762. sampDesc.MinLOD = 0;
  763. sampDesc.MaxLOD = D3D11_FLOAT32_MAX;
  764.  
  765. //Create the sample state
  766. hr = d3d11Device->CreateSamplerState( &sampDesc, &CubesTexSamplerState );
  767.  
  768. d3d11Device->CreateBlendState(&blendDesc, &Transparency);
  769.  
  770. //Create the Counter Clockwise and Clockwise Culling States
  771. D3D11_RASTERIZER_DESC cmdesc;
  772.  
  773. ZeroMemory(&cmdesc, sizeof(D3D11_RASTERIZER_DESC));
  774. cmdesc.FillMode = D3D11_FILL_SOLID;
  775. cmdesc.CullMode = D3D11_CULL_BACK;
  776. cmdesc.FrontCounterClockwise = true;
  777. hr = d3d11Device->CreateRasterizerState(&cmdesc, &CCWcullMode);
  778.  
  779. cmdesc.FrontCounterClockwise = false;
  780. hr = d3d11Device->CreateRasterizerState(&cmdesc, &CWcullMode);
  781. return true;
  782. }
  783.  
  784.  
  785. void StartTimer()
  786. {
  787. LARGE_INTEGER frequencyCount;
  788. QueryPerformanceFrequency(&frequencyCount);
  789.  
  790. countsPerSecond = double(frequencyCount.QuadPart);
  791.  
  792. QueryPerformanceCounter(&frequencyCount);
  793. CounterStart = frequencyCount.QuadPart;
  794. }
  795.  
  796. double GetTime()
  797. {
  798. LARGE_INTEGER currentTime;
  799. QueryPerformanceCounter(&currentTime);
  800. return double(currentTime.QuadPart-CounterStart)/countsPerSecond;
  801. }
  802.  
  803. double GetFrameTime()
  804. {
  805. LARGE_INTEGER currentTime;
  806. __int64 tickCount;
  807. QueryPerformanceCounter(&currentTime);
  808.  
  809. tickCount = currentTime.QuadPart-frameTimeOld;
  810. frameTimeOld = currentTime.QuadPart;
  811.  
  812. if(tickCount < 0.0f)
  813. tickCount = 0.0f;
  814.  
  815. return float(tickCount)/countsPerSecond;
  816. }
  817.  
  818.  
  819.  
  820. void UpdateScene(double time)
  821. {
  822. //Keep the cubes rotating
  823. rot += 1.0f * time;
  824. if(rot > 6.26f)
  825. rot = 0.0f;
  826.  
  827. //Reset cube1World
  828. cube1World = XMMatrixIdentity();
  829.  
  830. //Define cube1's world space matrix
  831. XMVECTOR rotaxis = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);
  832. Rotation = XMMatrixRotationAxis( rotaxis, rot);
  833. Translation = XMMatrixTranslation( 0.0f, 0.0f, 4.0f );
  834.  
  835. // Set cube1's world space using the transformations
  836. cube1World = Translation * Rotation;
  837.  
  838. ///////////////**************new**************////////////////////
  839. //Reset Lights Position
  840. XMVECTOR lightVector = XMVectorSet( 0.0f, 0.0f, 0.0f, 0.0f );
  841.  
  842. lightVector = XMVector3TransformCoord(lightVector, cube1World);
  843.  
  844. light.pos.x = XMVectorGetX(lightVector);
  845. light.pos.y = XMVectorGetY(lightVector);
  846. light.pos.z = XMVectorGetZ(lightVector);
  847. ///////////////**************new**************////////////////////
  848.  
  849.  
  850. //Define cube2's world space matrix
  851. Rotation = XMMatrixRotationAxis( rotaxis, -rot);
  852. Scale = XMMatrixScaling( 1.3f, 1.3f, 1.3f );
  853.  
  854. //Set cube2's world space matrix
  855. cube2World = Rotation * Scale;
  856.  
  857.  
  858.  
  859.  
  860. }
  861.  
  862.  
  863.  
  864. void RenderText(std::wstring text, int inInt)
  865. {
  866. //Release the D3D 11 Device
  867. keyedMutex11->ReleaseSync(0);
  868.  
  869. //Use d3d10.1 Device
  870. keyedMutex10->AcquireSync(0, 5);
  871.  
  872. //Draw D2D content
  873. D2DRenderTarget->BeginDraw();
  874.  
  875. //Clear D2D background
  876. D2DRenderTarget->Clear(D2D1::ColorF(0.0f, 0.0f, 0.0f, 0.0f));
  877.  
  878. //Create our string
  879. std::wostringstream printString;
  880.  
  881. printString << text << inInt;
  882.  
  883. printText = printString.str();
  884.  
  885. //Set the Font Color
  886. D2D1_COLOR_F FontColor = D2D1::ColorF(1.0f, 1.0f, 1.0f, 1.0f);
  887.  
  888. //Set the brush color D2D will use to draw with
  889. Brush->SetColor(FontColor);
  890.  
  891. //Create the D2D Render Area
  892. D2D1_RECT_F layoutRect = D2D1::RectF(0, 0, Width, Height);
  893.  
  894. //Draw the text
  895. D2DRenderTarget->DrawText(
  896. printText.c_str(),
  897. wcslen(printText.c_str()),
  898. TextFormat,
  899. layoutRect,
  900. Brush
  901. );
  902.  
  903. D2DRenderTarget->EndDraw();
  904.  
  905. //Release the D3d10.1 Device
  906. keyedMutex10->ReleaseSync(1);
  907.  
  908. //Use hte d3d11 Device
  909. keyedMutex11->AcquireSync(1,5);
  910.  
  911. //Use the shader resource representing the direct2d render target
  912. //to texture a square which is rendered in screen space so it
  913. //overlays on top of our entire scene. We use alpha blending so
  914. //that the entire background of the D2D render target is "invisible",
  915. //And only the stuff we draw with D2D will be visible (the text)
  916.  
  917. //Set the blend state for D2D render target texture objects
  918. d3d11DevCon->OMSetBlendState(Transparency, NULL, 0xffffffff);
  919.  
  920. //Set the d2d Index buffer
  921. d3d11DevCon->IASetIndexBuffer( d2dIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
  922. //Set the d2d vertex buffer
  923. UINT stride = sizeof( Vertex );
  924. UINT offset = 0;
  925. d3d11DevCon->IASetVertexBuffers(0, 1, &d2dVertBuffer, &stride, &offset );
  926.  
  927. WVP = XMMatrixIdentity();
  928.  
  929. cbPerObj.World = XMMatrixTranspose(WVP);
  930. cbPerObj.WVP = XMMatrixTranspose(WVP);
  931. d3d11DevCon->UpdateSubresource( cbPerObjectBuffer, 0, NULL, &cbPerObj, 0, 0);
  932. d3d11DevCon->VSSetConstantBuffers( 0, 1, &cbPerObjectBuffer );
  933. d3d11DevCon->PSSetShaderResources( 0, 1, &d2dTexture );
  934. d3d11DevCon->PSSetSamplers( 0, 1, &CubesTexSamplerState );
  935.  
  936. d3d11DevCon->RSSetState(CWcullMode);
  937. //Draw the second cube
  938. d3d11DevCon->DrawIndexed( 6, 0, 0 );
  939. }
  940.  
  941.  
  942. void DrawScene()
  943. {
  944. //Clear our render target and depth/stencil view
  945. float bgColor[4] = {(0.0f, 0.0f, 0.0f, 0.0f)};
  946. d3d11DevCon->ClearRenderTargetView(renderTargetView, bgColor);
  947. d3d11DevCon->ClearDepthStencilView(depthStencilView, D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, 1.0f,0);
  948.  
  949.  
  950. constbuffPerFrame.light = light;
  951. d3d11DevCon->UpdateSubresource( cbPerFrameBuffer, 0, NULL, &constbuffPerFrame, 0, 0);
  952. d3d11DevCon->PSSetConstantBuffers(0, 1, &cbPerFrameBuffer);
  953.  
  954. //Reset Vertex and Pixel Shaders
  955. d3d11DevCon->VSSetShader(VS, 0, 0);
  956. d3d11DevCon->PSSetShader(PS, 0, 0);
  957.  
  958.  
  959. //Set our Render Target
  960. d3d11DevCon->OMSetRenderTargets(1, &renderTargetView, depthStencilView);
  961.  
  962.  
  963. //Set the default blend state (no blending) for opaque objects
  964. d3d11DevCon->OMSetBlendState(0, 0, 0xffffffff);
  965.  
  966. //Set the cubes index buffer
  967. d3d11DevCon->IASetIndexBuffer( squareIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
  968. //Set the cubes vertex buffer
  969. UINT stride = sizeof( Vertex );
  970. UINT offset = 0;
  971. d3d11DevCon->IASetVertexBuffers( 0 ,1, &squareVertBuffer, &stride, &offset );
  972.  
  973.  
  974. //Set the WVP matrix and send it to the constant buffer in effect file
  975. WVP = cube1World* camView * camProjection;
  976. cbPerObj.World = XMMatrixTranspose(cube1World);
  977. cbPerObj.WVP = XMMatrixTranspose(WVP);
  978. d3d11DevCon->UpdateSubresource( cbPerObjectBuffer, 0, NULL, &cbPerObj, 0 , 0);
  979. d3d11DevCon->VSSetConstantBuffers( 0, 1, &cbPerObjectBuffer );
  980. d3d11DevCon->PSSetShaderResources(0, 1, &CubesTexture );
  981. d3d11DevCon->PSSetSamplers(0, 1, &CubesTexSamplerState );
  982.  
  983. d3d11DevCon->RSSetState(CWcullMode);
  984. d3d11DevCon->DrawIndexed( 36, 0, 0 );
  985.  
  986. //2nd cube
  987. WVP = cube2World * camView * camProjection;
  988. cbPerObj.World = XMMatrixTranspose(cube2World);
  989. cbPerObj.WVP = XMMatrixTranspose(WVP);
  990. d3d11DevCon->UpdateSubresource( cbPerObjectBuffer, 0, NULL, &cbPerObj, 0, 0 );
  991. d3d11DevCon->VSSetConstantBuffers(0, 1, &cbPerObjectBuffer );
  992. d3d11DevCon->PSSetShaderResources(0, 1, &CubesTexture );
  993. d3d11DevCon->PSSetSamplers(0, 1, &CubesTexSamplerState );
  994.  
  995. d3d11DevCon->RSSetState(CWcullMode);
  996. d3d11DevCon->DrawIndexed( 36, 0 ,0 );
  997.  
  998.  
  999. RenderText(L"FPS: ", fps);
  1000.  
  1001.  
  1002. //Present the backbuffer to the screen
  1003. SwapChain->Present(0, 0);
  1004. }
  1005.  
  1006. int messageloop(){
  1007. MSG msg;
  1008. ZeroMemory(&msg, sizeof(MSG));
  1009. while(true)
  1010. {
  1011. BOOL PeekMessageL(
  1012. LPMSG lpMsg,
  1013. HWND hWnd,
  1014. UINT wMsgFilterMin,
  1015. UINT wMsgFilterMax,
  1016. UINT wRemoveMsg
  1017. );
  1018.  
  1019. if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
  1020. {
  1021. if (msg.message == WM_QUIT)
  1022. break;
  1023. TranslateMessage(&msg);
  1024. DispatchMessage(&msg);
  1025. }
  1026. else{
  1027. // run game code
  1028.  
  1029. frameCount++;
  1030. if(GetTime() > 1.0f)
  1031. {
  1032. fps = frameCount;
  1033. frameCount = 0;
  1034. StartTimer();
  1035. }
  1036.  
  1037. frameTime = GetFrameTime();
  1038.  
  1039. UpdateScene(frameTime);
  1040.  
  1041. DrawScene();
  1042. }
  1043. }
  1044. return msg.wParam;
  1045. }
  1046.  
  1047. LRESULT CALLBACK WndProc(HWND hwnd,
  1048. UINT msg,
  1049. WPARAM wParam,
  1050. LPARAM lParam)
  1051. {
  1052. switch( msg )
  1053. {
  1054. case WM_KEYDOWN:
  1055. if( wParam == VK_ESCAPE ){
  1056. DestroyWindow(hwnd);
  1057. }
  1058. return 0;
  1059.  
  1060. case WM_DESTROY:
  1061. PostQuitMessage(0);
  1062. return 0;
  1063. }
  1064. return DefWindowProc(hwnd,
  1065. msg,
  1066. wParam,
  1067. lParam);
  1068. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement