apparently gui is fixed?

This commit is contained in:
Gray
2024-09-14 10:07:50 -04:00
parent c106b35d18
commit 9dbd6ae2f0
10 changed files with 99 additions and 6 deletions

View File

@@ -6,7 +6,7 @@
#include <Windows.h>
#include <dxgi.h>
#include <d3d11.h>
// #include <d3d11.h>
#include <d3d9.h>
#include <ImGui/imgui.h>
@@ -45,6 +45,7 @@
#include "vendingmachine.h"
#include "die.h"
#include "calendar.h"
#include "KismetRenderingLibrary.h"
#define GAME_TAB 1
#define PLAYERS_TAB 2
@@ -1493,7 +1494,7 @@ static inline DWORD WINAPI GuiThread(LPVOID)
// Initialize Direct3D
if (!CreateDeviceD3D(hwnd))
{
MessageBoxA(0, "Failed to create D3D Device!", "Reboot 3.0", MB_ICONERROR);
// MessageBoxA(0, "Failed to create D3D Device!", "Reboot 3.0", MB_ICONERROR); // Error Boxes are within the helper function.
LOG_ERROR(LogDev, "Failed to create D3D Device!");
CleanupDeviceD3D();
::UnregisterClass(wc.lpszClassName, wc.hInstance);
@@ -1612,8 +1613,12 @@ static inline DWORD WINAPI GuiThread(LPVOID)
static inline bool CreateDeviceD3D(HWND hWnd)
{
if ((g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL)
g_pD3D = Direct3DCreate9(D3D_SDK_VERSION);
if (g_pD3D == NULL)
{
MessageBoxA(0, "Failed call to Direct3DCreate9!", "Reboot 3.0", MB_ICONERROR);
return false;
}
// Create the D3DDevice
ZeroMemory(&g_d3dpp, sizeof(g_d3dpp));
@@ -1624,8 +1629,14 @@ static inline bool CreateDeviceD3D(HWND hWnd)
g_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; // Present with vsync
//g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Present without vsync, maximum unthrottled framerate
if (g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice) < 0)
auto CreateDeviceResult = g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice);
if (CreateDeviceResult < D3D_OK)
{
MessageBoxA(0, ("Failed call to CreateDevice " + std::to_string(CreateDeviceResult) + "!").c_str(), "Reboot 3.0", MB_ICONERROR);
return false;
}
return true;
}