From 32adeac8298702dbbaecedd527b4fe8bad154585 Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Wed, 8 Apr 2015 00:49:48 +0200 Subject: [PATCH] - support varargs text method - support more methods --- cimgui/cimgui.cpp | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/cimgui/cimgui.cpp b/cimgui/cimgui.cpp index af828a4..841421d 100644 --- a/cimgui/cimgui.cpp +++ b/cimgui/cimgui.cpp @@ -1,4 +1,7 @@ +#include +#include + #include "../imgui/imgui.h" #if defined _WIN32 || defined __CYGWIN__ @@ -27,9 +30,35 @@ extern "C" API void ImGui_Render() ImGui::Render(); } -extern "C" API void ImGui_Text(const char* text) +extern "C" API bool ImGui_Begin(const char* name, bool* p_opened, ImGuiWindowFlags flags) { - ImGui::Text(text); + return ImGui::Begin(name, p_opened, flags); +} + +extern "C" API void ImGui_End() +{ + ImGui::End(); +} + +extern "C" API void ImGui_Text(const char* text, ...) +{ + char buffer[256]; + va_list args; + va_start (args, text); + vsprintf (buffer, text, args); + va_end (args); + + ImGui::Text(buffer); +} + +extern "C" API bool ImGui_ColorEdit3(const char* label, float col[3]) +{ + return ImGui::ColorEdit3(label,col); +} + +extern "C" API void ImGui_SetNextWindowSize(const ImVec2 size, ImGuiSetCond cond) +{ + ImGui::SetNextWindowSize(size, cond); } extern "C" API void ImGui_SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format, float power) @@ -71,3 +100,8 @@ extern "C" API ImDrawCmd* ImDrawList_GetCmdPtr(ImDrawList* list, int n) { return &list->commands[n]; } + +extern "C" API void ImGuiIO_AddInputCharacter(unsigned short c) +{ + ImGui::GetIO().AddInputCharacter(c); +}