Bindings: Improved FreeGLUT support for MinGW (#3004)

This commit is contained in:
Konstantin Podsvirov 2020-01-27 14:11:29 +03:00 committed by omar
parent f6da5000bf
commit b887259974
3 changed files with 14 additions and 3 deletions

View File

@ -41,7 +41,13 @@ endif
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
ECHO_MESSAGE = "MinGW" ECHO_MESSAGE = "MinGW"
LIBS += -lgdi32 -lopengl32 -limm32 -lglut LIBS += -lgdi32 -lopengl32 -limm32
ifeq ($(shell pkg-config freeglut --exists 2> /dev/null && echo yes || echo no),yes)
CXXFLAGS += $(shell pkg-config freeglut --cflags)
LIBS += $(shell pkg-config freeglut --libs)
else
LIBS += -lglut
endif
CFLAGS = $(CXXFLAGS) CFLAGS = $(CXXFLAGS)
endif endif

View File

@ -6,8 +6,8 @@
// !!! Nowadays, prefer using GLFW or SDL instead! // !!! Nowadays, prefer using GLFW or SDL instead!
#include "imgui.h" #include "imgui.h"
#include "../imgui_impl_glut.h" #include "imgui_impl_glut.h"
#include "../imgui_impl_opengl2.h" #include "imgui_impl_opengl2.h"
#ifdef __APPLE__ #ifdef __APPLE__
#include <GLUT/glut.h> #include <GLUT/glut.h>
#else #else

View File

@ -39,7 +39,12 @@ static int g_Time = 0; // Current time, in milliseconds
bool ImGui_ImplGLUT_Init() bool ImGui_ImplGLUT_Init()
{ {
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
#ifdef FREEGLUT
io.BackendPlatformName ="imgui_impl_glut (freeglut)";
#else
io.BackendPlatformName ="imgui_impl_glut"; io.BackendPlatformName ="imgui_impl_glut";
#endif
g_Time = 0; g_Time = 0;