packages feed

dear-imgui-impl-glut (empty) → 1.0.0

raw patch · 11 files changed

+818/−0 lines, 11 filesdep +basedep +dear-imgui-raw

Dependencies added: base, dear-imgui-raw

Files

+ CHANGELOG.md view
@@ -0,0 +1,13 @@+# Changelog for `dear-imgui-impl-glut`++All notable changes to this package will be documented in this file.++The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),+and this project adheres to the+[Haskell Package Versioning Policy](https://pvp.haskell.org/).++## 1.0.0 - 2026-10-21++Initial release.++- Generated with dear_bindings `v0.26` from Dear ImGui `v1.93.0-docking`.
+ LICENSE view
@@ -0,0 +1,26 @@+Copyright 2026 IC Rainbow++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++1.  Redistributions of source code must retain the above copyright notice, this+    list of conditions and the following disclaimer.++2.  Redistributions in binary form must reproduce the above copyright notice,+    this list of conditions and the following disclaimer in the documentation+    and/or other materials provided with the distribution.++3.  Neither the name of the copyright holder nor the names of its contributors+    may be used to endorse or promote products derived from this software+    without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,6 @@+# dear-imgui-impl-glut++Platform backend for [Dear ImGui] on GLUT and FreeGLUT windows.+Pair it with a renderer backend.++[Dear ImGui]: https://github.com/ocornut/imgui
+ cbits/DearImGuiWrappers.cpp view
@@ -0,0 +1,3 @@+// Generated by dear-bindings-ffi. Do not edit.+#include "DearImGuiWrappers.h"+
+ cbits/DearImGuiWrappers.h view
@@ -0,0 +1,16 @@+// Generated by dear-bindings-ffi. Do not edit.+#ifndef DEAR_IMGUI_WRAPPERS_H+#define DEAR_IMGUI_WRAPPERS_H++#include "dcimgui_impl_glut.h"++#ifdef __cplusplus+extern "C" {+#endif+++#ifdef __cplusplus+}+#endif++#endif
+ cbits/dcimgui_impl_glut.cpp view
@@ -0,0 +1,158 @@+// THIS FILE HAS BEEN AUTO-GENERATED BY THE 'DEAR BINDINGS' GENERATOR.+// **DO NOT EDIT DIRECTLY**+// https://github.com/dearimgui/dear_bindings++#include "imgui.h"+#include "imgui_impl_glut.h"++#include <stdio.h>++// Wrap this in a namespace to keep it separate from the C++ API+// This define prevents #defines in the header getting defined again (as they are already in the normal header above),+// and thus generating redefinition warnings+#define DEAR_BINDINGS_INTERNAL_GLUE_CODE+namespace cimgui+{+#include "dcimgui_impl_glut.h"+}+#undef DEAR_BINDINGS_INTERNAL_GLUE_CODE++// By-value struct conversions++static inline cimgui::ImVec2 ConvertFromCPP_ImVec2(const ::ImVec2& src)+{+    cimgui::ImVec2 dest;+    dest.x = src.x;+    dest.y = src.y;+    return dest;+}++static inline ::ImVec2 ConvertToCPP_ImVec2(const cimgui::ImVec2& src)+{+    ::ImVec2 dest;+    dest.x = src.x;+    dest.y = src.y;+    return dest;+}++static inline cimgui::ImVec4 ConvertFromCPP_ImVec4(const ::ImVec4& src)+{+    cimgui::ImVec4 dest;+    dest.x = src.x;+    dest.y = src.y;+    dest.z = src.z;+    dest.w = src.w;+    return dest;+}++static inline ::ImVec4 ConvertToCPP_ImVec4(const cimgui::ImVec4& src)+{+    ::ImVec4 dest;+    dest.x = src.x;+    dest.y = src.y;+    dest.z = src.z;+    dest.w = src.w;+    return dest;+}++static inline cimgui::ImTextureRef ConvertFromCPP_ImTextureRef(const ::ImTextureRef& src)+{+    cimgui::ImTextureRef dest;+    dest._TexData = reinterpret_cast<cimgui::ImTextureData*>(src._TexData);+    dest._TexID = src._TexID;+    return dest;+}++static inline ::ImTextureRef ConvertToCPP_ImTextureRef(const cimgui::ImTextureRef& src)+{+    ::ImTextureRef dest;+    dest._TexData = reinterpret_cast<::ImTextureData*>(src._TexData);+    dest._TexID = src._TexID;+    return dest;+}++static inline cimgui::ImColor ConvertFromCPP_ImColor(const ::ImColor& src)+{+    cimgui::ImColor dest;+    dest.Value.x = src.Value.x;+    dest.Value.y = src.Value.y;+    dest.Value.z = src.Value.z;+    dest.Value.w = src.Value.w;+    return dest;+}++static inline ::ImColor ConvertToCPP_ImColor(const cimgui::ImColor& src)+{+    ::ImColor dest;+    dest.Value.x = src.Value.x;+    dest.Value.y = src.Value.y;+    dest.Value.z = src.Value.z;+    dest.Value.w = src.Value.w;+    return dest;+}++// Function stubs++#ifndef IMGUI_DISABLE++CIMGUI_IMPL_API bool cimgui::cImGui_ImplGLUT_Init(void)+{+    return ::ImGui_ImplGLUT_Init();+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplGLUT_InstallFuncs(void)+{+    ::ImGui_ImplGLUT_InstallFuncs();+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplGLUT_Shutdown(void)+{+    ::ImGui_ImplGLUT_Shutdown();+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplGLUT_NewFrame(void)+{+    ::ImGui_ImplGLUT_NewFrame();+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplGLUT_ReshapeFunc(int w, int h)+{+    ::ImGui_ImplGLUT_ReshapeFunc(w, h);+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplGLUT_MotionFunc(int x, int y)+{+    ::ImGui_ImplGLUT_MotionFunc(x, y);+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplGLUT_MouseFunc(int button, int state, int x, int y)+{+    ::ImGui_ImplGLUT_MouseFunc(button, state, x, y);+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplGLUT_MouseWheelFunc(int button, int dir, int x, int y)+{+    ::ImGui_ImplGLUT_MouseWheelFunc(button, dir, x, y);+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplGLUT_KeyboardFunc(unsigned char c, int x, int y)+{+    ::ImGui_ImplGLUT_KeyboardFunc(c, x, y);+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplGLUT_KeyboardUpFunc(unsigned char c, int x, int y)+{+    ::ImGui_ImplGLUT_KeyboardUpFunc(c, x, y);+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplGLUT_SpecialFunc(int key, int x, int y)+{+    ::ImGui_ImplGLUT_SpecialFunc(key, x, y);+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y)+{+    ::ImGui_ImplGLUT_SpecialUpFunc(key, x, y);+}++#endif // #ifndef IMGUI_DISABLE
+ cbits/dcimgui_impl_glut.h view
@@ -0,0 +1,75 @@+// THIS FILE HAS BEEN AUTO-GENERATED BY THE 'DEAR BINDINGS' GENERATOR.+// **DO NOT EDIT DIRECTLY**+// https://github.com/dearimgui/dear_bindings++// Dear Bindings version as a string+#ifndef DEAR_BINDINGS_VERSION+#define DEAR_BINDINGS_VERSION "0.26"+#endif++// Dear Bindings version as an integer+#ifndef DEAR_BINDINGS_VERSION_NUMBER+#define DEAR_BINDINGS_VERSION_NUMBER 26+#endif++// dear imgui: Platform Backend for GLUT/FreeGLUT+// ImDrawIdx: vertex index. [Compile-time configurable type]+// - To use 16-bit indices + allow large meshes: backend need to set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset (recommended).+// - To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in your imconfig.h file.+#ifndef ImDrawIdx+typedef unsigned short ImDrawIdx;  // Default: 16-bit (for maximum compatibility with renderer backends)+#endif // #ifndef ImDrawIdx+// This needs to be used along with a Renderer (e.g. OpenGL2)++// !!! GLUT/FreeGLUT IS OBSOLETE PREHISTORIC SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!!+// !!! If someone or something is teaching you GLUT today, you are being abused. Please show some resistance. !!!+// !!! Nowadays, prefer using GLFW or SDL instead!++// Implemented features:+//  [X] Platform: Partial keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLUT values are obsolete since 1.87 and not supported since 1.91.5]+// Missing features or Issues:+//  [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I+//  [ ] Platform: Missing horizontal mouse wheel support.+//  [ ] Platform: Missing mouse cursor shape/visibility support.+//  [ ] Platform: Missing clipboard support (not supported by Glut).+//  [ ] Platform: Missing gamepad support.+//  [ ] Platform: Missing multi-viewport support (multiple windows).++// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.+// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.+// Learn about Dear ImGui:+// - FAQ                  https://dearimgui.com/faq+// - Getting Started      https://dearimgui.com/getting-started+// - Documentation        https://dearimgui.com/docs (same as your local docs/ folder).+// - Introduction, links and more at the top of imgui.cpp++#pragma once++#ifdef __cplusplus+extern "C"+{+#endif+#ifndef IMGUI_DISABLE+#include "dcimgui.h"+typedef struct ImDrawData_t ImDrawData;+// Follow "Getting Started" link and check examples/ folder to learn about using backends!+CIMGUI_IMPL_API bool cImGui_ImplGLUT_Init(void);+CIMGUI_IMPL_API void cImGui_ImplGLUT_InstallFuncs(void);+CIMGUI_IMPL_API void cImGui_ImplGLUT_Shutdown(void);+CIMGUI_IMPL_API void cImGui_ImplGLUT_NewFrame(void);++// 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 ---------+CIMGUI_IMPL_API void cImGui_ImplGLUT_ReshapeFunc(int w, int h);                     // ~ ResizeFunc+CIMGUI_IMPL_API void cImGui_ImplGLUT_MotionFunc(int x, int y);                      // ~ MouseMoveFunc+CIMGUI_IMPL_API void cImGui_ImplGLUT_MouseFunc(int button, int state, int x, int y); // ~ MouseButtonFunc+CIMGUI_IMPL_API void cImGui_ImplGLUT_MouseWheelFunc(int button, int dir, int x, int y); // ~ MouseWheelFunc+CIMGUI_IMPL_API void cImGui_ImplGLUT_KeyboardFunc(unsigned char c, int x, int y);   // ~ CharPressedFunc+CIMGUI_IMPL_API void cImGui_ImplGLUT_KeyboardUpFunc(unsigned char c, int x, int y); // ~ CharReleasedFunc+CIMGUI_IMPL_API void cImGui_ImplGLUT_SpecialFunc(int key, int x, int y);            // ~ KeyPressedFunc+CIMGUI_IMPL_API void cImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y);          // ~ KeyReleasedFunc+#endif// #ifndef IMGUI_DISABLE+#ifdef __cplusplus+} // End of extern "C" block+#endif
+ cbits/imgui_impl_glut.cpp view
@@ -0,0 +1,310 @@+// dear imgui: Platform Backend for GLUT/FreeGLUT+// This needs to be used along with a Renderer (e.g. OpenGL2)++// !!! GLUT/FreeGLUT IS OBSOLETE PREHISTORIC SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!!+// !!! If someone or something is teaching you GLUT today, you are being abused. Please show some resistance. !!!+// !!! Nowadays, prefer using GLFW or SDL instead!++// Implemented features:+//  [X] Platform: Partial keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLUT values are obsolete since 1.87 and not supported since 1.91.5]+// Missing features or Issues:+//  [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I+//  [ ] Platform: Missing horizontal mouse wheel support.+//  [ ] Platform: Missing mouse cursor shape/visibility support.+//  [ ] Platform: Missing clipboard support (not supported by Glut).+//  [ ] Platform: Missing gamepad support.+//  [ ] Platform: Missing multi-viewport support (multiple windows).++// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.+// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.+// Learn about Dear ImGui:+// - FAQ                  https://dearimgui.com/faq+// - Getting Started      https://dearimgui.com/getting-started+// - Documentation        https://dearimgui.com/docs (same as your local docs/ folder).+// - Introduction, links and more at the top of imgui.cpp++// CHANGELOG+// (minor and older changes stripped away, please see git history for details)+//  2023-04-17: BREAKING: Removed call to ImGui::NewFrame() from ImGui_ImplGLUT_NewFrame(). Needs to be called from the main application loop, like with every other backends.+//  2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).+//  2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.+//  2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).+//  2022-01-10: Inputs: calling new io.AddKeyEvent(), io.AddKeyModsEvent() + io.SetKeyEventNativeData() API (1.87+). Support for full ImGuiKey range.+//  2019-04-03: Misc: Renamed imgui_impl_freeglut.cpp/.h to imgui_impl_glut.cpp/.h.+//  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 GLUT Platform binding.++#include "imgui.h"+#ifndef IMGUI_DISABLE+#include "imgui_impl_glut.h"+#define GL_SILENCE_DEPRECATION+#ifdef __APPLE__+#include <GLUT/glut.h>+#else+#include <GL/freeglut.h>+#endif++#ifdef _MSC_VER+#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff)+#endif++static int g_Time = 0;          // Current time, in milliseconds++// Glut has one function for characters and one for "special keys". We map the characters in the 0..255 range and the keys above.+static ImGuiKey ImGui_ImplGLUT_KeyToImGuiKey(int key)+{+    switch (key)+    {+        case '\t':                      return ImGuiKey_Tab;+        case 256 + GLUT_KEY_LEFT:       return ImGuiKey_LeftArrow;+        case 256 + GLUT_KEY_RIGHT:      return ImGuiKey_RightArrow;+        case 256 + GLUT_KEY_UP:         return ImGuiKey_UpArrow;+        case 256 + GLUT_KEY_DOWN:       return ImGuiKey_DownArrow;+        case 256 + GLUT_KEY_PAGE_UP:    return ImGuiKey_PageUp;+        case 256 + GLUT_KEY_PAGE_DOWN:  return ImGuiKey_PageDown;+        case 256 + GLUT_KEY_HOME:       return ImGuiKey_Home;+        case 256 + GLUT_KEY_END:        return ImGuiKey_End;+        case 256 + GLUT_KEY_INSERT:     return ImGuiKey_Insert;+        case 127:                       return ImGuiKey_Delete;+        case 8:                         return ImGuiKey_Backspace;+        case ' ':                       return ImGuiKey_Space;+        case 13:                        return ImGuiKey_Enter;+        case 27:                        return ImGuiKey_Escape;+        case 39:                        return ImGuiKey_Apostrophe;+        case 44:                        return ImGuiKey_Comma;+        case 45:                        return ImGuiKey_Minus;+        case 46:                        return ImGuiKey_Period;+        case 47:                        return ImGuiKey_Slash;+        case 59:                        return ImGuiKey_Semicolon;+        case 61:                        return ImGuiKey_Equal;+        case 91:                        return ImGuiKey_LeftBracket;+        case 92:                        return ImGuiKey_Backslash;+        case 93:                        return ImGuiKey_RightBracket;+        case 96:                        return ImGuiKey_GraveAccent;+        //case 0:                         return ImGuiKey_CapsLock;+        //case 0:                         return ImGuiKey_ScrollLock;+        case 256 + 0x006D:              return ImGuiKey_NumLock;+        //case 0:                         return ImGuiKey_PrintScreen;+        //case 0:                         return ImGuiKey_Pause;+        //case '0':                       return ImGuiKey_Keypad0;+        //case '1':                       return ImGuiKey_Keypad1;+        //case '2':                       return ImGuiKey_Keypad2;+        //case '3':                       return ImGuiKey_Keypad3;+        //case '4':                       return ImGuiKey_Keypad4;+        //case '5':                       return ImGuiKey_Keypad5;+        //case '6':                       return ImGuiKey_Keypad6;+        //case '7':                       return ImGuiKey_Keypad7;+        //case '8':                       return ImGuiKey_Keypad8;+        //case '9':                       return ImGuiKey_Keypad9;+        //case 46:                        return ImGuiKey_KeypadDecimal;+        //case 47:                        return ImGuiKey_KeypadDivide;+        case 42:                        return ImGuiKey_KeypadMultiply;+        //case 45:                        return ImGuiKey_KeypadSubtract;+        case 43:                        return ImGuiKey_KeypadAdd;+        //case 13:                        return ImGuiKey_KeypadEnter;+        //case 0:                         return ImGuiKey_KeypadEqual;+        case 256 + 0x0072:              return ImGuiKey_LeftCtrl;+        case 256 + 0x0070:              return ImGuiKey_LeftShift;+        case 256 + 0x0074:              return ImGuiKey_LeftAlt;+        //case 0:                         return ImGuiKey_LeftSuper;+        case 256 + 0x0073:              return ImGuiKey_RightCtrl;+        case 256 + 0x0071:              return ImGuiKey_RightShift;+        case 256 + 0x0075:              return ImGuiKey_RightAlt;+        //case 0:                         return ImGuiKey_RightSuper;+        //case 0:                         return ImGuiKey_Menu;+        case '0':                       return ImGuiKey_0;+        case '1':                       return ImGuiKey_1;+        case '2':                       return ImGuiKey_2;+        case '3':                       return ImGuiKey_3;+        case '4':                       return ImGuiKey_4;+        case '5':                       return ImGuiKey_5;+        case '6':                       return ImGuiKey_6;+        case '7':                       return ImGuiKey_7;+        case '8':                       return ImGuiKey_8;+        case '9':                       return ImGuiKey_9;+        case 'A': case 'a':             return ImGuiKey_A;+        case 'B': case 'b':             return ImGuiKey_B;+        case 'C': case 'c':             return ImGuiKey_C;+        case 'D': case 'd':             return ImGuiKey_D;+        case 'E': case 'e':             return ImGuiKey_E;+        case 'F': case 'f':             return ImGuiKey_F;+        case 'G': case 'g':             return ImGuiKey_G;+        case 'H': case 'h':             return ImGuiKey_H;+        case 'I': case 'i':             return ImGuiKey_I;+        case 'J': case 'j':             return ImGuiKey_J;+        case 'K': case 'k':             return ImGuiKey_K;+        case 'L': case 'l':             return ImGuiKey_L;+        case 'M': case 'm':             return ImGuiKey_M;+        case 'N': case 'n':             return ImGuiKey_N;+        case 'O': case 'o':             return ImGuiKey_O;+        case 'P': case 'p':             return ImGuiKey_P;+        case 'Q': case 'q':             return ImGuiKey_Q;+        case 'R': case 'r':             return ImGuiKey_R;+        case 'S': case 's':             return ImGuiKey_S;+        case 'T': case 't':             return ImGuiKey_T;+        case 'U': case 'u':             return ImGuiKey_U;+        case 'V': case 'v':             return ImGuiKey_V;+        case 'W': case 'w':             return ImGuiKey_W;+        case 'X': case 'x':             return ImGuiKey_X;+        case 'Y': case 'y':             return ImGuiKey_Y;+        case 'Z': case 'z':             return ImGuiKey_Z;+        case 256 + GLUT_KEY_F1:         return ImGuiKey_F1;+        case 256 + GLUT_KEY_F2:         return ImGuiKey_F2;+        case 256 + GLUT_KEY_F3:         return ImGuiKey_F3;+        case 256 + GLUT_KEY_F4:         return ImGuiKey_F4;+        case 256 + GLUT_KEY_F5:         return ImGuiKey_F5;+        case 256 + GLUT_KEY_F6:         return ImGuiKey_F6;+        case 256 + GLUT_KEY_F7:         return ImGuiKey_F7;+        case 256 + GLUT_KEY_F8:         return ImGuiKey_F8;+        case 256 + GLUT_KEY_F9:         return ImGuiKey_F9;+        case 256 + GLUT_KEY_F10:        return ImGuiKey_F10;+        case 256 + GLUT_KEY_F11:        return ImGuiKey_F11;+        case 256 + GLUT_KEY_F12:        return ImGuiKey_F12;+        default:                        return ImGuiKey_None;+    }+}++bool ImGui_ImplGLUT_Init()+{+    ImGuiIO& io = ImGui::GetIO();+    IMGUI_CHECKVERSION();++#ifdef FREEGLUT+    io.BackendPlatformName = "imgui_impl_glut (freeglut)";+#else+    io.BackendPlatformName = "imgui_impl_glut";+#endif+    g_Time = 0;++    return true;+}++void ImGui_ImplGLUT_InstallFuncs()+{+    glutReshapeFunc(ImGui_ImplGLUT_ReshapeFunc);+    glutMotionFunc(ImGui_ImplGLUT_MotionFunc);+    glutPassiveMotionFunc(ImGui_ImplGLUT_MotionFunc);+    glutMouseFunc(ImGui_ImplGLUT_MouseFunc);+#ifdef __FREEGLUT_EXT_H__+    glutMouseWheelFunc(ImGui_ImplGLUT_MouseWheelFunc);+#endif+    glutKeyboardFunc(ImGui_ImplGLUT_KeyboardFunc);+    glutKeyboardUpFunc(ImGui_ImplGLUT_KeyboardUpFunc);+    glutSpecialFunc(ImGui_ImplGLUT_SpecialFunc);+    glutSpecialUpFunc(ImGui_ImplGLUT_SpecialUpFunc);+}++void ImGui_ImplGLUT_Shutdown()+{+    ImGuiIO& io = ImGui::GetIO();+    io.BackendPlatformName = nullptr;+}++void ImGui_ImplGLUT_NewFrame()+{+    // Setup time step+    ImGuiIO& io = ImGui::GetIO();+    int current_time = glutGet(GLUT_ELAPSED_TIME);+    int delta_time_ms = (current_time - g_Time);+    if (delta_time_ms <= 0)+        delta_time_ms = 1;+    io.DeltaTime = delta_time_ms / 1000.0f;+    g_Time = current_time;+}++static void ImGui_ImplGLUT_UpdateKeyModifiers()+{+    ImGuiIO& io = ImGui::GetIO();+    int glut_key_mods = glutGetModifiers();+    io.AddKeyEvent(ImGuiMod_Ctrl, (glut_key_mods & GLUT_ACTIVE_CTRL) != 0);+    io.AddKeyEvent(ImGuiMod_Shift, (glut_key_mods & GLUT_ACTIVE_SHIFT) != 0);+    io.AddKeyEvent(ImGuiMod_Alt, (glut_key_mods & GLUT_ACTIVE_ALT) != 0);+}++static void ImGui_ImplGLUT_AddKeyEvent(ImGuiKey key, bool down, int native_keycode)+{+    ImGuiIO& io = ImGui::GetIO();+    io.AddKeyEvent(key, down);+    io.SetKeyEventNativeData(key, native_keycode, -1); // To support legacy indexing (<1.87 user code)+}++void ImGui_ImplGLUT_KeyboardFunc(unsigned char c, int x, int y)+{+    // Send character to imgui+    //printf("char_down_func %d '%c'\n", c, c);+    ImGuiIO& io = ImGui::GetIO();+    if (c >= 32)+        io.AddInputCharacter((unsigned int)c);++    ImGuiKey key = ImGui_ImplGLUT_KeyToImGuiKey(c);+    ImGui_ImplGLUT_AddKeyEvent(key, true, c);+    ImGui_ImplGLUT_UpdateKeyModifiers();+    (void)x; (void)y; // Unused+}++void ImGui_ImplGLUT_KeyboardUpFunc(unsigned char c, int x, int y)+{+    //printf("char_up_func %d '%c'\n", c, c);+    ImGuiKey key = ImGui_ImplGLUT_KeyToImGuiKey(c);+    ImGui_ImplGLUT_AddKeyEvent(key, false, c);+    ImGui_ImplGLUT_UpdateKeyModifiers();+    (void)x; (void)y; // Unused+}++void ImGui_ImplGLUT_SpecialFunc(int key, int x, int y)+{+    //printf("key_down_func %d\n", key);+    ImGuiKey imgui_key = ImGui_ImplGLUT_KeyToImGuiKey(key + 256);+    ImGui_ImplGLUT_AddKeyEvent(imgui_key, true, key + 256);+    ImGui_ImplGLUT_UpdateKeyModifiers();+    (void)x; (void)y; // Unused+}++void ImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y)+{+    //printf("key_up_func %d\n", key);+    ImGuiKey imgui_key = ImGui_ImplGLUT_KeyToImGuiKey(key + 256);+    ImGui_ImplGLUT_AddKeyEvent(imgui_key, false, key + 256);+    ImGui_ImplGLUT_UpdateKeyModifiers();+    (void)x; (void)y; // Unused+}++void ImGui_ImplGLUT_MouseFunc(int glut_button, int state, int x, int y)+{+    ImGuiIO& io = ImGui::GetIO();+    io.AddMousePosEvent((float)x, (float)y);+    int button = -1;+    if (glut_button == GLUT_LEFT_BUTTON) button = 0;+    if (glut_button == GLUT_RIGHT_BUTTON) button = 1;+    if (glut_button == GLUT_MIDDLE_BUTTON) button = 2;+    if (button != -1 && (state == GLUT_DOWN || state == GLUT_UP))+        io.AddMouseButtonEvent(button, state == GLUT_DOWN);+}++#ifdef __FREEGLUT_EXT_H__+void ImGui_ImplGLUT_MouseWheelFunc(int button, int dir, int x, int y)+{+    ImGuiIO& io = ImGui::GetIO();+    io.AddMousePosEvent((float)x, (float)y);+    if (dir != 0)+        io.AddMouseWheelEvent(0.0f, dir > 0 ? 1.0f : -1.0f);+    (void)button; // Unused+}+#endif++void ImGui_ImplGLUT_ReshapeFunc(int w, int h)+{+    ImGuiIO& io = ImGui::GetIO();+    io.DisplaySize = ImVec2((float)w, (float)h);+}++void ImGui_ImplGLUT_MotionFunc(int x, int y)+{+    ImGuiIO& io = ImGui::GetIO();+    io.AddMousePosEvent((float)x, (float)y);+}++//-----------------------------------------------------------------------------++#endif // #ifndef IMGUI_DISABLE
+ cbits/imgui_impl_glut.h view
@@ -0,0 +1,48 @@+// dear imgui: Platform Backend for GLUT/FreeGLUT+// This needs to be used along with a Renderer (e.g. OpenGL2)++// !!! GLUT/FreeGLUT IS OBSOLETE PREHISTORIC SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!!+// !!! If someone or something is teaching you GLUT today, you are being abused. Please show some resistance. !!!+// !!! Nowadays, prefer using GLFW or SDL instead!++// Implemented features:+//  [X] Platform: Partial keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLUT values are obsolete since 1.87 and not supported since 1.91.5]+// Missing features or Issues:+//  [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I+//  [ ] Platform: Missing horizontal mouse wheel support.+//  [ ] Platform: Missing mouse cursor shape/visibility support.+//  [ ] Platform: Missing clipboard support (not supported by Glut).+//  [ ] Platform: Missing gamepad support.+//  [ ] Platform: Missing multi-viewport support (multiple windows).++// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.+// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.+// Learn about Dear ImGui:+// - FAQ                  https://dearimgui.com/faq+// - Getting Started      https://dearimgui.com/getting-started+// - Documentation        https://dearimgui.com/docs (same as your local docs/ folder).+// - Introduction, links and more at the top of imgui.cpp++#pragma once+#ifndef IMGUI_DISABLE+#include "imgui.h"      // IMGUI_IMPL_API++// Follow "Getting Started" link and check examples/ folder to learn about using backends!+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++#endif // #ifndef IMGUI_DISABLE
+ dear-imgui-impl-glut.cabal view
@@ -0,0 +1,57 @@+cabal-version: 2.2++-- This file has been generated from package.yaml by hpack version 0.39.6.+--+-- see: https://github.com/sol/hpack++name:           dear-imgui-impl-glut+version:        1.0.0+synopsis:       GLUT/FreeGLUT platform-backend bindings for dear-imgui-raw.+description:    Generated with dear_bindings from the imgui_impl_glut backend that ships with Dear ImGui.+category:       GUI+maintainer:     IC Rainbow <aenor.realm@gmail.com>+license:        BSD-3-Clause+license-file:   LICENSE+build-type:     Simple+extra-source-files:+    cbits/dcimgui_impl_glut.h+    cbits/DearImGuiWrappers.h+    cbits/imgui_impl_glut.h+extra-doc-files:+    README.md+    CHANGELOG.md++library+  exposed-modules:+      DearImGui.Raw.Impl.GLUT+  other-modules:+      Paths_dear_imgui_impl_glut+  autogen-modules:+      Paths_dear_imgui_impl_glut+  hs-source-dirs:+      src+  default-extensions:+      BlockArguments+      DataKinds+      DuplicateRecordFields+      LambdaCase+      NoFieldSelectors+      OverloadedRecordDot+      OverloadedStrings+      StrictData+  ghc-options: -Wall -optc-Wno-discarded-qualifiers -optc-Wno-incompatible-pointer-types+  cxx-options: -std=c++11 -fpermissive+  include-dirs:+      cbits+  cxx-sources:+      cbits/dcimgui_impl_glut.cpp+      cbits/DearImGuiWrappers.cpp+      cbits/imgui_impl_glut.cpp+  pkgconfig-depends:+      glut+  build-tool-depends:+      hsc2hs:hsc2hs+  build-depends:+      base >=4.16 && <5+    , dear-imgui-raw ==1.0.*+  default-language: GHC2021
+ src/DearImGui/Raw/Impl/GLUT.hsc view
@@ -0,0 +1,106 @@+{-# LANGUAGE CApiFFI #-}+{-# LANGUAGE PatternSynonyms #-}++-- This file was generated by dear-bindings-ffi. Do not edit by hand.++module DearImGui.Raw.Impl.GLUT+  ( init+  , installFuncs+  , keyboardFunc+  , keyboardUpFunc+  , motionFunc+  , mouseFunc+  , mouseWheelFunc+  , newFrame+  , reshapeFunc+  , shutdown+  , specialFunc+  , specialUpFunc+  ) where++import Foreign.C.Types+import Prelude hiding (init)++#include "dcimgui_impl_glut.h"++-- functions++-- C: bool ImGui_ImplGLUT_Init()+foreign import capi safe "dcimgui_impl_glut.h cImGui_ImplGLUT_Init"+  init :: IO CBool++-- C: void ImGui_ImplGLUT_InstallFuncs()+foreign import capi safe "dcimgui_impl_glut.h cImGui_ImplGLUT_InstallFuncs"+  installFuncs :: IO ()++-- C: void ImGui_ImplGLUT_KeyboardFunc(unsigned char c, int x, int y)+foreign import capi safe "dcimgui_impl_glut.h cImGui_ImplGLUT_KeyboardFunc"+  keyboardFunc+    :: CUChar -- ^ c+    -> CInt -- ^ x+    -> CInt -- ^ y+    -> IO ()++-- C: void ImGui_ImplGLUT_KeyboardUpFunc(unsigned char c, int x, int y)+foreign import capi safe "dcimgui_impl_glut.h cImGui_ImplGLUT_KeyboardUpFunc"+  keyboardUpFunc+    :: CUChar -- ^ c+    -> CInt -- ^ x+    -> CInt -- ^ y+    -> IO ()++-- C: void ImGui_ImplGLUT_MotionFunc(int x, int y)+foreign import capi safe "dcimgui_impl_glut.h cImGui_ImplGLUT_MotionFunc"+  motionFunc+    :: CInt -- ^ x+    -> CInt -- ^ y+    -> IO ()++-- C: void ImGui_ImplGLUT_MouseFunc(int button, int state, int x, int y)+foreign import capi safe "dcimgui_impl_glut.h cImGui_ImplGLUT_MouseFunc"+  mouseFunc+    :: CInt -- ^ button+    -> CInt -- ^ state+    -> CInt -- ^ x+    -> CInt -- ^ y+    -> IO ()++-- C: void ImGui_ImplGLUT_MouseWheelFunc(int button, int dir, int x, int y)+foreign import capi safe "dcimgui_impl_glut.h cImGui_ImplGLUT_MouseWheelFunc"+  mouseWheelFunc+    :: CInt -- ^ button+    -> CInt -- ^ dir+    -> CInt -- ^ x+    -> CInt -- ^ y+    -> IO ()++-- C: void ImGui_ImplGLUT_NewFrame()+foreign import capi safe "dcimgui_impl_glut.h cImGui_ImplGLUT_NewFrame"+  newFrame :: IO ()++-- C: void ImGui_ImplGLUT_ReshapeFunc(int w, int h)+foreign import capi safe "dcimgui_impl_glut.h cImGui_ImplGLUT_ReshapeFunc"+  reshapeFunc+    :: CInt -- ^ w+    -> CInt -- ^ h+    -> IO ()++-- C: void ImGui_ImplGLUT_Shutdown()+foreign import capi safe "dcimgui_impl_glut.h cImGui_ImplGLUT_Shutdown"+  shutdown :: IO ()++-- C: void ImGui_ImplGLUT_SpecialFunc(int key, int x, int y)+foreign import capi safe "dcimgui_impl_glut.h cImGui_ImplGLUT_SpecialFunc"+  specialFunc+    :: CInt -- ^ key+    -> CInt -- ^ x+    -> CInt -- ^ y+    -> IO ()++-- C: void ImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y)+foreign import capi safe "dcimgui_impl_glut.h cImGui_ImplGLUT_SpecialUpFunc"+  specialUpFunc+    :: CInt -- ^ key+    -> CInt -- ^ x+    -> CInt -- ^ y+    -> IO ()