From ece322ff12c4bea3a44b211ef470529163fb622b Mon Sep 17 00:00:00 2001 From: Andrew Willmott Date: Wed, 3 Apr 2019 14:53:11 +0100 Subject: [PATCH] freeglut -> glut rename --- docs/README.md | 2 +- examples/.gitignore | 2 +- examples/README.txt | 8 +-- .../Makefile | 4 +- .../example_freeglut_opengl2.vcxproj | 8 +-- .../example_freeglut_opengl2.vcxproj.filters | 6 +- .../main.cpp | 18 +++--- examples/imgui_impl_freeglut.h | 33 ---------- ..._impl_freeglut.cpp => imgui_impl_glut.cpp} | 60 +++++++++---------- examples/imgui_impl_glut.h | 33 ++++++++++ 10 files changed, 87 insertions(+), 87 deletions(-) rename examples/{example_freeglut_opengl2 => example_glut_opengl2}/Makefile (92%) rename examples/{example_freeglut_opengl2 => example_glut_opengl2}/example_freeglut_opengl2.vcxproj (98%) rename examples/{example_freeglut_opengl2 => example_glut_opengl2}/example_freeglut_opengl2.vcxproj.filters (93%) rename examples/{example_freeglut_opengl2 => example_glut_opengl2}/main.cpp (92%) delete mode 100644 examples/imgui_impl_freeglut.h rename examples/{imgui_impl_freeglut.cpp => imgui_impl_glut.cpp} (78%) create mode 100644 examples/imgui_impl_glut.h diff --git a/docs/README.md b/docs/README.md index 1a70ebf3..febacf05 100644 --- a/docs/README.md +++ b/docs/README.md @@ -134,7 +134,7 @@ Languages: (third-party bindings) Frameworks: - Renderers: DirectX 9/10/11/12, Metal, OpenGL2, OpenGL3+/ES2/ES3, Vulkan: [examples/](https://github.com/ocornut/imgui/tree/master/examples) -- Platform: GLFW, SDL, Win32, OSX, Freeglut: [examples/](https://github.com/ocornut/imgui/tree/master/examples) +- Platform: GLFW, SDL, Win32, OSX, GLUT: [examples/](https://github.com/ocornut/imgui/tree/master/examples) - Framework: Allegro 5, Marmalade: [examples/](https://github.com/ocornut/imgui/tree/master/examples) - Unmerged PR: SDL2 + OpenGLES + Emscripten: [#336](https://github.com/ocornut/imgui/pull/336) - Unmerged PR: Android: [#421](https://github.com/ocornut/imgui/pull/421) diff --git a/examples/.gitignore b/examples/.gitignore index b2cde198..428ea446 100644 --- a/examples/.gitignore +++ b/examples/.gitignore @@ -33,7 +33,7 @@ example_glfw_opengl2/example_glfw_opengl2 example_glfw_opengl3/example_glfw_opengl3 example_sdl_opengl2/example_sdl_opengl2 example_sdl_opengl3/example_sdl_opengl3 -example_freeglut_opengl2/example_freeglut_opengl2 +example_glut_opengl2/example_glut_opengl2 ## Dear ImGui Ini files imgui.ini diff --git a/examples/README.txt b/examples/README.txt index 97787f47..2876f7ee 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -104,7 +104,7 @@ List of Platforms Bindings in this repository: imgui_impl_osx.mm ; macOS native API imgui_impl_sdl.cpp ; SDL2 (Windows, macOS, Linux, iOS, Android) https://www.libsdl.org imgui_impl_win32.cpp ; Win32 native API (Windows) - imgui_impl_freeglut.cpp ; FreeGLUT (if you really miss the 90's) + imgui_impl_glut.cpp ; GLUT (if you really miss the 90's) List of Renderer Bindings in this repository: @@ -223,9 +223,9 @@ example_allegro5/ Allegro 5 example. = main.cpp + imgui_impl_allegro5.cpp -example_freeglut_opengl2/ - FreeGLUT + OpenGL2. - = main.cpp + imgui_impl_freeglut.cpp + imgui_impl_opengl2.cpp +example_glut_opengl2/ + GLUT (E.g., FreeGLUT on Linux/Windows, GLUT framework on OSX) + OpenGL2. + = main.cpp + imgui_impl_glut.cpp + imgui_impl_opengl2.cpp example_marmalade/ Marmalade example using IwGx. diff --git a/examples/example_freeglut_opengl2/Makefile b/examples/example_glut_opengl2/Makefile similarity index 92% rename from examples/example_freeglut_opengl2/Makefile rename to examples/example_glut_opengl2/Makefile index 9b409ab0..25ddc43a 100644 --- a/examples/example_freeglut_opengl2/Makefile +++ b/examples/example_glut_opengl2/Makefile @@ -9,9 +9,9 @@ #CXX = g++ #CXX = clang++ -EXE = example_freeglut_opengl2 +EXE = example_glut_opengl2 SOURCES = main.cpp -SOURCES += ../imgui_impl_freeglut.cpp ../imgui_impl_opengl2.cpp +SOURCES += ../imgui_impl_glut.cpp ../imgui_impl_opengl2.cpp SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj b/examples/example_glut_opengl2/example_freeglut_opengl2.vcxproj similarity index 98% rename from examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj rename to examples/example_glut_opengl2/example_freeglut_opengl2.vcxproj index e3bd4176..58599e6d 100644 --- a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj +++ b/examples/example_glut_opengl2/example_freeglut_opengl2.vcxproj @@ -20,7 +20,7 @@ {F90D0333-5FB1-440D-918D-DD39A1B5187E} - example_freeglut_opengl2 + example_glut_opengl2 @@ -154,7 +154,7 @@ - + @@ -162,7 +162,7 @@ - + @@ -172,4 +172,4 @@ - \ No newline at end of file + diff --git a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters b/examples/example_glut_opengl2/example_freeglut_opengl2.vcxproj.filters similarity index 93% rename from examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters rename to examples/example_glut_opengl2/example_freeglut_opengl2.vcxproj.filters index eb6d8526..290d43d7 100644 --- a/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters +++ b/examples/example_glut_opengl2/example_freeglut_opengl2.vcxproj.filters @@ -22,7 +22,7 @@ imgui - + sources @@ -42,7 +42,7 @@ imgui - + sources @@ -55,4 +55,4 @@ sources - \ No newline at end of file + diff --git a/examples/example_freeglut_opengl2/main.cpp b/examples/example_glut_opengl2/main.cpp similarity index 92% rename from examples/example_freeglut_opengl2/main.cpp rename to examples/example_glut_opengl2/main.cpp index cc12e651..4a4a03ad 100644 --- a/examples/example_freeglut_opengl2/main.cpp +++ b/examples/example_glut_opengl2/main.cpp @@ -1,11 +1,11 @@ -// dear imgui: standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline +// dear imgui: standalone example application for GLUT + OpenGL2, using legacy fixed pipeline // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp. // !!! GLUT IS OBSOLETE SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!! // !!! If someone or something is teaching you GLUT in 2019, you are being abused. Please show some resistance. !!! #include "imgui.h" -#include "../imgui_impl_freeglut.h" +#include "../imgui_impl_glut.h" #include "../imgui_impl_opengl2.h" #ifdef __APPLE__ #include @@ -65,7 +65,7 @@ void glut_display_func() { // Start the Dear ImGui frame ImGui_ImplOpenGL2_NewFrame(); - ImGui_ImplFreeGLUT_NewFrame(); + ImGui_ImplGLUT_NewFrame(); my_display_code(); @@ -96,11 +96,11 @@ int main(int argc, char** argv) #endif glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE); glutInitWindowSize(1280, 720); - glutCreateWindow("Dear ImGui FreeGLUT+OpenGL2 Example"); + glutCreateWindow("Dear ImGui GLUT+OpenGL2 Example"); // Setup GLUT display function - // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us, - // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves. + // We will also call ImGui_ImplGLUT_InstallFuncs() to get all the other functions installed for us, + // otherwise it is possible to install our own functions and call the imgui_impl_glut.h functions ourselves. glutDisplayFunc(glut_display_func); // Setup Dear ImGui context @@ -113,8 +113,8 @@ int main(int argc, char** argv) //ImGui::StyleColorsClassic(); // Setup Platform/Renderer bindings - ImGui_ImplFreeGLUT_Init(); - ImGui_ImplFreeGLUT_InstallFuncs(); + ImGui_ImplGLUT_Init(); + ImGui_ImplGLUT_InstallFuncs(); ImGui_ImplOpenGL2_Init(); // Load Fonts @@ -136,7 +136,7 @@ int main(int argc, char** argv) // Cleanup ImGui_ImplOpenGL2_Shutdown(); - ImGui_ImplFreeGLUT_Shutdown(); + ImGui_ImplGLUT_Shutdown(); ImGui::DestroyContext(); return 0; diff --git a/examples/imgui_impl_freeglut.h b/examples/imgui_impl_freeglut.h deleted file mode 100644 index 6d565ec6..00000000 --- a/examples/imgui_impl_freeglut.h +++ /dev/null @@ -1,33 +0,0 @@ -// dear imgui: Platform Binding for FreeGLUT -// This needs to be used along with a Renderer (e.g. OpenGL2) - -// !!! GLUT IS OBSOLETE SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!! -// !!! If someone or something is teaching you GLUT in 2019, you are being abused. Please show some resistance. !!! - -// Issues: -// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I -// [ ] Platform: Missing clipboard support (not supported by Glut). -// [ ] Platform: Missing gamepad support. - -// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. -// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. -// https://github.com/ocornut/imgui - -#pragma once - -IMGUI_IMPL_API bool ImGui_ImplFreeGLUT_Init(); -IMGUI_IMPL_API void ImGui_ImplFreeGLUT_InstallFuncs(); -IMGUI_IMPL_API void ImGui_ImplFreeGLUT_Shutdown(); -IMGUI_IMPL_API void ImGui_ImplFreeGLUT_NewFrame(); - -// You can call ImGui_ImplFreeGLUT_InstallFuncs() to get all those functions installed automatically, -// or call them yourself from your own GLUT handlers. We are using the same weird names as GLUT for consistency.. -//---------------------------------------- GLUT name --------------------------------------------- Decent Name --------- -IMGUI_IMPL_API void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h); // ~ ResizeFunc -IMGUI_IMPL_API void ImGui_ImplFreeGLUT_MotionFunc(int x, int y); // ~ MouseMoveFunc -IMGUI_IMPL_API void ImGui_ImplFreeGLUT_MouseFunc(int button, int state, int x, int y); // ~ MouseButtonFunc -IMGUI_IMPL_API void ImGui_ImplFreeGLUT_MouseWheelFunc(int button, int dir, int x, int y); // ~ MouseWheelFunc -IMGUI_IMPL_API void ImGui_ImplFreeGLUT_KeyboardFunc(unsigned char c, int x, int y); // ~ CharPressedFunc -IMGUI_IMPL_API void ImGui_ImplFreeGLUT_KeyboardUpFunc(unsigned char c, int x, int y); // ~ CharReleasedFunc -IMGUI_IMPL_API void ImGui_ImplFreeGLUT_SpecialFunc(int key, int x, int y); // ~ KeyPressedFunc -IMGUI_IMPL_API void ImGui_ImplFreeGLUT_SpecialUpFunc(int key, int x, int y); // ~ KeyReleasedFunc diff --git a/examples/imgui_impl_freeglut.cpp b/examples/imgui_impl_glut.cpp similarity index 78% rename from examples/imgui_impl_freeglut.cpp rename to examples/imgui_impl_glut.cpp index 7054c378..60333caf 100644 --- a/examples/imgui_impl_freeglut.cpp +++ b/examples/imgui_impl_glut.cpp @@ -1,4 +1,4 @@ -// dear imgui: Platform Binding for FreeGLUT +// dear imgui: Platform Binding for GLUT // This needs to be used along with a Renderer (e.g. OpenGL2) // !!! GLUT IS OBSOLETE SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!! @@ -17,10 +17,10 @@ // (minor and older changes stripped away, please see git history for details) // 2019-03-25: Misc: Made io.DeltaTime always above zero. // 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window. -// 2018-03-22: Added FreeGLUT Platform binding. +// 2018-03-22: Added GLUT Platform binding. #include "imgui.h" -#include "imgui_impl_freeglut.h" +#include "imgui_impl_glut.h" #ifdef __APPLE__ #include #else @@ -33,10 +33,10 @@ static int g_Time = 0; // Current time, in milliseconds -bool ImGui_ImplFreeGLUT_Init() +bool ImGui_ImplGLUT_Init() { ImGuiIO& io = ImGui::GetIO(); - io.BackendPlatformName ="imgui_impl_freeglut"; + io.BackendPlatformName ="imgui_impl_glut"; g_Time = 0; @@ -66,26 +66,26 @@ bool ImGui_ImplFreeGLUT_Init() return true; } -void ImGui_ImplFreeGLUT_InstallFuncs() +void ImGui_ImplGLUT_InstallFuncs() { - glutReshapeFunc(ImGui_ImplFreeGLUT_ReshapeFunc); - glutMotionFunc(ImGui_ImplFreeGLUT_MotionFunc); - glutPassiveMotionFunc(ImGui_ImplFreeGLUT_MotionFunc); - glutMouseFunc(ImGui_ImplFreeGLUT_MouseFunc); + glutReshapeFunc(ImGui_ImplGLUT_ReshapeFunc); + glutMotionFunc(ImGui_ImplGLUT_MotionFunc); + glutPassiveMotionFunc(ImGui_ImplGLUT_MotionFunc); + glutMouseFunc(ImGui_ImplGLUT_MouseFunc); #ifdef __FREEGLUT_EXT_H__ - glutMouseWheelFunc(ImGui_ImplFreeGLUT_MouseWheelFunc); + glutMouseWheelFunc(ImGui_ImplGLUT_MouseWheelFunc); #endif - glutKeyboardFunc(ImGui_ImplFreeGLUT_KeyboardFunc); - glutKeyboardUpFunc(ImGui_ImplFreeGLUT_KeyboardUpFunc); - glutSpecialFunc(ImGui_ImplFreeGLUT_SpecialFunc); - glutSpecialUpFunc(ImGui_ImplFreeGLUT_SpecialUpFunc); + glutKeyboardFunc(ImGui_ImplGLUT_KeyboardFunc); + glutKeyboardUpFunc(ImGui_ImplGLUT_KeyboardUpFunc); + glutSpecialFunc(ImGui_ImplGLUT_SpecialFunc); + glutSpecialUpFunc(ImGui_ImplGLUT_SpecialUpFunc); } -void ImGui_ImplFreeGLUT_Shutdown() +void ImGui_ImplGLUT_Shutdown() { } -void ImGui_ImplFreeGLUT_NewFrame() +void ImGui_ImplGLUT_NewFrame() { // Setup time step ImGuiIO& io = ImGui::GetIO(); @@ -100,7 +100,7 @@ void ImGui_ImplFreeGLUT_NewFrame() ImGui::NewFrame(); } -static void ImGui_ImplFreeGLUT_UpdateKeyboardMods() +static void ImGui_ImplGLUT_UpdateKeyboardMods() { ImGuiIO& io = ImGui::GetIO(); int mods = glutGetModifiers(); @@ -109,7 +109,7 @@ static void ImGui_ImplFreeGLUT_UpdateKeyboardMods() io.KeyAlt = (mods & GLUT_ACTIVE_ALT) != 0; } -void ImGui_ImplFreeGLUT_KeyboardFunc(unsigned char c, int x, int y) +void ImGui_ImplGLUT_KeyboardFunc(unsigned char c, int x, int y) { // Send character to imgui //printf("char_down_func %d '%c'\n", c, c); @@ -127,11 +127,11 @@ void ImGui_ImplFreeGLUT_KeyboardFunc(unsigned char c, int x, int y) io.KeysDown[c] = io.KeysDown[c - 'A' + 'a'] = true; else io.KeysDown[c] = true; - ImGui_ImplFreeGLUT_UpdateKeyboardMods(); + ImGui_ImplGLUT_UpdateKeyboardMods(); (void)x; (void)y; // Unused } -void ImGui_ImplFreeGLUT_KeyboardUpFunc(unsigned char c, int x, int y) +void ImGui_ImplGLUT_KeyboardUpFunc(unsigned char c, int x, int y) { //printf("char_up_func %d '%c'\n", c, c); ImGuiIO& io = ImGui::GetIO(); @@ -143,31 +143,31 @@ void ImGui_ImplFreeGLUT_KeyboardUpFunc(unsigned char c, int x, int y) io.KeysDown[c] = io.KeysDown[c - 'A' + 'a'] = false; else io.KeysDown[c] = false; - ImGui_ImplFreeGLUT_UpdateKeyboardMods(); + ImGui_ImplGLUT_UpdateKeyboardMods(); (void)x; (void)y; // Unused } -void ImGui_ImplFreeGLUT_SpecialFunc(int key, int x, int y) +void ImGui_ImplGLUT_SpecialFunc(int key, int x, int y) { //printf("key_down_func %d\n", key); ImGuiIO& io = ImGui::GetIO(); if (key + 256 < IM_ARRAYSIZE(io.KeysDown)) io.KeysDown[key + 256] = true; - ImGui_ImplFreeGLUT_UpdateKeyboardMods(); + ImGui_ImplGLUT_UpdateKeyboardMods(); (void)x; (void)y; // Unused } -void ImGui_ImplFreeGLUT_SpecialUpFunc(int key, int x, int y) +void ImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y) { //printf("key_up_func %d\n", key); ImGuiIO& io = ImGui::GetIO(); if (key + 256 < IM_ARRAYSIZE(io.KeysDown)) io.KeysDown[key + 256] = false; - ImGui_ImplFreeGLUT_UpdateKeyboardMods(); + ImGui_ImplGLUT_UpdateKeyboardMods(); (void)x; (void)y; // Unused } -void ImGui_ImplFreeGLUT_MouseFunc(int glut_button, int state, int x, int y) +void ImGui_ImplGLUT_MouseFunc(int glut_button, int state, int x, int y) { ImGuiIO& io = ImGui::GetIO(); io.MousePos = ImVec2((float)x, (float)y); @@ -182,7 +182,7 @@ void ImGui_ImplFreeGLUT_MouseFunc(int glut_button, int state, int x, int y) } #ifdef __FREEGLUT_EXT_H__ -void ImGui_ImplFreeGLUT_MouseWheelFunc(int button, int dir, int x, int y) +void ImGui_ImplGLUT_MouseWheelFunc(int button, int dir, int x, int y) { ImGuiIO& io = ImGui::GetIO(); io.MousePos = ImVec2((float)x, (float)y); @@ -194,13 +194,13 @@ void ImGui_ImplFreeGLUT_MouseWheelFunc(int button, int dir, int x, int y) } #endif -void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h) +void ImGui_ImplGLUT_ReshapeFunc(int w, int h) { ImGuiIO& io = ImGui::GetIO(); io.DisplaySize = ImVec2((float)w, (float)h); } -void ImGui_ImplFreeGLUT_MotionFunc(int x, int y) +void ImGui_ImplGLUT_MotionFunc(int x, int y) { ImGuiIO& io = ImGui::GetIO(); io.MousePos = ImVec2((float)x, (float)y); diff --git a/examples/imgui_impl_glut.h b/examples/imgui_impl_glut.h new file mode 100644 index 00000000..59fe0d51 --- /dev/null +++ b/examples/imgui_impl_glut.h @@ -0,0 +1,33 @@ +// dear imgui: Platform Binding for GLUT +// This needs to be used along with a Renderer (e.g. OpenGL2) + +// !!! GLUT IS OBSOLETE SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!! +// !!! If someone or something is teaching you GLUT in 2019, you are being abused. Please show some resistance. !!! + +// Issues: +// [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I +// [ ] Platform: Missing clipboard support (not supported by Glut). +// [ ] Platform: Missing gamepad support. + +// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. +// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. +// https://github.com/ocornut/imgui + +#pragma once + +IMGUI_IMPL_API bool ImGui_ImplGLUT_Init(); +IMGUI_IMPL_API void ImGui_ImplGLUT_InstallFuncs(); +IMGUI_IMPL_API void ImGui_ImplGLUT_Shutdown(); +IMGUI_IMPL_API void ImGui_ImplGLUT_NewFrame(); + +// You can call ImGui_ImplGLUT_InstallFuncs() to get all those functions installed automatically, +// or call them yourself from your own GLUT handlers. We are using the same weird names as GLUT for consistency.. +//---------------------------------------- GLUT name --------------------------------------------- Decent Name --------- +IMGUI_IMPL_API void ImGui_ImplGLUT_ReshapeFunc(int w, int h); // ~ ResizeFunc +IMGUI_IMPL_API void ImGui_ImplGLUT_MotionFunc(int x, int y); // ~ MouseMoveFunc +IMGUI_IMPL_API void ImGui_ImplGLUT_MouseFunc(int button, int state, int x, int y); // ~ MouseButtonFunc +IMGUI_IMPL_API void ImGui_ImplGLUT_MouseWheelFunc(int button, int dir, int x, int y); // ~ MouseWheelFunc +IMGUI_IMPL_API void ImGui_ImplGLUT_KeyboardFunc(unsigned char c, int x, int y); // ~ CharPressedFunc +IMGUI_IMPL_API void ImGui_ImplGLUT_KeyboardUpFunc(unsigned char c, int x, int y); // ~ CharReleasedFunc +IMGUI_IMPL_API void ImGui_ImplGLUT_SpecialFunc(int key, int x, int y); // ~ KeyPressedFunc +IMGUI_IMPL_API void ImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y); // ~ KeyReleasedFunc