add comment to ExampleAppLog and mini refactoring

This commit is contained in:
oxmox 2023-02-14 21:26:11 +01:00
parent ddea47ba59
commit 17f4b34ea3
2 changed files with 5 additions and 2 deletions

View file

@ -199,7 +199,7 @@ int doom_controller_loop(ControllerContext &ctx)
return 0; return 0;
} }
void log_to_context(log_Event *ev) void log_to_imgui(log_Event *ev)
{ {
auto ctx = reinterpret_cast<ControllerContext *>(ev->udata); auto ctx = reinterpret_cast<ControllerContext *>(ev->udata);
ctx->appLog.AddLog(ev->fmt, ev->ap); ctx->appLog.AddLog(ev->fmt, ev->ap);
@ -258,7 +258,7 @@ int main(int argc, char *argv[])
{}, {},
}; };
log_add_callback(log_to_context, &ctx, LOG_TRACE); log_add_callback(log_to_imgui, &ctx, LOG_TRACE);
int ret = doom_controller_loop(ctx); int ret = doom_controller_loop(ctx);

View file

@ -31,6 +31,9 @@ template<size_t Size>
return buf.data(); return buf.data();
} }
// Copied from the ImGui demo code. Added the AddLog() overload taking a
// va_list.
// Usage: // Usage:
// static ExampleAppLog my_log; // static ExampleAppLog my_log;
// my_log.AddLog("Hello %d world\n", 123); // my_log.AddLog("Hello %d world\n", 123);