imgui_impl_glfw.cpp
Go to the documentation of this file.
1 // dear imgui: Platform Binding for GLFW
2 // This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..)
3 // (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
4 // (Requires: GLFW 3.1+)
5 
6 // Implemented features:
7 // [X] Platform: Clipboard support.
8 // [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
9 // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange' (note: the resizing cursors requires GLFW 3.4+).
10 // [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
11 
12 // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
13 // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
14 // https://github.com/ocornut/imgui
15 
16 // CHANGELOG
17 // (minor and older changes stripped away, please see git history for details)
18 // 2020-01-17: Inputs: Disable error callback while assigning mouse cursors because some X11 setup don't have them and it generates errors.
19 // 2019-12-05: Inputs: Added support for new mouse cursors added in GLFW 3.4+ (resizing cursors, not allowed cursor).
20 // 2019-10-18: Misc: Previously installed user callbacks are now restored on shutdown.
21 // 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
22 // 2019-05-11: Inputs: Don't filter value from character callback before calling AddInputCharacter().
23 // 2019-03-12: Misc: Preserve DisplayFramebufferScale when main window is minimized.
24 // 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
25 // 2018-11-07: Inputs: When installing our GLFW callbacks, we save user's previously installed ones - if any - and chain call them.
26 // 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
27 // 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
28 // 2018-06-08: Misc: Extracted imgui_impl_glfw.cpp/.h away from the old combined GLFW+OpenGL/Vulkan examples.
29 // 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
30 // 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value, passed to glfwSetCursor()).
31 // 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
32 // 2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
33 // 2018-01-25: Inputs: Added gamepad support if ImGuiConfigFlags_NavEnableGamepad is set.
34 // 2018-01-25: Inputs: Honoring the io.WantSetMousePos by repositioning the mouse (when using navigation and ImGuiConfigFlags_NavMoveMouse is set).
35 // 2018-01-20: Inputs: Added Horizontal Mouse Wheel support.
36 // 2018-01-18: Inputs: Added mapping for ImGuiKey_Insert.
37 // 2017-08-25: Inputs: MousePos set to -FLT_MAX,-FLT_MAX when mouse is unavailable/missing (instead of -1,-1).
38 // 2016-10-15: Misc: Added a void* user_data parameter to Clipboard function handlers.
39 
40 #include "imgui.h"
41 #include "imgui_impl_glfw.h"
42 
43 // GLFW
44 #include <GLFW/glfw3.h>
45 #ifdef _WIN32
46 #undef APIENTRY
47 #define GLFW_EXPOSE_NATIVE_WIN32
48 #include <GLFW/glfw3native.h> // for glfwGetWin32Window
49 #endif
50 #define GLFW_HAS_WINDOW_TOPMOST (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200) // 3.2+ GLFW_FLOATING
51 #define GLFW_HAS_WINDOW_HOVERED (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ GLFW_HOVERED
52 #define GLFW_HAS_WINDOW_ALPHA (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ glfwSetWindowOpacity
53 #define GLFW_HAS_PER_MONITOR_DPI (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300) // 3.3+ glfwGetMonitorContentScale
54 #define GLFW_HAS_VULKAN (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200) // 3.2+ glfwCreateWindowSurface
55 #ifdef GLFW_RESIZE_NESW_CURSOR // let's be nice to people who pulled GLFW between 2019-04-16 (3.4 define) and 2019-11-29 (cursors defines) // FIXME: Remove when GLFW 3.4 is released?
56 #define GLFW_HAS_NEW_CURSORS (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3400) // 3.4+ GLFW_RESIZE_ALL_CURSOR, GLFW_RESIZE_NESW_CURSOR, GLFW_RESIZE_NWSE_CURSOR, GLFW_NOT_ALLOWED_CURSOR
57 #else
58 #define GLFW_HAS_NEW_CURSORS (0)
59 #endif
60 
61 // Data
63 {
67 };
68 static GLFWwindow* g_Window = NULL; // Main window
70 static double g_Time = 0.0;
71 static bool g_MouseJustPressed[5] = { false, false, false, false, false };
73 static bool g_InstalledCallbacks = false;
74 
75 // Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
80 
81 static const char* ImGui_ImplGlfw_GetClipboardText(void* user_data)
82 {
83  return glfwGetClipboardString((GLFWwindow*)user_data);
84 }
85 
86 static void ImGui_ImplGlfw_SetClipboardText(void* user_data, const char* text)
87 {
88  glfwSetClipboardString((GLFWwindow*)user_data, text);
89 }
90 
91 void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods)
92 {
94  g_PrevUserCallbackMousebutton(window, button, action, mods);
95 
96  if (action == GLFW_PRESS && button >= 0 && button < IM_ARRAYSIZE(g_MouseJustPressed))
97  g_MouseJustPressed[button] = true;
98 }
99 
101 {
104 
105  ImGuiIO& io = ImGui::GetIO();
106  io.MouseWheelH += (float)xoffset;
107  io.MouseWheel += (float)yoffset;
108 }
109 
110 void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods)
111 {
113  g_PrevUserCallbackKey(window, key, scancode, action, mods);
114 
115  ImGuiIO& io = ImGui::GetIO();
116  if (action == GLFW_PRESS)
117  io.KeysDown[key] = true;
118  if (action == GLFW_RELEASE)
119  io.KeysDown[key] = false;
120 
121  // Modifiers are not reliable across systems
125 #ifdef _WIN32
126  io.KeySuper = false;
127 #else
129 #endif
130 }
131 
132 void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c)
133 {
135  g_PrevUserCallbackChar(window, c);
136 
137  ImGuiIO& io = ImGui::GetIO();
138  io.AddInputCharacter(c);
139 }
140 
141 static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api)
142 {
143  g_Window = window;
144  g_Time = 0.0;
145 
146  // Setup back-end capabilities flags
147  ImGuiIO& io = ImGui::GetIO();
148  io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
149  io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
150  io.BackendPlatformName = "imgui_impl_glfw";
151 
152  // Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array.
175 
179 #if defined(_WIN32)
180  io.ImeWindowHandle = (void*)glfwGetWin32Window(g_Window);
181 #endif
182 
183  // Create mouse cursors
184  // (By design, on X11 cursors are user configurable and some cursors may be missing. When a cursor doesn't exist,
185  // GLFW will emit an error which will often be printed by the app, so we temporarily disable error reporting.
186  // Missing cursors will return NULL and our _UpdateMouseCursor() function will use the Arrow cursor instead.)
187  GLFWerrorfun prev_error_callback = glfwSetErrorCallback(NULL);
193 #if GLFW_HAS_NEW_CURSORS
198 #else
203 #endif
204  glfwSetErrorCallback(prev_error_callback);
205 
206  // Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
211  if (install_callbacks)
212  {
213  g_InstalledCallbacks = true;
218  }
219 
220  g_ClientApi = client_api;
221  return true;
222 }
223 
224 bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks)
225 {
226  return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_OpenGL);
227 }
228 
229 bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks)
230 {
231  return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_Vulkan);
232 }
233 
235 {
237  {
242  g_InstalledCallbacks = false;
243  }
244 
245  for (ImGuiMouseCursor cursor_n = 0; cursor_n < ImGuiMouseCursor_COUNT; cursor_n++)
246  {
248  g_MouseCursors[cursor_n] = NULL;
249  }
251 }
252 
254 {
255  // Update buttons
256  ImGuiIO& io = ImGui::GetIO();
257  for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++)
258  {
259  // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
261  g_MouseJustPressed[i] = false;
262  }
263 
264  // Update mouse position
265  const ImVec2 mouse_pos_backup = io.MousePos;
266  io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
267 #ifdef __EMSCRIPTEN__
268  const bool focused = true; // Emscripten
269 #else
270  const bool focused = glfwGetWindowAttrib(g_Window, GLFW_FOCUSED) != 0;
271 #endif
272  if (focused)
273  {
274  if (io.WantSetMousePos)
275  {
276  glfwSetCursorPos(g_Window, (double)mouse_pos_backup.x, (double)mouse_pos_backup.y);
277  }
278  else
279  {
280  double mouse_x, mouse_y;
281  glfwGetCursorPos(g_Window, &mouse_x, &mouse_y);
282  io.MousePos = ImVec2((float)mouse_x, (float)mouse_y);
283  }
284  }
285 }
286 
288 {
289  ImGuiIO& io = ImGui::GetIO();
291  return;
292 
293  ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
294  if (imgui_cursor == ImGuiMouseCursor_None || io.MouseDrawCursor)
295  {
296  // Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
298  }
299  else
300  {
301  // Show OS mouse cursor
302  // FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
305  }
306 }
307 
309 {
310  ImGuiIO& io = ImGui::GetIO();
311  memset(io.NavInputs, 0, sizeof(io.NavInputs));
313  return;
314 
315  // Update gamepad inputs
316  #define MAP_BUTTON(NAV_NO, BUTTON_NO) { if (buttons_count > BUTTON_NO && buttons[BUTTON_NO] == GLFW_PRESS) io.NavInputs[NAV_NO] = 1.0f; }
317  #define MAP_ANALOG(NAV_NO, AXIS_NO, V0, V1) { float v = (axes_count > AXIS_NO) ? axes[AXIS_NO] : V0; v = (v - V0) / (V1 - V0); if (v > 1.0f) v = 1.0f; if (io.NavInputs[NAV_NO] < v) io.NavInputs[NAV_NO] = v; }
318  int axes_count = 0, buttons_count = 0;
319  const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &axes_count);
320  const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_1, &buttons_count);
321  MAP_BUTTON(ImGuiNavInput_Activate, 0); // Cross / A
322  MAP_BUTTON(ImGuiNavInput_Cancel, 1); // Circle / B
323  MAP_BUTTON(ImGuiNavInput_Menu, 2); // Square / X
324  MAP_BUTTON(ImGuiNavInput_Input, 3); // Triangle / Y
325  MAP_BUTTON(ImGuiNavInput_DpadLeft, 13); // D-Pad Left
326  MAP_BUTTON(ImGuiNavInput_DpadRight, 11); // D-Pad Right
327  MAP_BUTTON(ImGuiNavInput_DpadUp, 10); // D-Pad Up
328  MAP_BUTTON(ImGuiNavInput_DpadDown, 12); // D-Pad Down
329  MAP_BUTTON(ImGuiNavInput_FocusPrev, 4); // L1 / LB
330  MAP_BUTTON(ImGuiNavInput_FocusNext, 5); // R1 / RB
331  MAP_BUTTON(ImGuiNavInput_TweakSlow, 4); // L1 / LB
332  MAP_BUTTON(ImGuiNavInput_TweakFast, 5); // R1 / RB
333  MAP_ANALOG(ImGuiNavInput_LStickLeft, 0, -0.3f, -0.9f);
335  MAP_ANALOG(ImGuiNavInput_LStickUp, 1, +0.3f, +0.9f);
336  MAP_ANALOG(ImGuiNavInput_LStickDown, 1, -0.3f, -0.9f);
337  #undef MAP_BUTTON
338  #undef MAP_ANALOG
339  if (axes_count > 0 && buttons_count > 0)
341  else
343 }
344 
346 {
347  ImGuiIO& io = ImGui::GetIO();
348  IM_ASSERT(io.Fonts->IsBuilt() && "Font atlas not built! It is generally built by the renderer back-end. Missing call to renderer _NewFrame() function? e.g. ImGui_ImplOpenGL3_NewFrame().");
349 
350  // Setup display size (every frame to accommodate for window resizing)
351  int w, h;
352  int display_w, display_h;
354  glfwGetFramebufferSize(g_Window, &display_w, &display_h);
355  io.DisplaySize = ImVec2((float)w, (float)h);
356  if (w > 0 && h > 0)
357  io.DisplayFramebufferScale = ImVec2((float)display_w / w, (float)display_h / h);
358 
359  // Setup time step
360  double current_time = glfwGetTime();
361  io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f/60.0f);
362  g_Time = current_time;
363 
366 
367  // Update game controllers (if enabled and available)
369 }
ImGuiIO::KeyMap
int KeyMap[ImGuiKey_COUNT]
Definition: imgui.h:1430
GLFW_KEY_LEFT_ALT
#define GLFW_KEY_LEFT_ALT
Definition: glfw3.h:417
ImGuiMouseCursor_ResizeEW
@ ImGuiMouseCursor_ResizeEW
Definition: imgui.h:1249
ImGuiKey_Z
@ ImGuiKey_Z
Definition: imgui.h:1008
GLFW_KEY_TAB
#define GLFW_KEY_TAB
Definition: glfw3.h:356
glfwSetClipboardString
GLFWAPI void glfwSetClipboardString(GLFWwindow *window, const char *string)
Sets the clipboard to the specified string.
GLFW_KEY_PAGE_DOWN
#define GLFW_KEY_PAGE_DOWN
Definition: glfw3.h:365
glfw3native.h
The header of the native access functions.
GLFW_CURSOR_DISABLED
#define GLFW_CURSOR_DISABLED
Definition: glfw3.h:677
GLFW_CURSOR_NORMAL
#define GLFW_CURSOR_NORMAL
Definition: glfw3.h:675
GLFW_CURSOR
#define GLFW_CURSOR
Definition: glfw3.h:671
ImGui_ImplGlfw_UpdateGamepads
static void ImGui_ImplGlfw_UpdateGamepads()
Definition: imgui_impl_glfw.cpp:308
glfwSetCursor
GLFWAPI void glfwSetCursor(GLFWwindow *window, GLFWcursor *cursor)
Sets the cursor for the window.
ImGuiIO::KeySuper
bool KeySuper
Definition: imgui.h:1492
ImGui_ImplGlfw_InitForOpenGL
bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow *window, bool install_callbacks)
Definition: imgui_impl_glfw.cpp:224
GLFW_CURSOR_HIDDEN
#define GLFW_CURSOR_HIDDEN
Definition: glfw3.h:676
ImGuiIO::KeyCtrl
bool KeyCtrl
Definition: imgui.h:1489
GLFW_FOCUSED
#define GLFW_FOCUSED
Definition: glfw3.h:622
g_InstalledCallbacks
static bool g_InstalledCallbacks
Definition: imgui_impl_glfw.cpp:73
ImGuiIO::Fonts
ImFontAtlas * Fonts
Definition: imgui.h:1435
ImGuiKey_PageUp
@ ImGuiKey_PageUp
Definition: imgui.h:992
ImGuiNavInput_FocusNext
@ ImGuiNavInput_FocusNext
Definition: imgui.h:1042
glfwCreateStandardCursor
GLFWAPI GLFWcursor * glfwCreateStandardCursor(int shape)
Creates a cursor with a standard shape.
NULL
NULL
Definition: test_security_zap.cpp:405
yoffset
GLint GLint GLint yoffset
Definition: glcorearb.h:2837
GLFW_ARROW_CURSOR
#define GLFW_ARROW_CURSOR
The regular arrow cursor shape.
Definition: glfw3.h:694
ImGuiConfigFlags_NavEnableGamepad
@ ImGuiConfigFlags_NavEnableGamepad
Definition: imgui.h:1062
ImGuiIO::KeyShift
bool KeyShift
Definition: imgui.h:1490
ImGui_ImplGlfw_InitForVulkan
bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow *window, bool install_callbacks)
Definition: imgui_impl_glfw.cpp:229
GLFWmousebuttonfun
void(* GLFWmousebuttonfun)(GLFWwindow *, int, int, int)
The function signature for mouse button callbacks.
Definition: glfw3.h:953
ImGuiNavInput_TweakSlow
@ ImGuiNavInput_TweakSlow
Definition: imgui.h:1043
GLFW_PRESS
#define GLFW_PRESS
The key or mouse button was pressed.
Definition: glfw3.h:265
GLFW_KEY_Y
#define GLFW_KEY_Y
Definition: glfw3.h:344
glfw3.h
The header of the GLFW 3 API.
ImGuiNavInput_TweakFast
@ ImGuiNavInput_TweakFast
Definition: imgui.h:1044
GLFWerrorfun
void(* GLFWerrorfun)(int, const char *)
The function signature for error callbacks.
Definition: glfw3.h:810
ImGuiIO::DisplayFramebufferScale
ImVec2 DisplayFramebufferScale
Definition: imgui.h:1439
ImGuiNavInput_Activate
@ ImGuiNavInput_Activate
Definition: imgui.h:1029
ImGui_ImplGlfw_Shutdown
void ImGui_ImplGlfw_Shutdown()
Definition: imgui_impl_glfw.cpp:234
ImGui_ImplGlfw_GetClipboardText
static const char * ImGui_ImplGlfw_GetClipboardText(void *user_data)
Definition: imgui_impl_glfw.cpp:81
ImGui_ImplGlfw_Init
static bool ImGui_ImplGlfw_Init(GLFWwindow *window, bool install_callbacks, GlfwClientApi client_api)
Definition: imgui_impl_glfw.cpp:141
glfwGetJoystickAxes
const GLFWAPI float * glfwGetJoystickAxes(int joy, int *count)
Returns the values of all axes of the specified joystick.
ImGuiNavInput_Cancel
@ ImGuiNavInput_Cancel
Definition: imgui.h:1030
GLFWkeyfun
void(* GLFWkeyfun)(GLFWwindow *, int, int, int, int)
The function signature for keyboard key callbacks.
Definition: glfw3.h:1027
ImGuiKey_Enter
@ ImGuiKey_Enter
Definition: imgui.h:1000
g_MouseCursors
static GLFWcursor * g_MouseCursors[ImGuiMouseCursor_COUNT]
Definition: imgui_impl_glfw.cpp:72
ImGuiKey_Delete
@ ImGuiKey_Delete
Definition: imgui.h:997
glfwSetCharCallback
GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow *window, GLFWcharfun cbfun)
Sets the Unicode character callback.
g_PrevUserCallbackKey
static GLFWkeyfun g_PrevUserCallbackKey
Definition: imgui_impl_glfw.cpp:78
ImGuiKey_X
@ ImGuiKey_X
Definition: imgui.h:1006
GLFW_KEY_UP
#define GLFW_KEY_UP
Definition: glfw3.h:363
GLFWwindow
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:782
ImGuiKey_RightArrow
@ ImGuiKey_RightArrow
Definition: imgui.h:989
ImGuiIO::ImeWindowHandle
void * ImeWindowHandle
Definition: imgui.h:1470
GLFW_KEY_KP_ENTER
#define GLFW_KEY_KP_ENTER
Definition: glfw3.h:413
ImGuiMouseCursor_None
@ ImGuiMouseCursor_None
Definition: imgui.h:1244
imgui.h
GLFW_KEY_SPACE
#define GLFW_KEY_SPACE
Definition: glfw3.h:302
GLFW_KEY_RIGHT
#define GLFW_KEY_RIGHT
Definition: glfw3.h:360
ImGuiIO::NavInputs
float NavInputs[ImGuiNavInput_COUNT]
Definition: imgui.h:1494
ImGuiKey_Space
@ ImGuiKey_Space
Definition: imgui.h:999
ImGuiIO::ClipboardUserData
void * ClipboardUserData
Definition: imgui.h:1465
ImGuiIO::GetClipboardTextFn
const char *(* GetClipboardTextFn)(void *user_data)
Definition: imgui.h:1463
imgui_impl_glfw.h
ImVec2
Definition: imgui.h:208
ImGuiKey_End
@ ImGuiKey_End
Definition: imgui.h:995
ImGuiIO::KeyAlt
bool KeyAlt
Definition: imgui.h:1491
ImGui::GetIO
IMGUI_API ImGuiIO & GetIO()
Definition: imgui.cpp:3286
ImGuiIO::MouseDrawCursor
bool MouseDrawCursor
Definition: imgui.h:1442
GlfwClientApi_OpenGL
@ GlfwClientApi_OpenGL
Definition: imgui_impl_glfw.cpp:65
GLFW_JOYSTICK_1
#define GLFW_JOYSTICK_1
Definition: glfw3.h:477
glfwSetCursorPos
GLFWAPI void glfwSetCursorPos(GLFWwindow *window, double xpos, double ypos)
Sets the position of the cursor, relative to the client area of the window.
g_PrevUserCallbackMousebutton
static GLFWmousebuttonfun g_PrevUserCallbackMousebutton
Definition: imgui_impl_glfw.cpp:76
ImGui::GetMouseCursor
IMGUI_API ImGuiMouseCursor GetMouseCursor()
Definition: imgui.cpp:4543
GLFW_KEY_V
#define GLFW_KEY_V
Definition: glfw3.h:341
GLFW_KEY_A
#define GLFW_KEY_A
Definition: glfw3.h:320
glfwGetClipboardString
const GLFWAPI char * glfwGetClipboardString(GLFWwindow *window)
Returns the contents of the clipboard as a string.
ImGuiIO::AddInputCharacter
IMGUI_API void AddInputCharacter(unsigned int c)
Definition: imgui.cpp:1130
glfwSetErrorCallback
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
Sets the error callback.
ImGuiIO::WantSetMousePos
bool WantSetMousePos
Definition: imgui.h:1509
ImGui_ImplGlfw_KeyCallback
void ImGui_ImplGlfw_KeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
Definition: imgui_impl_glfw.cpp:110
ImGuiNavInput_LStickLeft
@ ImGuiNavInput_LStickLeft
Definition: imgui.h:1037
ImGuiKey_A
@ ImGuiKey_A
Definition: imgui.h:1003
ImGuiKey_Home
@ ImGuiKey_Home
Definition: imgui.h:994
glfwGetJoystickButtons
const GLFWAPI unsigned char * glfwGetJoystickButtons(int joy, int *count)
Returns the state of all buttons of the specified joystick.
GLFW_KEY_RIGHT_CONTROL
#define GLFW_KEY_RIGHT_CONTROL
Definition: glfw3.h:420
GLFW_KEY_BACKSPACE
#define GLFW_KEY_BACKSPACE
Definition: glfw3.h:357
ImGuiBackendFlags_HasMouseCursors
@ ImGuiBackendFlags_HasMouseCursors
Definition: imgui.h:1078
GLFW_KEY_LEFT_SHIFT
#define GLFW_KEY_LEFT_SHIFT
Definition: glfw3.h:415
ImGuiIO::MouseDown
bool MouseDown[5]
Definition: imgui.h:1486
glfwGetWindowSize
GLFWAPI void glfwGetWindowSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the client area of the specified window.
g_PrevUserCallbackScroll
static GLFWscrollfun g_PrevUserCallbackScroll
Definition: imgui_impl_glfw.cpp:77
ImGui_ImplGlfw_UpdateMousePosAndButtons
static void ImGui_ImplGlfw_UpdateMousePosAndButtons()
Definition: imgui_impl_glfw.cpp:253
ImGuiMouseCursor_NotAllowed
@ ImGuiMouseCursor_NotAllowed
Definition: imgui.h:1253
glfwGetCursorPos
GLFWAPI void glfwGetCursorPos(GLFWwindow *window, double *xpos, double *ypos)
Retrieves the position of the cursor relative to the client area of the window.
benchmarks.python.py_benchmark.action
action
Definition: py_benchmark.py:13
glfwGetWindowAttrib
GLFWAPI int glfwGetWindowAttrib(GLFWwindow *window, int attrib)
Returns an attribute of the specified window.
GLFW_IBEAM_CURSOR
#define GLFW_IBEAM_CURSOR
The text input I-beam cursor shape.
Definition: glfw3.h:699
GLFWscrollfun
void(* GLFWscrollfun)(GLFWwindow *, double, double)
The function signature for scroll callbacks.
Definition: glfw3.h:1006
GLFW_HAND_CURSOR
#define GLFW_HAND_CURSOR
The hand shape.
Definition: glfw3.h:709
glfwSetScrollCallback
GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow *window, GLFWscrollfun cbfun)
Sets the scroll callback.
ImGuiIO::ConfigFlags
ImGuiConfigFlags ConfigFlags
Definition: imgui.h:1420
ImGuiNavInput_FocusPrev
@ ImGuiNavInput_FocusPrev
Definition: imgui.h:1041
ImGui_ImplGlfw_UpdateMouseCursor
static void ImGui_ImplGlfw_UpdateMouseCursor()
Definition: imgui_impl_glfw.cpp:287
ImGuiNavInput_DpadLeft
@ ImGuiNavInput_DpadLeft
Definition: imgui.h:1033
ImGuiKey_Y
@ ImGuiKey_Y
Definition: imgui.h:1007
ImGuiKey_DownArrow
@ ImGuiKey_DownArrow
Definition: imgui.h:991
ImGui_ImplGlfw_MouseButtonCallback
void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow *window, int button, int action, int mods)
Definition: imgui_impl_glfw.cpp:91
g_ClientApi
static GlfwClientApi g_ClientApi
Definition: imgui_impl_glfw.cpp:69
ImGuiNavInput_DpadDown
@ ImGuiNavInput_DpadDown
Definition: imgui.h:1036
ImGuiBackendFlags_HasSetMousePos
@ ImGuiBackendFlags_HasSetMousePos
Definition: imgui.h:1079
ImVec2::x
float x
Definition: imgui.h:210
ImGui_ImplGlfw_NewFrame
void ImGui_ImplGlfw_NewFrame()
Definition: imgui_impl_glfw.cpp:345
glfwGetMouseButton
GLFWAPI int glfwGetMouseButton(GLFWwindow *window, int button)
Returns the last reported state of a mouse button for the specified window.
g_MouseJustPressed
static bool g_MouseJustPressed[5]
Definition: imgui_impl_glfw.cpp:71
GLFW_KEY_DOWN
#define GLFW_KEY_DOWN
Definition: glfw3.h:362
ImGuiKey_KeyPadEnter
@ ImGuiKey_KeyPadEnter
Definition: imgui.h:1002
GLFW_KEY_END
#define GLFW_KEY_END
Definition: glfw3.h:367
g_Window
static GLFWwindow * g_Window
Definition: imgui_impl_glfw.cpp:68
GLFW_KEY_HOME
#define GLFW_KEY_HOME
Definition: glfw3.h:366
ImGuiIO::MouseWheel
float MouseWheel
Definition: imgui.h:1487
ImGui_ImplGlfw_SetClipboardText
static void ImGui_ImplGlfw_SetClipboardText(void *user_data, const char *text)
Definition: imgui_impl_glfw.cpp:86
ImGui_ImplGlfw_CharCallback
void ImGui_ImplGlfw_CharCallback(GLFWwindow *window, unsigned int c)
Definition: imgui_impl_glfw.cpp:132
ImGuiKey_LeftArrow
@ ImGuiKey_LeftArrow
Definition: imgui.h:988
IM_ARRAYSIZE
#define IM_ARRAYSIZE(_ARR)
Definition: imgui.h:88
glfwSetMouseButtonCallback
GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow *window, GLFWmousebuttonfun cbfun)
Sets the mouse button callback.
ImGuiMouseCursor_ResizeAll
@ ImGuiMouseCursor_ResizeAll
Definition: imgui.h:1247
GLFW_KEY_INSERT
#define GLFW_KEY_INSERT
Definition: glfw3.h:358
GLFW_RELEASE
#define GLFW_RELEASE
The key or mouse button was released.
Definition: glfw3.h:258
ImGui_ImplGlfw_ScrollCallback
void ImGui_ImplGlfw_ScrollCallback(GLFWwindow *window, double xoffset, double yoffset)
Definition: imgui_impl_glfw.cpp:100
g_PrevUserCallbackChar
static GLFWcharfun g_PrevUserCallbackChar
Definition: imgui_impl_glfw.cpp:79
key
const SETUP_TEARDOWN_TESTCONTEXT char * key
Definition: test_wss_transport.cpp:10
ImGuiNavInput_LStickUp
@ ImGuiNavInput_LStickUp
Definition: imgui.h:1039
GLFW_KEY_PAGE_UP
#define GLFW_KEY_PAGE_UP
Definition: glfw3.h:364
ImGuiKey_PageDown
@ ImGuiKey_PageDown
Definition: imgui.h:993
MAP_BUTTON
#define MAP_BUTTON(NAV_NO, BUTTON_NO)
ImGuiKey_C
@ ImGuiKey_C
Definition: imgui.h:1004
i
int i
Definition: gmock-matchers_test.cc:764
GLFW_KEY_ENTER
#define GLFW_KEY_ENTER
Definition: glfw3.h:355
glfwGetTime
GLFWAPI double glfwGetTime(void)
Returns the value of the GLFW timer.
GLFW_KEY_LEFT_CONTROL
#define GLFW_KEY_LEFT_CONTROL
Definition: glfw3.h:416
MAP_ANALOG
#define MAP_ANALOG(NAV_NO, AXIS_NO, V0, V1)
ImGuiMouseCursor_COUNT
@ ImGuiMouseCursor_COUNT
Definition: imgui.h:1254
GLFW_VRESIZE_CURSOR
#define GLFW_VRESIZE_CURSOR
The vertical resize arrow shape.
Definition: glfw3.h:719
ImGuiKey_Escape
@ ImGuiKey_Escape
Definition: imgui.h:1001
ImGuiMouseCursor_ResizeNWSE
@ ImGuiMouseCursor_ResizeNWSE
Definition: imgui.h:1251
ImGuiIO::BackendPlatformName
const char * BackendPlatformName
Definition: imgui.h:1455
ImFontAtlas::IsBuilt
bool IsBuilt() const
Definition: imgui.h:2205
ImGuiIO::MousePos
ImVec2 MousePos
Definition: imgui.h:1485
ImGuiMouseCursor_Hand
@ ImGuiMouseCursor_Hand
Definition: imgui.h:1252
GLFWcursor
struct GLFWcursor GLFWcursor
Opaque cursor object.
Definition: glfw3.h:794
GLFW_KEY_ESCAPE
#define GLFW_KEY_ESCAPE
Definition: glfw3.h:354
glfwGetInputMode
GLFWAPI int glfwGetInputMode(GLFWwindow *window, int mode)
Returns the value of an input option for the specified window.
ImGuiIO::DisplaySize
ImVec2 DisplaySize
Definition: imgui.h:1422
GLFW_KEY_RIGHT_SUPER
#define GLFW_KEY_RIGHT_SUPER
Definition: glfw3.h:422
GLFW_KEY_C
#define GLFW_KEY_C
Definition: glfw3.h:322
GlfwClientApi_Unknown
@ GlfwClientApi_Unknown
Definition: imgui_impl_glfw.cpp:64
GLFW_KEY_RIGHT_SHIFT
#define GLFW_KEY_RIGHT_SHIFT
Definition: glfw3.h:419
GLFW_HRESIZE_CURSOR
#define GLFW_HRESIZE_CURSOR
The horizontal resize arrow shape.
Definition: glfw3.h:714
ImGuiMouseCursor_ResizeNESW
@ ImGuiMouseCursor_ResizeNESW
Definition: imgui.h:1250
glfwSetKeyCallback
GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow *window, GLFWkeyfun cbfun)
Sets the key callback.
ImGuiMouseCursor_TextInput
@ ImGuiMouseCursor_TextInput
Definition: imgui.h:1246
ImGuiNavInput_Menu
@ ImGuiNavInput_Menu
Definition: imgui.h:1032
ImGuiNavInput_Input
@ ImGuiNavInput_Input
Definition: imgui.h:1031
GLFW_KEY_RIGHT_ALT
#define GLFW_KEY_RIGHT_ALT
Definition: glfw3.h:421
GLFW_KEY_DELETE
#define GLFW_KEY_DELETE
Definition: glfw3.h:359
ImGuiIO
Definition: imgui.h:1414
g_Time
static double g_Time
Definition: imgui_impl_glfw.cpp:70
GLFW_KEY_LEFT
#define GLFW_KEY_LEFT
Definition: glfw3.h:361
ImGuiIO::MouseWheelH
float MouseWheelH
Definition: imgui.h:1488
xoffset
GLint GLint xoffset
Definition: glcorearb.h:2836
glfwSetInputMode
GLFWAPI void glfwSetInputMode(GLFWwindow *window, int mode, int value)
Sets an input option for the specified window.
ImGuiKey_Backspace
@ ImGuiKey_Backspace
Definition: imgui.h:998
GLFWcharfun
void(* GLFWcharfun)(GLFWwindow *, unsigned int)
The function signature for Unicode character callbacks.
Definition: glfw3.h:1044
ImGuiNavInput_LStickDown
@ ImGuiNavInput_LStickDown
Definition: imgui.h:1040
IM_ASSERT
#define IM_ASSERT(_EXPR)
Definition: imgui.h:79
ImGuiIO::KeysDown
bool KeysDown[512]
Definition: imgui.h:1493
ImGuiKey_UpArrow
@ ImGuiKey_UpArrow
Definition: imgui.h:990
f
GLfloat f
Definition: glcorearb.h:3964
ImGuiKey_Insert
@ ImGuiKey_Insert
Definition: imgui.h:996
ImGuiNavInput_LStickRight
@ ImGuiNavInput_LStickRight
Definition: imgui.h:1038
glfwGetFramebufferSize
GLFWAPI void glfwGetFramebufferSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the framebuffer of the specified window.
glfwDestroyCursor
GLFWAPI void glfwDestroyCursor(GLFWcursor *cursor)
Destroys a cursor.
w
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:3126
ImGuiIO::DeltaTime
float DeltaTime
Definition: imgui.h:1423
ImGuiMouseCursor
int ImGuiMouseCursor
Definition: imgui.h:150
GLFW_KEY_LEFT_SUPER
#define GLFW_KEY_LEFT_SUPER
Definition: glfw3.h:418
ImGuiNavInput_DpadUp
@ ImGuiNavInput_DpadUp
Definition: imgui.h:1035
GlfwClientApi_Vulkan
@ GlfwClientApi_Vulkan
Definition: imgui_impl_glfw.cpp:66
GlfwClientApi
GlfwClientApi
Definition: imgui_impl_glfw.cpp:62
ImGuiMouseCursor_ResizeNS
@ ImGuiMouseCursor_ResizeNS
Definition: imgui.h:1248
ImGuiMouseCursor_Arrow
@ ImGuiMouseCursor_Arrow
Definition: imgui.h:1245
ImGuiIO::BackendFlags
ImGuiBackendFlags BackendFlags
Definition: imgui.h:1421
GLFW_KEY_X
#define GLFW_KEY_X
Definition: glfw3.h:343
ImGuiConfigFlags_NoMouseCursorChange
@ ImGuiConfigFlags_NoMouseCursorChange
Definition: imgui.h:1066
ImGuiBackendFlags_HasGamepad
@ ImGuiBackendFlags_HasGamepad
Definition: imgui.h:1077
ImGuiNavInput_DpadRight
@ ImGuiNavInput_DpadRight
Definition: imgui.h:1034
ImGuiKey_Tab
@ ImGuiKey_Tab
Definition: imgui.h:987
h
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:4147
ImVec2::y
float y
Definition: imgui.h:210
ImGuiIO::SetClipboardTextFn
void(* SetClipboardTextFn)(void *user_data, const char *text)
Definition: imgui.h:1464
GLFW_KEY_Z
#define GLFW_KEY_Z
Definition: glfw3.h:345
ImGuiKey_V
@ ImGuiKey_V
Definition: imgui.h:1005


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:54