make the header more c-compatible (still not quite there yet)

This commit is contained in:
Stephan Dilly
2015-04-09 16:43:42 +02:00
parent 359b5e3fe5
commit bff93d2c38
3 changed files with 115 additions and 106 deletions

View File

@@ -1,7 +1,4 @@
#include <stdarg.h>
#include <stdio.h>
#include "../imgui/imgui.h"
#include "cimgui.h"

View File

@@ -1,4 +1,8 @@
#include <stdbool.h>
#include <stdarg.h>
#include <stdio.h>
#if defined _WIN32 || defined __CYGWIN__
#define API __declspec(dllexport)
#define snprintf sprintf_s
@@ -6,9 +10,17 @@
#define API
#endif
#if defined __cplusplus
#define EXTERN extern "C"
#else
#define EXTERN extern
#endif
#define CIMGUI_API EXTERN API
typedef int ImGuiWindowFlags;
typedef int ImGuiSetCond;
typedef int ImGuiColorEditMode;
CIMGUI_API ImGuiIO* ig_GetIO();
CIMGUI_API ImGuiStyle* ig_GetStyle();
CIMGUI_API void ig_NewFrame();
@@ -16,56 +28,56 @@ CIMGUI_API void ig_Render();
CIMGUI_API void ig_Shutdown();
CIMGUI_API void ig_ShowUserGuide();
CIMGUI_API void ig_ShowStyleEditor(ImGuiStyle* ref);
CIMGUI_API void ig_ShowTestWindow(bool* opened = NULL);
CIMGUI_API void ig_ShowMetricsWindow(bool* opened = NULL);
CIMGUI_API void ig_ShowTestWindow(bool* opened);
CIMGUI_API void ig_ShowMetricsWindow(bool* opened);
// Window
CIMGUI_API bool ig_Begin(const char* name = "Debug", bool* p_opened = NULL, ImGuiWindowFlags flags = 0);
CIMGUI_API bool ig_Begin2(const char* name, bool* p_opened, const ImVec2 size_on_first_use, float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0);
CIMGUI_API bool ig_Begin(const char* name, bool* p_opened, ImGuiWindowFlags flags);
CIMGUI_API bool ig_Begin2(const char* name, bool* p_opened, const struct ImVec2 size_on_first_use, float bg_alpha, ImGuiWindowFlags flags);
CIMGUI_API void ig_End();
CIMGUI_API bool ig_BeginChild(const char* str_id, const ImVec2 size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags extra_flags = 0);
CIMGUI_API bool ig_BeginChild2(ImGuiID id, const ImVec2 size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags extra_flags = 0);
CIMGUI_API bool ig_BeginChild(const char* str_id, const struct ImVec2 size, bool border, ImGuiWindowFlags extra_flags);
CIMGUI_API bool ig_BeginChild2(ImGuiID id, const struct ImVec2 size, bool border, ImGuiWindowFlags extra_flags);
CIMGUI_API void ig_EndChild();
CIMGUI_API void ig_GetContentRegionMax(ImVec2* out);
CIMGUI_API void ig_GetWindowContentRegionMin(ImVec2* out);
CIMGUI_API void ig_GetWindowContentRegionMax(ImVec2* out);
CIMGUI_API void ig_GetContentRegionMax(struct ImVec2* out);
CIMGUI_API void ig_GetWindowContentRegionMin(struct ImVec2* out);
CIMGUI_API void ig_GetWindowContentRegionMax(struct ImVec2* out);
CIMGUI_API ImDrawList* ig_GetWindowDrawList();
CIMGUI_API ImFont* ig_GetWindowFont();
CIMGUI_API float ig_GetWindowFontSize();
CIMGUI_API void ig_SetWindowFontScale(float scale);
CIMGUI_API void ig_GetWindowPos(ImVec2* out);
CIMGUI_API void ig_GetWindowSize(ImVec2* out);
CIMGUI_API void ig_GetWindowPos(struct ImVec2* out);
CIMGUI_API void ig_GetWindowSize(struct ImVec2* out);
CIMGUI_API float ig_GetWindowWidth();
CIMGUI_API bool ig_GetWindowCollapsed();
CIMGUI_API void ig_SetNextWindowPos(const ImVec2 pos, ImGuiSetCond cond = 0);
CIMGUI_API void ig_SetNextWindowSize(const ImVec2 size, ImGuiSetCond cond = 0);
CIMGUI_API void ig_SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0);
CIMGUI_API void ig_SetNextWindowPos(const struct ImVec2 pos, ImGuiSetCond cond);
CIMGUI_API void ig_SetNextWindowSize(const struct ImVec2 size, ImGuiSetCond cond);
CIMGUI_API void ig_SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond);
CIMGUI_API void ig_SetNextWindowFocus();
CIMGUI_API void ig_SetWindowPos(const ImVec2 pos, ImGuiSetCond cond = 0);
CIMGUI_API void ig_SetWindowSize(const ImVec2 size, ImGuiSetCond cond = 0);
CIMGUI_API void ig_SetWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0);
CIMGUI_API void ig_SetWindowPos(const struct ImVec2 pos, ImGuiSetCond cond);
CIMGUI_API void ig_SetWindowSize(const struct ImVec2 size, ImGuiSetCond cond);
CIMGUI_API void ig_SetWindowCollapsed(bool collapsed, ImGuiSetCond cond);
CIMGUI_API void ig_SetWindowFocus();
CIMGUI_API void ig_SetWindowPos2(const char* name, const ImVec2 pos, ImGuiSetCond cond = 0);
CIMGUI_API void ig_SetWindowSize2(const char* name, const ImVec2 size, ImGuiSetCond cond = 0);
CIMGUI_API void ig_SetWindowCollapsed2(const char* name, bool collapsed, ImGuiSetCond cond = 0);
CIMGUI_API void ig_SetWindowPos2(const char* name, const struct ImVec2 pos, ImGuiSetCond cond);
CIMGUI_API void ig_SetWindowSize2(const char* name, const struct ImVec2 size, ImGuiSetCond cond);
CIMGUI_API void ig_SetWindowCollapsed2(const char* name, bool collapsed, ImGuiSetCond cond);
CIMGUI_API void ig_SetWindowFocus2(const char* name);
CIMGUI_API float ig_GetScrollPosY();
CIMGUI_API float ig_GetScrollMaxY();
CIMGUI_API void ig_SetScrollPosHere();
CIMGUI_API void ig_SetKeyboardFocusHere(int offset = 0);
CIMGUI_API void ig_SetKeyboardFocusHere(int offset);
CIMGUI_API void ig_SetStateStorage(ImGuiStorage* tree);
CIMGUI_API ImGuiStorage* ig_GetStateStorage();
// Parameters stacks (shared)
CIMGUI_API void ig_PushFont(ImFont* font);
CIMGUI_API void ig_PopFont();
CIMGUI_API void ig_PushStyleColor(ImGuiCol idx, const ImVec4 col);
CIMGUI_API void ig_PopStyleColor(int count = 1);
CIMGUI_API void ig_PushStyleColor(ImGuiCol idx, const struct ImVec4 col);
CIMGUI_API void ig_PopStyleColor(int count);
CIMGUI_API void ig_PushStyleVar(ImGuiStyleVar idx, float val);
CIMGUI_API void ig_PushStyleVarVec(ImGuiStyleVar idx, const ImVec2 val);
CIMGUI_API void ig_PopStyleVar(int count = 1);
CIMGUI_API void ig_PushStyleVarVec(ImGuiStyleVar idx, const struct ImVec2 val);
CIMGUI_API void ig_PopStyleVar(int count);
// Parameters stacks (current window)
CIMGUI_API void ig_PushItemWidth(float item_width);
@@ -73,7 +85,7 @@ CIMGUI_API void ig_PopItemWidth();
CIMGUI_API float ig_CalcItemWidth();
CIMGUI_API void ig_PushAllowKeyboardFocus(bool v);
CIMGUI_API void ig_PopAllowKeyboardFocus();
CIMGUI_API void ig_PushTextWrapPos(float wrap_pos_x = 0.0f);
CIMGUI_API void ig_PushTextWrapPos(float wrap_pos_x);
CIMGUI_API void ig_PopTextWrapPos();
// Tooltip
@@ -90,25 +102,25 @@ CIMGUI_API void ig_EndPopup();
CIMGUI_API void ig_BeginGroup();
CIMGUI_API void ig_EndGroup();
CIMGUI_API void ig_Separator();
CIMGUI_API void ig_SameLine(int column_x = 0, int spacing_w = -1);
CIMGUI_API void ig_SameLine(int column_x, int spacing_w);
CIMGUI_API void ig_Spacing();
CIMGUI_API void ig_Indent();
CIMGUI_API void ig_Unindent();
CIMGUI_API void ig_Columns(int count = 1, const char* id = NULL, bool border = true);
CIMGUI_API void ig_Columns(int count, const char* id, bool border);
CIMGUI_API void ig_NextColumn();
CIMGUI_API int ig_GetColumnIndex();
CIMGUI_API float ig_GetColumnOffset(int column_index = -1);
CIMGUI_API float ig_GetColumnOffset(int column_index);
CIMGUI_API void ig_SetColumnOffset(int column_index, float offset_x);
CIMGUI_API float ig_GetColumnWidth(int column_index = -1);
CIMGUI_API float ig_GetColumnWidth(int column_index);
CIMGUI_API int ig_GetColumnsCount();
CIMGUI_API void ig_GetCursorPos(ImVec2* pOut);
CIMGUI_API void ig_GetCursorPos(struct ImVec2* pOut);
CIMGUI_API float ig_GetCursorPosX();
CIMGUI_API float ig_GetCursorPosY();
CIMGUI_API void ig_SetCursorPos(const ImVec2 pos);
CIMGUI_API void ig_SetCursorPos(const struct ImVec2 pos);
CIMGUI_API void ig_SetCursorPosX(float x);
CIMGUI_API void ig_SetCursorPosY(float y);
CIMGUI_API void ig_GetCursorScreenPos(ImVec2* pOut);
CIMGUI_API void ig_SetCursorScreenPos(const ImVec2 pos);
CIMGUI_API void ig_GetCursorScreenPos(struct ImVec2* pOut);
CIMGUI_API void ig_SetCursorScreenPos(const struct ImVec2 pos);
CIMGUI_API void ig_AlignFirstTextHeightToWidgets();
CIMGUI_API float ig_GetTextLineHeight();
CIMGUI_API float ig_GetTextLineHeightWithSpacing();
@@ -126,63 +138,63 @@ CIMGUI_API ImGuiID ig_GetID2(const void* ptr_id);
// Widgets
CIMGUI_API void ig_Text(const char* fmt, ...);
CIMGUI_API void ig_TextV(const char* fmt, va_list args);
CIMGUI_API void ig_TextColored(const ImVec4 col, const char* fmt, ...);
CIMGUI_API void ig_TextColoredV(const ImVec4 col, const char* fmt, va_list args);
CIMGUI_API void ig_TextColored(const struct ImVec4 col, const char* fmt, ...);
CIMGUI_API void ig_TextColoredV(const struct ImVec4 col, const char* fmt, va_list args);
CIMGUI_API void ig_TextWrapped(const char* fmt, ...);
CIMGUI_API void ig_TextWrappedV(const char* fmt, va_list args);
CIMGUI_API void ig_TextUnformatted(const char* text, const char* text_end = NULL);
CIMGUI_API void ig_TextUnformatted(const char* text, const char* text_end);
CIMGUI_API void ig_LabelText(const char* label, const char* fmt, ...);
CIMGUI_API void ig_LabelTextV(const char* label, const char* fmt, va_list args);
CIMGUI_API void ig_Bullet();
CIMGUI_API void ig_BulletText(const char* fmt, ...);
CIMGUI_API void ig_BulletTextV(const char* fmt, va_list args);
CIMGUI_API bool ig_Button(const char* label, const ImVec2 size = ImVec2(0, 0), bool repeat_when_held = false);
CIMGUI_API bool ig_Button(const char* label, const struct ImVec2 size, bool repeat_when_held);
CIMGUI_API bool ig_SmallButton(const char* label);
CIMGUI_API bool ig_InvisibleButton(const char* str_id, const ImVec2 size);
CIMGUI_API void ig_Image(ImTextureID user_texture_id, const ImVec2 size, const ImVec2 uv0 = ImVec2(0, 0), const ImVec2 uv1 = ImVec2(1, 1), const ImVec4 tint_col = ImVec4(1, 1, 1, 1), const ImVec4 border_col = ImVec4(0, 0, 0, 0));
CIMGUI_API bool ig_ImageButton(ImTextureID user_texture_id, const ImVec2 size, const ImVec2 uv0 = ImVec2(0, 0), const ImVec2 uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4 bg_col = ImVec4(0, 0, 0, 1), const ImVec4 tint_col = ImVec4(1, 1, 1, 1));
CIMGUI_API bool ig_CollapsingHeader(const char* label, const char* str_id = NULL, bool display_frame = true, bool default_open = false);
CIMGUI_API bool ig_InvisibleButton(const char* str_id, const struct ImVec2 size);
CIMGUI_API void ig_Image(ImTextureID user_texture_id, const struct ImVec2 size, const struct ImVec2 uv0, const struct ImVec2 uv1, const struct ImVec4 tint_col, const struct ImVec4 border_col);
CIMGUI_API bool ig_ImageButton(ImTextureID user_texture_id, const struct ImVec2 size, const struct ImVec2 uv0, const struct ImVec2 uv1, int frame_padding, const struct ImVec4 bg_col, const struct ImVec4 tint_col);
CIMGUI_API bool ig_CollapsingHeader(const char* label, const char* str_id, bool display_frame, bool default_open);
CIMGUI_API bool ig_Checkbox(const char* label, bool* v);
CIMGUI_API bool ig_CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
CIMGUI_API bool ig_RadioButton(const char* label, bool active);
CIMGUI_API bool ig_RadioButton2(const char* label, int* v, int v_button);
CIMGUI_API bool ig_Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
CIMGUI_API bool ig_Combo2(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items = -1);
CIMGUI_API bool ig_Combo3(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
CIMGUI_API bool ig_ColorButton(const ImVec4 col, bool small_height = false, bool outline_border = true);
CIMGUI_API bool ig_Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items);
CIMGUI_API bool ig_Combo2(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items);
CIMGUI_API bool ig_Combo3(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items);
CIMGUI_API bool ig_ColorButton(const struct ImVec4 col, bool small_height, bool outline_border);
CIMGUI_API bool ig_ColorEdit3(const char* label, float col[3]);
CIMGUI_API bool ig_ColorEdit4(const char* label, float col[4], bool show_alpha = true);
CIMGUI_API bool ig_ColorEdit4(const char* label, float col[4], bool show_alpha);
CIMGUI_API void ig_ColorEditMode(ImGuiColorEditMode mode);
CIMGUI_API void ig_PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), size_t stride = sizeof(float));
CIMGUI_API void ig_PlotLines2(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0));
CIMGUI_API void ig_PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), size_t stride = sizeof(float));
CIMGUI_API void ig_PlotHistogram2(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0));
CIMGUI_API void ig_PlotLines(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, struct ImVec2 graph_size, size_t stride);
CIMGUI_API void ig_PlotLines2(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, struct ImVec2 graph_size);
CIMGUI_API void ig_PlotHistogram(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, struct ImVec2 graph_size, size_t stride);
CIMGUI_API void ig_PlotHistogram2(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, struct ImVec2 graph_size);
// Widgets: Sliders (tip: ctrl+click on a slider to input text)
CIMGUI_API bool ig_SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
CIMGUI_API bool ig_SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
CIMGUI_API bool ig_SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
CIMGUI_API bool ig_SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
CIMGUI_API bool ig_SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f);
CIMGUI_API bool ig_SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "%.0f");
CIMGUI_API bool ig_SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f");
CIMGUI_API bool ig_SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f");
CIMGUI_API bool ig_SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f");
CIMGUI_API bool ig_VSliderFloat(const char* label, const ImVec2 size, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
CIMGUI_API bool ig_VSliderInt(const char* label, const ImVec2 size, int* v, int v_min, int v_max, const char* display_format = "%.0f");
CIMGUI_API bool ig_SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format, float power);
CIMGUI_API bool ig_SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format, float power);
CIMGUI_API bool ig_SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format, float power);
CIMGUI_API bool ig_SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format, float power);
CIMGUI_API bool ig_SliderAngle(const char* label, float* v_rad, float v_degrees_min, float v_degrees_max);
CIMGUI_API bool ig_SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format);
CIMGUI_API bool ig_SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format);
CIMGUI_API bool ig_SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format);
CIMGUI_API bool ig_SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format);
CIMGUI_API bool ig_VSliderFloat(const char* label, const struct ImVec2 size, float* v, float v_min, float v_max, const char* display_format, float power);
CIMGUI_API bool ig_VSliderInt(const char* label, const struct ImVec2 size, int* v, int v_min, int v_max, const char* display_format);
// Widgets: Drags (tip: ctrl+click on a drag box to input text)
// ImGui 1.38+ work-in-progress, may change name or API.
CIMGUI_API bool ig_DragFloat(const char* label, float* v, float v_step = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f");
CIMGUI_API bool ig_DragInt(const char* label, int* v, int v_step = 1, int v_min = 0.0f, int v_max = 0.0f, const char* display_format = "%.0f");
CIMGUI_API bool ig_DragFloat(const char* label, float* v, float v_step, float v_min, float v_max, const char* display_format);
CIMGUI_API bool ig_DragInt(const char* label, int* v, int v_step, int v_min, int v_max, const char* display_format);
// Widgets: Input
CIMGUI_API bool ig_InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
CIMGUI_API bool ig_InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
CIMGUI_API bool ig_InputFloat2(const char* label, float v[2], int decimal_precision = -1);
CIMGUI_API bool ig_InputFloat3(const char* label, float v[3], int decimal_precision = -1);
CIMGUI_API bool ig_InputFloat4(const char* label, float v[4], int decimal_precision = -1);
CIMGUI_API bool ig_InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
CIMGUI_API bool ig_InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data);
CIMGUI_API bool ig_InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags);
CIMGUI_API bool ig_InputFloat2(const char* label, float v[2], int decimal_precision);
CIMGUI_API bool ig_InputFloat3(const char* label, float v[3], int decimal_precision);
CIMGUI_API bool ig_InputFloat4(const char* label, float v[4], int decimal_precision);
CIMGUI_API bool ig_InputInt(const char* label, int* v, int step, int step_fast, ImGuiInputTextFlags extra_flags);
CIMGUI_API bool ig_InputInt2(const char* label, int v[2]);
CIMGUI_API bool ig_InputInt3(const char* label, int v[3]);
CIMGUI_API bool ig_InputInt4(const char* label, int v[4]);
@@ -193,32 +205,32 @@ CIMGUI_API bool ig_TreeNode2(const char* str_id, const char* fmt, ...);
CIMGUI_API bool ig_TreeNode3(const void* ptr_id, const char* fmt, ...);
CIMGUI_API bool ig_TreeNodeV(const char* str_id, const char* fmt, va_list args);
CIMGUI_API bool ig_TreeNodeV2(const void* ptr_id, const char* fmt, va_list args);
CIMGUI_API void ig_TreePush(const char* str_id = NULL);
CIMGUI_API void ig_TreePush2(const void* ptr_id = NULL);
CIMGUI_API void ig_TreePush(const char* str_id);
CIMGUI_API void ig_TreePush2(const void* ptr_id);
CIMGUI_API void ig_TreePop();
CIMGUI_API void ig_SetNextTreeNodeOpened(bool opened, ImGuiSetCond cond = 0);
CIMGUI_API void ig_SetNextTreeNodeOpened(bool opened, ImGuiSetCond cond);
// Widgets: Selectable / Lists
CIMGUI_API bool ig_Selectable(const char* label, bool selected = false, const ImVec2 size = ImVec2(0, 0));
CIMGUI_API bool ig_Selectable2(const char* label, bool* p_selected, const ImVec2 size = ImVec2(0, 0));
CIMGUI_API bool ig_ListBox(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
CIMGUI_API bool ig_ListBox2(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
CIMGUI_API bool ig_ListBoxHeader(const char* label, const ImVec2 size = ImVec2(0, 0));
CIMGUI_API bool ig_ListBoxHeader2(const char* label, int items_count, int height_in_items = -1);
CIMGUI_API bool ig_Selectable(const char* label, bool selected, const struct ImVec2 size);
CIMGUI_API bool ig_Selectable2(const char* label, bool* p_selected, const struct ImVec2 size);
CIMGUI_API bool ig_ListBox(const char* label, int* current_item, const char** items, int items_count, int height_in_items);
CIMGUI_API bool ig_ListBox2(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items);
CIMGUI_API bool ig_ListBoxHeader(const char* label, const struct ImVec2 size);
CIMGUI_API bool ig_ListBoxHeader2(const char* label, int items_count, int height_in_items);
CIMGUI_API void ig_ListBoxFooter();
// Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare your own within the ImGui namespace!)
CIMGUI_API void ig_Value(const char* prefix, bool b);
CIMGUI_API void ig_Value2(const char* prefix, int v);
CIMGUI_API void ig_Value3(const char* prefix, unsigned int v);
CIMGUI_API void ig_Value4(const char* prefix, float v, const char* float_format = NULL);
CIMGUI_API void ig_Color(const char* prefix, const ImVec4 v);
CIMGUI_API void ig_Value4(const char* prefix, float v, const char* float_format);
CIMGUI_API void ig_Color(const char* prefix, const struct ImVec4 v);
CIMGUI_API void ig_Color2(const char* prefix, unsigned int v);
// Logging: all text output from interface is redirected to tty/file/clipboard. Tree nodes are automatically opened.
CIMGUI_API void ig_LogToTTY(int max_depth = -1);
CIMGUI_API void ig_LogToFile(int max_depth = -1, const char* filename = NULL);
CIMGUI_API void ig_LogToClipboard(int max_depth = -1);
CIMGUI_API void ig_LogToTTY(int max_depth);
CIMGUI_API void ig_LogToFile(int max_depth, const char* filename);
CIMGUI_API void ig_LogToClipboard(int max_depth);
CIMGUI_API void ig_LogFinish();
CIMGUI_API void ig_LogButtons();
CIMGUI_API void ig_LogText(const char* fmt, ...);
@@ -228,36 +240,36 @@ CIMGUI_API bool ig_IsItemHovered();
CIMGUI_API bool ig_IsItemHoveredRect();
CIMGUI_API bool ig_IsItemActive();
CIMGUI_API bool ig_IsAnyItemActive();
CIMGUI_API void ig_GetItemRectMin(ImVec2* pOut);
CIMGUI_API void ig_GetItemRectMax(ImVec2* pOut);
CIMGUI_API void ig_GetItemRectSize(ImVec2* pOut);
CIMGUI_API void ig_GetItemRectMin(struct ImVec2* pOut);
CIMGUI_API void ig_GetItemRectMax(struct ImVec2* pOut);
CIMGUI_API void ig_GetItemRectSize(struct ImVec2* pOut);
CIMGUI_API bool ig_IsWindowFocused();
CIMGUI_API bool ig_IsRootWindowFocused();
CIMGUI_API bool ig_IsRootWindowOrAnyChildFocused();
CIMGUI_API bool ig_IsClipped(const ImVec2 item_size);
CIMGUI_API bool ig_IsKeyPressed(int key_index, bool repeat = true);
CIMGUI_API bool ig_IsMouseClicked(int button, bool repeat = false);
CIMGUI_API bool ig_IsClipped(const struct ImVec2 item_size);
CIMGUI_API bool ig_IsKeyPressed(int key_index, bool repeat);
CIMGUI_API bool ig_IsMouseClicked(int button, bool repeat);
CIMGUI_API bool ig_IsMouseDoubleClicked(int button);
CIMGUI_API bool ig_IsMouseHoveringWindow();
CIMGUI_API bool ig_IsMouseHoveringAnyWindow();
CIMGUI_API bool ig_IsMouseHoveringRect(const ImVec2 rect_min, const ImVec2 rect_max);
CIMGUI_API bool ig_IsMouseDragging(int button = 0, float lock_threshold = -1.0f);
CIMGUI_API bool ig_IsPosHoveringAnyWindow(const ImVec2 pos);
CIMGUI_API void ig_GetMousePos(ImVec2* pOut);
CIMGUI_API void ig_GetMouseDragDelta(ImVec2* pOut, int button = 0, float lock_threshold = -1.0f);
CIMGUI_API bool ig_IsMouseHoveringRect(const struct ImVec2 rect_min, const struct ImVec2 rect_max);
CIMGUI_API bool ig_IsMouseDragging(int button, float lock_threshold);
CIMGUI_API bool ig_IsPosHoveringAnyWindow(const struct ImVec2 pos);
CIMGUI_API void ig_GetMousePos(struct ImVec2* pOut);
CIMGUI_API void ig_GetMouseDragDelta(struct ImVec2* pOut, int button, float lock_threshold);
CIMGUI_API ImGuiMouseCursor ig_GetMouseCursor();
CIMGUI_API void ig_SetMouseCursor(ImGuiMouseCursor type);
CIMGUI_API float ig_GetTime();
CIMGUI_API int ig_GetFrameCount();
CIMGUI_API const char* ig_GetStyleColName(ImGuiCol idx);
CIMGUI_API void ig_CalcItemRectClosestPoint(ImVec2* pOut, const ImVec2 pos, bool on_edge = false, float outward = +0.0f);
CIMGUI_API void ig_CalcTextSize(ImVec2* pOut, const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
CIMGUI_API void ig_CalcItemRectClosestPoint(struct ImVec2* pOut, const struct ImVec2 pos, bool on_edge, float outward);
CIMGUI_API void ig_CalcTextSize(struct ImVec2* pOut, const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width);
CIMGUI_API void ig_CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end);
CIMGUI_API void ig_BeginChildFrame(ImGuiID id, const ImVec2 size);
CIMGUI_API void ig_BeginChildFrame(ImGuiID id, const struct ImVec2 size);
CIMGUI_API void ig_EndChildFrame();
CIMGUI_API ImU32 ig_ColorConvertFloat4ToU32(const ImVec4 in);
CIMGUI_API ImU32 ig_ColorConvertFloat4ToU32(const struct ImVec4 in);
CIMGUI_API void ig_ColorConvertRGBtoHSV(float r, float g, float b, float* out_h, float* out_s, float* out_v);
CIMGUI_API void ig_ColorConvertHSVtoRGB(float h, float s, float v, float* out_r, float* out_g, float* out_b);
@@ -265,4 +277,4 @@ CIMGUI_API void ig_ColorConvertHSVtoRGB(float h, float s, float v, float* out
CIMGUI_API const char* ig_GetVersion();
CIMGUI_API void* ig_GetInternalState();
CIMGUI_API size_t ig_GetInternalStateSize();
CIMGUI_API void ig_SetInternalState(void* state, bool construct = false);
CIMGUI_API void ig_SetInternalState(void* state, bool construct);

View File

@@ -2,17 +2,17 @@
#include "../imgui/imgui.h"
#include "cimgui.h"
EXTERN API void ImFontAtlas_GetTexDataAsRGBA32(ImFontAtlas* atlas, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)
CIMGUI_API void ImFontAtlas_GetTexDataAsRGBA32(ImFontAtlas* atlas, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)
{
atlas->GetTexDataAsRGBA32(out_pixels, out_width, out_height, out_bytes_per_pixel);
}
EXTERN API void ImFontAtlas_GetTexDataAsAlpha8(ImFontAtlas* atlas, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)
CIMGUI_API void ImFontAtlas_GetTexDataAsAlpha8(ImFontAtlas* atlas, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)
{
atlas->GetTexDataAsAlpha8(out_pixels, out_width, out_height, out_bytes_per_pixel);
}
EXTERN API void ImFontAtlas_SetTexID(ImFontAtlas* atlas, void* tex)
CIMGUI_API void ImFontAtlas_SetTexID(ImFontAtlas* atlas, void* tex)
{
atlas->TexID = tex;
}