2
0
Эх сурвалжийг харах

Bindings: Improved FreeGLUT support for MinGW (#3004)

Konstantin Podsvirov 5 жил өмнө
parent
commit
b887259974

+ 7 - 1
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
 

+ 2 - 2
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 <GLUT/glut.h>
 #else

+ 5 - 0
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;