From 9be367d5adf482cbfe84552a3f8e477d45ce3f6c Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 29 Aug 2019 15:45:49 +0200 Subject: [PATCH] IMGUI_DEBUG_LOG --- Developer-Tips.md | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Developer-Tips.md b/Developer-Tips.md index 49d0e33..062888f 100644 --- a/Developer-Tips.md +++ b/Developer-Tips.md @@ -1,3 +1,18 @@ +If you are working on Dear ImGui codebase: + +### Logging +You can use the `IMGUI_DEBUG_LOG` macro (declared in `imgui_internal.h`) to easily print text to the console while including the current frame counter, which is very often useful in log. + +### Using breakpoints +Using debugger breakpoints can be tedious in an interactive application dealing with lots of data. Even more so as the state of the application may be so reliant on mouse and keyboard inputs. One convenient trick is filter breakpoint based on custom conditions, e.g checking for the Alt key modifier to be pressed: + +``` +if (ImGui::GetIO().KeyAlt) + printf(""); // Set a debugger breakpoint here! +``` + +So you can setup your UI state for debugging (open windows, mouse position, active action etc.) and then only when you press ALT your breakpoint will trigger. + ### Using Natvis file for Visual Studio debugging The `misc/natvis/imgui.natvis` file may be included in your project to provide support for dear imgui types in the debugger (e.g. expanding of `ImVector<>` arrays). @@ -19,13 +34,3 @@ echo ---- Totals: type "%WORK_DIR%\output\%PROJ_NAME%.plog_totals.txt" start "" "%WORK_DIR%\output\fullhtml\index.html" ``` - -### Using breakpoints -Using debugger breakpoints can be tedious in an interactive application dealing with lots of data. Even more so as the state of the application may be so reliant on mouse and keyboard inputs. One convenient trick is filter breakpoint based on custom conditions, e.g checking for the Alt key modifier to be pressed: - -``` -if (ImGui::GetIO().KeyAlt) - printf(""); // Set a debugger breakpoint here! -``` - -So you can setup your UI state for debugging (open windows, mouse position, active action etc.) and then only when you press ALT your breakpoint will trigger.