diff --git a/code/REDALERT/MENUS.CPP b/code/REDALERT/MENUS.CPP index 2c7b0ec..524d4e7 100644 --- a/code/REDALERT/MENUS.CPP +++ b/code/REDALERT/MENUS.CPP @@ -33,6 +33,7 @@ * Main_Menu -- Menu processing * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#include "imgui.h" #include "function.h" #ifdef WIN32 #include "ccdde.h" diff --git a/code/REDALERT/STARTUP.CPP b/code/REDALERT/STARTUP.CPP index d9135e0..ed3f40c 100644 --- a/code/REDALERT/STARTUP.CPP +++ b/code/REDALERT/STARTUP.CPP @@ -549,24 +549,6 @@ int PASCAL WinMain ( HINSTANCE instance , HINSTANCE , char * command_line , int video_success = TRUE; } -// jmarshall - IMGUI_CHECKVERSION(); - ImGui::CreateContext(); - ImGuiIO& io = ImGui::GetIO(); (void)io; - //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls - //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls - - // Setup Dear ImGui style - ImGui::StyleColorsDark(); - //ImGui::StyleColorsClassic(); - - // Setup Platform/Renderer bindings - ImGui_ImplSDL2_InitForD3D(game_window); - ImGui_ImplOpenGL3_Init(); - - io.Fonts->AddFontFromFileTTF("fonts/Roboto-Medium.ttf", 16.0f); -// jmarshall end - if (!video_success) { MessageBox(MainWindow, TEXT_VIDEO_ERROR, TEXT_SHORT_TITLE, MB_ICONEXCLAMATION|MB_OK); if (WindowsTimer) delete WindowsTimer; diff --git a/code/REDALERT/WINSTUB.CPP b/code/REDALERT/WINSTUB.CPP index 432066d..6a99efb 100644 --- a/code/REDALERT/WINSTUB.CPP +++ b/code/REDALERT/WINSTUB.CPP @@ -106,7 +106,7 @@ void Set_DD_Palette(void* palette, bool raShift) } } -void Device_Present(void) { +void ImGui_NewFrame(void) { ImGuiIO& io = ImGui::GetIO(); glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT); @@ -116,6 +116,10 @@ void Device_Present(void) { ImGui::NewFrame(); ImGui_ImplSDL2_NewFrame(game_window); +} + +void Device_Present(void) { + // Rasterize the palette. for (int i = 0; i < ScreenWidth * ScreenHeight; i++) { @@ -155,6 +159,8 @@ void Device_Present(void) { // Last thing we do is execute any console commands Console_Tick(); + + ImGui_NewFrame(); } @@ -538,6 +544,24 @@ void Create_Main_Window ( HANDLE instance , int command_show , int width , int h glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glewInit(); + + IMGUI_CHECKVERSION(); + ImGui::CreateContext(); + ImGuiIO& io = ImGui::GetIO(); (void)io; + //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls + //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls + + // Setup Dear ImGui style + ImGui::StyleColorsDark(); + //ImGui::StyleColorsClassic(); + + // Setup Platform/Renderer bindings + ImGui_ImplSDL2_InitForD3D(game_window); + ImGui_ImplOpenGL3_Init(); + + io.Fonts->AddFontFromFileTTF("fonts/Roboto-Medium.ttf", 16.0f); + + ImGui_NewFrame(); }