| 40 | } |
| 41 | |
| 42 | void GUI::Render() |
| 43 | { |
| 44 | ImGui_ImplDX11_NewFrame(); |
| 45 | //ImGui_ImplUwp_NewFrame(); //technically we use a HWND swap chain so this isn't needed? (breaks Forza Motorsport 5 and doesn't seems to make a difference) |
| 46 | |
| 47 | ID3D11Texture2D* pBackBuffer = nullptr; |
| 48 | m_pSwapchain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer)); |
| 49 | if (pBackBuffer) |
| 50 | { |
| 51 | D3D11_TEXTURE2D_DESC desc; |
| 52 | pBackBuffer->GetDesc(&desc); |
| 53 | ImGui::GetIO().DisplaySize = ImVec2((float)desc.Width, (float)desc.Height); |
| 54 | pBackBuffer->Release(); |
| 55 | } |
| 56 | |
| 57 | ImGui::NewFrame(); |
| 58 | |
| 59 | if (xbnotif_show) { |
| 60 | xbnotif_timer -= ImGui::GetIO().DeltaTime; |
| 61 | if (xbnotif_timer <= 0.0f) |
| 62 | { |
| 63 | xbnotif_timer = false; |
| 64 | } else /* IDK, but is this how the code should be structured?? */ |
| 65 | { |
| 66 | float alpha = xbnotif_timer < 1.0f ? xbnotif_timer : 1.0f; |
| 67 | ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha); |
| 68 | XBNotif(); |
| 69 | ImGui::PopStyleVar(); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | ImGui::Render(); |
| 74 | m_pContext->OMSetRenderTargets(1, &m_pRenderTargetView, nullptr); |
| 75 | ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData()); |
| 76 | } |
| 77 | |
| 78 | void GUI::XBNotif(const char* notif_text, const char* icon, const char* bottom_tip) |
| 79 | { |