From b887259974cf1b6587e86f7c9ca7086119303520 Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Mon, 27 Jan 2020 14:11:29 +0300 Subject: [PATCH] Bindings: Improved FreeGLUT support for MinGW (#3004) --- examples/example_glut_opengl2/Makefile | 8 +++++++- examples/example_glut_opengl2/main.cpp | 4 ++-- examples/imgui_impl_glut.cpp | 5 +++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/examples/example_glut_opengl2/Makefile b/examples/example_glut_opengl2/Makefile index c381c0c9..70576b8f 100644 --- a/examples/example_glut_opengl2/Makefile +++ b/examples/example_glut_opengl2/Makefile @@ -41,7 +41,13 @@ endif ifeq ($(findstring MINGW,$(UNAME_S)),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) endif diff --git a/examples/example_glut_opengl2/main.cpp b/examples/example_glut_opengl2/main.cpp index 03db3fce..d36c1f84 100644 --- a/examples/example_glut_opengl2/main.cpp +++ b/examples/example_glut_opengl2/main.cpp @@ -6,8 +6,8 @@ // !!! Nowadays, prefer using GLFW or SDL instead! #include "imgui.h" -#include "../imgui_impl_glut.h" -#include "../imgui_impl_opengl2.h" +#include "imgui_impl_glut.h" +#include "imgui_impl_opengl2.h" #ifdef __APPLE__ #include #else diff --git a/examples/imgui_impl_glut.cpp b/examples/imgui_impl_glut.cpp index fe519d9c..3c17bbfc 100644 --- a/examples/imgui_impl_glut.cpp +++ b/examples/imgui_impl_glut.cpp @@ -39,7 +39,12 @@ static int g_Time = 0; // Current time, in milliseconds bool ImGui_ImplGLUT_Init() { ImGuiIO& io = ImGui::GetIO(); + +#ifdef FREEGLUT + io.BackendPlatformName ="imgui_impl_glut (freeglut)"; +#else io.BackendPlatformName ="imgui_impl_glut"; +#endif g_Time = 0;