Guest User

DX11 Overlay Main

a guest
Apr 26th, 2014
591
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.62 KB | None | 0 0
  1. #include "Includes.h"
  2. HINSTANCE module;
  3.  
  4. void D3DApp::DrawScene()
  5. {
  6.     if (m_Minimized)
  7.         return;
  8.  
  9.     if (m_targetApplication != GetForegroundWindow())
  10.         return;
  11.  
  12.     assert(m_pImmediateDeviceContext);
  13.     assert(m_pSwapChain);
  14.  
  15.     float clearColor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
  16.     float blend[4] = { 0 };
  17.  
  18.     m_pImmediateDeviceContext->ClearRenderTargetView(m_pRenderTargetView, reinterpret_cast<const float*>(&clearColor));
  19.    
  20.     DrawString(XMFLOAT2(0,20), Colors::White,0.8f, false,"%s", "Test"); //draw text in upper left
  21.    
  22.     XMVECTOR pos1 = { m_width / 2, m_height / 2 + 5 }; //draw small line in center
  23.     XMVECTOR pos2 = { m_width / 2, m_height / 2 - 5 };
  24.     DrawLine(pos1, pos2, Colors::Red);
  25.  
  26.     DrawCircle(pos1, Colors::Green, 70, 30); //draw small circle in center
  27.  
  28.     HR(m_pSwapChain->Present(0, 0));
  29. }
  30.  
  31. DWORD WINAPI DXThread(LPVOID lpargs)
  32. {
  33.     /*This thread is where the overlay runs, RunOverlay is
  34.     an infinite loop that handles the windows messages and such*/
  35.     D3DApp app("Overlay",600,600,module,"Battlefield 4",4);
  36.     app.MakeWindow();
  37.     app.InitializeDX();
  38.     app.SetToTarget();
  39.     std::cout << "Made it to DX init \n";
  40.     return app.RunOverlay();
  41. }
  42.  
  43. BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwAttached, LPVOID lpvReserved)
  44. {
  45.     if (dwAttached == DLL_PROCESS_ATTACH)
  46.     {
  47.         module = hModule;
  48.         HANDLE hThread2 = CreateThread(NULL, NULL, DXThread, NULL, NULL, NULL);
  49.         CloseHandle(hThread2);
  50.         //PresentHook = new CVMTHookManager64((DWORD64**)DxRenderer::GetInstance()->m_pScreen->m_pSwapChain);
  51.         //oPresent = (tPresent)PresentHook->dwGetMethodAddress(8);
  52.         //PresentHook->dwHookMethod((DWORD64)hkPresent, 8);
  53.     }
  54.     return 1;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment