mirror of
https://github.com/jmarshall23/CnC_Remastered_Collection.git
synced 2026-08-12 08:00:55 +02:00
Cleaned up imgui integration.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
* Main_Menu -- Menu processing *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include "imgui.h"
|
||||
#include "function.h"
|
||||
#ifdef WIN32
|
||||
#include "ccdde.h"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user