From 1d9a4748de2eda0cdd25f0e2ae92d2915abd8e07 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 5 Oct 2014 09:08:57 +0100 Subject: [PATCH] Added a UserData void *pointer so that the callback functions can access user state "Just in case a project has adverse reactions to adding globals or statics in their own code." --- imgui.cpp | 1 + imgui.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 16110ed6..93acf44d 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -331,6 +331,7 @@ ImGuiIO::ImGuiIO() MouseDoubleClickMaxDist = 6.0f; // User functions + UserData = NULL; RenderDrawListsFn = NULL; MemAllocFn = malloc; MemReallocFn = realloc; diff --git a/imgui.h b/imgui.h index 576a8693..65358aa0 100644 --- a/imgui.h +++ b/imgui.h @@ -427,6 +427,9 @@ struct ImGuiIO // User Functions //------------------------------------------------------------------ + // Store your own data for retrieval by callbacks. + void* UserData; // = NULL + // REQUIRED: rendering function. // See example code if you are unsure of how to implement this. void (*RenderDrawListsFn)(ImDrawList** const draw_lists, int count);