add functions to support D-lang version of imgui_demo.cpp

1. add access functions for ImFontAtlas, ImFont
2. support ImGuiTextFilter, ImGuiTextBuffer
3. change the name igPushIdXXX => igPushIDXXX
4. bug fixes
This commit is contained in:
yosikawa
2017-09-18 19:04:54 +09:00
committed by Stephan Dilly
parent 33679d6957
commit 01578cb1bd
4 changed files with 585 additions and 209 deletions

View File

@@ -2,6 +2,10 @@
#include "../imgui/imgui.h"
#include "cimgui.h"
// to use placement new
#define IMGUI_DEFINE_PLACEMENT_NEW
#include "../imgui/imgui_internal.h"
CIMGUI_API ImGuiIO* igGetIO()
{
return &ImGui::GetIO();
@@ -633,43 +637,43 @@ CIMGUI_API int igGetColumnsCount()
// ID scopes
// If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them
// You can also use "##extra" within your widget name to distinguish them from each others (see 'Programmer Guide')
CIMGUI_API void igPushIdStr(CONST char* str_id)
CIMGUI_API void igPushIDStr(CONST char* str_id)
{
return ImGui::PushID(str_id);
}
CIMGUI_API void igPushIdStrRange(CONST char* str_begin, CONST char* str_end)
CIMGUI_API void igPushIDStrRange(CONST char* str_begin, CONST char* str_end)
{
return ImGui::PushID(str_begin, str_end);
}
CIMGUI_API void igPushIdPtr(CONST void* ptr_id)
CIMGUI_API void igPushIDPtr(CONST void* ptr_id)
{
return ImGui::PushID(ptr_id);
}
CIMGUI_API void igPushIdInt(int int_id)
CIMGUI_API void igPushIDInt(int int_id)
{
return ImGui::PushID(int_id);
}
CIMGUI_API void igPopId()
CIMGUI_API void igPopID()
{
return ImGui::PopID();
}
CIMGUI_API ImGuiID igGetIdStr(CONST char* str_id)
CIMGUI_API ImGuiID igGetIDStr(CONST char* str_id)
{
return ImGui::GetID(str_id);
}
CIMGUI_API ImGuiID igGetIdStrRange(CONST char* str_begin, CONST char* str_end)
CIMGUI_API ImGuiID igGetIDStrRange(CONST char* str_begin, CONST char* str_end)
{
return ImGui::GetID(str_begin, str_end);
}
CIMGUI_API ImGuiID igGetIdPtr(CONST void* ptr_id)
CIMGUI_API ImGuiID igGetIDPtr(CONST void* ptr_id)
{
return ImGui::GetID(ptr_id);
}
@@ -1277,7 +1281,7 @@ CIMGUI_API void igLogText(CONST char* fmt, ...)
char buffer[256];
va_list args;
va_start(args, fmt);
snprintf(buffer, 256, fmt, args);
vsnprintf(buffer, 256, fmt, args);
va_end(args);
ImGui::LogText("%s",buffer);
@@ -1604,9 +1608,17 @@ CIMGUI_API void ImGuiIO_ClearInputCharacters()
return ImGui::GetIO().ClearInputCharacters();
}
CIMGUI_API void ImGuiTextFilter_Init(struct ImGuiTextFilter* filter, const char* default_filter)
CIMGUI_API struct ImGuiTextFilter* ImGuiTextFilter_Create(const char* default_filter)
{
*filter = ImGuiTextFilter(default_filter);
ImGuiTextFilter* filter = (ImGuiTextFilter*)ImGui::MemAlloc(sizeof(ImGuiTextFilter));
IM_PLACEMENT_NEW(filter) ImGuiTextFilter();
return filter;
}
CIMGUI_API void ImGuiTextFilter_Destroy(struct ImGuiTextFilter* filter)
{
filter->~ImGuiTextFilter();
ImGui::MemFree(filter);
}
CIMGUI_API void ImGuiTextFilter_Clear(struct ImGuiTextFilter* filter)
@@ -1619,38 +1631,96 @@ CIMGUI_API bool ImGuiTextFilter_Draw(struct ImGuiTextFilter* filter, const char*
return filter->Draw(label, width);
}
CIMGUI_API bool ImGuiTextFilter_PassFilter(struct ImGuiTextFilter* filter, const char* text, const char* text_end)
CIMGUI_API bool ImGuiTextFilter_PassFilter(const struct ImGuiTextFilter* filter, const char* text, const char* text_end)
{
return filter->PassFilter(text, text_end);
}
CIMGUI_API bool ImGuiTextFilter_IsActive(struct ImGuiTextFilter* filter)
CIMGUI_API bool ImGuiTextFilter_IsActive(const struct ImGuiTextFilter* filter)
{
return filter->IsActive();
}
CIMGUI_API void ImGuiTextFilter_Build(struct ImGuiTextFilter* filter)
{
filter->Build();
}
CIMGUI_API void ImGuiTextEditCallbackData_DeleteChars(struct ImGuiTextEditCallbackData* data, int pos, int bytes_count)
CIMGUI_API const char* ImGuiTextFilter_GetInputBuf(struct ImGuiTextFilter* filter)
{
data->DeleteChars(pos, bytes_count);
return filter->InputBuf;
}
CIMGUI_API void ImGuiTextEditCallbackData_InsertChars(struct ImGuiTextEditCallbackData* data, int pos, const char* text, const char* text_end)
CIMGUI_API struct ImGuiTextBuffer* ImGuiTextBuffer_Create()
{
data->InsertChars(pos, text, text_end);
ImGuiTextBuffer* buffer = (ImGuiTextBuffer*)ImGui::MemAlloc(sizeof(ImGuiTextBuffer));
IM_PLACEMENT_NEW(buffer) ImGuiTextBuffer();
return buffer;
}
CIMGUI_API bool ImGuiTextEditCallbackData_HasSelection(struct ImGuiTextEditCallbackData* data)
CIMGUI_API void ImGuiTextBuffer_Destroy(struct ImGuiTextBuffer* buffer)
{
return data->HasSelection();
buffer->~ImGuiTextBuffer();
ImGui::MemFree(buffer);
}
CIMGUI_API void ImGuiStorage_Init(struct ImGuiStorage* storage)
CIMGUI_API char ImGuiTextBuffer_index(struct ImGuiTextBuffer* buffer, int i)
{
*storage = ImGuiStorage();
return (*buffer)[i];
}
CIMGUI_API const char* ImGuiTextBuffer_begin(const struct ImGuiTextBuffer* buffer)
{
return buffer->begin();
}
CIMGUI_API const char* ImGuiTextBuffer_end(const struct ImGuiTextBuffer* buffer)
{
return buffer->end();
}
CIMGUI_API int ImGuiTextBuffer_size(const struct ImGuiTextBuffer* buffer)
{
return buffer->size();
}
CIMGUI_API bool ImGuiTextBuffer_empty(struct ImGuiTextBuffer* buffer)
{
return buffer->empty();
}
CIMGUI_API void ImGuiTextBuffer_clear(struct ImGuiTextBuffer* buffer)
{
buffer->clear();
}
CIMGUI_API const char* ImGuiTextBuffer_c_str(const struct ImGuiTextBuffer* buffer)
{
return buffer->c_str();
}
CIMGUI_API void ImGuiTextBuffer_append(struct ImGuiTextBuffer* buffer, const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
buffer->appendv(fmt, args);
va_end(args);
}
CIMGUI_API void ImGuiTextBuffer_appendv(struct ImGuiTextBuffer* buffer, const char* fmt, va_list args)
{
buffer->appendv(fmt, args);
}
CIMGUI_API struct ImGuiStorage* ImGuiStorage_Create() {
ImGuiStorage* storage = (ImGuiStorage*)ImGui::MemAlloc(sizeof(ImGuiStorage));
IM_PLACEMENT_NEW(storage) ImGuiStorage();
return storage;
}
CIMGUI_API void ImGuiStorage_Destroy(struct ImGuiStorage* storage) {
storage->~ImGuiStorage();
ImGui::MemFree(storage);
}
CIMGUI_API void ImGuiStorage_Clear(struct ImGuiStorage* storage)
@@ -1722,3 +1792,18 @@ CIMGUI_API void ImGuiStorage_SetAllInt(struct ImGuiStorage* storage, int val)
{
storage->SetAllInt(val);
}
CIMGUI_API void ImGuiTextEditCallbackData_DeleteChars(struct ImGuiTextEditCallbackData* data, int pos, int bytes_count)
{
data->DeleteChars(pos, bytes_count);
}
CIMGUI_API void ImGuiTextEditCallbackData_InsertChars(struct ImGuiTextEditCallbackData* data, int pos, const char* text, const char* text_end)
{
data->InsertChars(pos, text, text_end);
}
CIMGUI_API bool ImGuiTextEditCallbackData_HasSelection(struct ImGuiTextEditCallbackData* data)
{
return data->HasSelection();
}

View File

@@ -547,14 +547,14 @@ CIMGUI_API int igGetColumnsCount();
// ID scopes
// If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them
// You can also use "##extra" within your widget name to distinguish them from each others (see 'Programmer Guide')
CIMGUI_API void igPushIdStr(CONST char* str_id);
CIMGUI_API void igPushIdStrRange(CONST char* str_begin, CONST char* str_end);
CIMGUI_API void igPushIdPtr(CONST void* ptr_id);
CIMGUI_API void igPushIdInt(int int_id);
CIMGUI_API void igPopId();
CIMGUI_API ImGuiID igGetIdStr(CONST char* str_id);
CIMGUI_API ImGuiID igGetIdStrRange(CONST char* str_begin,CONST char* str_end);
CIMGUI_API ImGuiID igGetIdPtr(CONST void* ptr_id);
CIMGUI_API void igPushIDStr(CONST char* str_id);
CIMGUI_API void igPushIDStrRange(CONST char* str_begin, CONST char* str_end);
CIMGUI_API void igPushIDPtr(CONST void* ptr_id);
CIMGUI_API void igPushIDInt(int int_id);
CIMGUI_API void igPopID();
CIMGUI_API ImGuiID igGetIDStr(CONST char* str_id);
CIMGUI_API ImGuiID igGetIDStrRange(CONST char* str_begin,CONST char* str_end);
CIMGUI_API ImGuiID igGetIDPtr(CONST void* ptr_id);
// Widgets
CIMGUI_API void igText(CONST char* fmt, ...);
@@ -779,33 +779,62 @@ CIMGUI_API void igDestroyContext(struct ImGuiContext* ctx);
CIMGUI_API struct ImGuiContext* igGetCurrentContext();
CIMGUI_API void igSetCurrentContext(struct ImGuiContext* ctx);
CIMGUI_API void ImFontConfig_DefaultConstructor(struct ImFontConfig* config);
CIMGUI_API void ImFontAtlas_GetTexDataAsRGBA32(struct ImFontAtlas* atlas, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel);
CIMGUI_API void ImFontAtlas_GetTexDataAsAlpha8(struct ImFontAtlas* atlas, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel);
CIMGUI_API void ImFontAtlas_SetTexID(struct ImFontAtlas* atlas, ImTextureID id);
CIMGUI_API struct ImFont* ImFontAtlas_AddFont(struct ImFontAtlas* atlas, CONST struct ImFontConfig* font_cfg);
CIMGUI_API struct ImFont* ImFontAtlas_AddFontDefault(struct ImFontAtlas* atlas, CONST struct ImFontConfig* font_cfg);
CIMGUI_API struct ImFont* ImFontAtlas_AddFontFromFileTTF(struct ImFontAtlas* atlas, CONST char* filename, float size_pixels, CONST struct ImFontConfig* font_cfg, CONST ImWchar* glyph_ranges);
CIMGUI_API struct ImFont* ImFontAtlas_AddFontFromMemoryTTF(struct ImFontAtlas* atlas, void* font_data, int font_size, float size_pixels, CONST struct ImFontConfig* font_cfg, CONST ImWchar* glyph_ranges);
CIMGUI_API struct ImFont* ImFontAtlas_AddFontFromMemoryCompressedTTF(struct ImFontAtlas* atlas, CONST void* compressed_font_data, int compressed_font_size, float size_pixels, CONST struct ImFontConfig* font_cfg, CONST ImWchar* glyph_ranges);
CIMGUI_API struct ImFont* ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(struct ImFontAtlas* atlas, CONST char* compressed_font_data_base85, float size_pixels, CONST struct ImFontConfig* font_cfg, CONST ImWchar* glyph_ranges);
CIMGUI_API void ImFontAtlas_ClearTexData(struct ImFontAtlas* atlas);
CIMGUI_API void ImFontAtlas_Clear(struct ImFontAtlas* atlas);
CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesDefault(struct ImFontAtlas* atlas);
CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesKorean(struct ImFontAtlas* atlas);
CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesJapanese(struct ImFontAtlas* atlas);
CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesChinese(struct ImFontAtlas* atlas);
CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesCyrillic(struct ImFontAtlas* atlas);
CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesThai(struct ImFontAtlas* atlas);
// ImGuiIO
CIMGUI_API void ImGuiIO_AddInputCharacter(unsigned short c);
CIMGUI_API void ImGuiIO_AddInputCharactersUTF8(CONST char* utf8_chars);
CIMGUI_API void ImGuiIO_ClearInputCharacters();
//ImDrawData
CIMGUI_API void ImDrawData_DeIndexAllBuffers(struct ImDrawData* drawData);
CIMGUI_API void ImDrawData_ScaleClipRects(struct ImDrawData* drawData, struct ImVec2 sc);
// ImGuiTextFilter
CIMGUI_API struct ImGuiTextFilter* ImGuiTextFilter_Create(const char* default_filter);
CIMGUI_API void ImGuiTextFilter_Destroy(struct ImGuiTextFilter* filter);
CIMGUI_API void ImGuiTextFilter_Clear(struct ImGuiTextFilter* filter);
CIMGUI_API bool ImGuiTextFilter_Draw(struct ImGuiTextFilter* filter, const char* label, float width);
CIMGUI_API bool ImGuiTextFilter_PassFilter(const struct ImGuiTextFilter* filter, const char* text, const char* text_end);
CIMGUI_API bool ImGuiTextFilter_IsActive(const struct ImGuiTextFilter* filter);
CIMGUI_API void ImGuiTextFilter_Build(struct ImGuiTextFilter* filter);
CIMGUI_API const char* ImGuiTextFilter_GetInputBuf(struct ImGuiTextFilter* filter);
// ImGuiTextBuffer
CIMGUI_API struct ImGuiTextBuffer* ImGuiTextBuffer_Create();
CIMGUI_API void ImGuiTextBuffer_Destroy(struct ImGuiTextBuffer* buffer);
CIMGUI_API char ImGuiTextBuffer_index(struct ImGuiTextBuffer* buffer, int i);
CIMGUI_API const char* ImGuiTextBuffer_begin(const struct ImGuiTextBuffer* buffer);
CIMGUI_API const char* ImGuiTextBuffer_end(const struct ImGuiTextBuffer* buffer);
CIMGUI_API int ImGuiTextBuffer_size(const struct ImGuiTextBuffer* buffer);
CIMGUI_API bool ImGuiTextBuffer_empty(struct ImGuiTextBuffer* buffer);
CIMGUI_API void ImGuiTextBuffer_clear(struct ImGuiTextBuffer* buffer);
CIMGUI_API const char* ImGuiTextBuffer_c_str(const struct ImGuiTextBuffer* buffer);
CIMGUI_API void ImGuiTextBuffer_append(struct ImGuiTextBuffer* buffer, const char* fmt, ...);
CIMGUI_API void ImGuiTextBuffer_appendv(struct ImGuiTextBuffer* buffer, const char* fmt, va_list args);
// ImGuiStorage
CIMGUI_API struct ImGuiStorage* ImGuiStorage_Create();
CIMGUI_API void ImGuiStorage_Destroy(struct ImGuiStorage* storage);
CIMGUI_API int ImGuiStorage_GetInt(struct ImGuiStorage* storage, ImGuiID key, int default_val);
CIMGUI_API void ImGuiStorage_SetInt(struct ImGuiStorage* storage, ImGuiID key, int val);
CIMGUI_API bool ImGuiStorage_GetBool(struct ImGuiStorage* storage, ImGuiID key, bool default_val);
CIMGUI_API void ImGuiStorage_SetBool(struct ImGuiStorage* storage, ImGuiID key, bool val);
CIMGUI_API float ImGuiStorage_GetFloat(struct ImGuiStorage* storage, ImGuiID key, float default_val);
CIMGUI_API void ImGuiStorage_SetFloat(struct ImGuiStorage* storage, ImGuiID key, float val);
CIMGUI_API void* ImGuiStorage_GetVoidPtr(struct ImGuiStorage* storage, ImGuiID key);
CIMGUI_API void ImGuiStorage_SetVoidPtr(struct ImGuiStorage* storage, ImGuiID key, void* val);
CIMGUI_API int* ImGuiStorage_GetIntRef(struct ImGuiStorage* storage, ImGuiID key, int default_val);
CIMGUI_API bool* ImGuiStorage_GetBoolRef(struct ImGuiStorage* storage, ImGuiID key, bool default_val);
CIMGUI_API float* ImGuiStorage_GetFloatRef(struct ImGuiStorage* storage, ImGuiID key, float default_val);
CIMGUI_API void** ImGuiStorage_GetVoidPtrRef(struct ImGuiStorage* storage, ImGuiID key, void* default_val);
CIMGUI_API void ImGuiStorage_SetAllInt(struct ImGuiStorage* storage, int val);
// ImGuiTextEditCallbackData
CIMGUI_API void ImGuiTextEditCallbackData_DeleteChars(struct ImGuiTextEditCallbackData* data, int pos, int bytes_count);
CIMGUI_API void ImGuiTextEditCallbackData_InsertChars(struct ImGuiTextEditCallbackData* data, int pos, const char* text, const char* text_end);
CIMGUI_API bool ImGuiTextEditCallbackData_HasSelection(struct ImGuiTextEditCallbackData* data);
// ImGuiListClipper
CIMGUI_API void ImGuiListClipper_Begin(struct ImGuiListClipper* clipper, int count, float items_height);
CIMGUI_API void ImGuiListClipper_End(struct ImGuiListClipper* clipper);
CIMGUI_API bool ImGuiListClipper_Step(struct ImGuiListClipper* clipper);
CIMGUI_API int ImGuiListClipper_GetDisplayStart(struct ImGuiListClipper* clipper);
CIMGUI_API int ImGuiListClipper_GetDisplayEnd(struct ImGuiListClipper* clipper);
//ImDrawList
CIMGUI_API int ImDrawList_GetVertexBufferSize(struct ImDrawList* list);
@@ -875,39 +904,76 @@ CIMGUI_API void ImDrawList_PrimVtx(struct ImDrawList* list, CONST st
CIMGUI_API void ImDrawList_UpdateClipRect(struct ImDrawList* list);
CIMGUI_API void ImDrawList_UpdateTextureID(struct ImDrawList* list);
// ImGuiListClipper
CIMGUI_API void ImGuiListClipper_Begin(struct ImGuiListClipper* clipper, int count, float items_height);
CIMGUI_API void ImGuiListClipper_End(struct ImGuiListClipper* clipper);
CIMGUI_API bool ImGuiListClipper_Step(struct ImGuiListClipper* clipper);
CIMGUI_API int ImGuiListClipper_GetDisplayStart(struct ImGuiListClipper* clipper);
CIMGUI_API int ImGuiListClipper_GetDisplayEnd(struct ImGuiListClipper* clipper);
// ImDrawData
CIMGUI_API void ImDrawData_DeIndexAllBuffers(struct ImDrawData* drawData);
CIMGUI_API void ImDrawData_ScaleClipRects(struct ImDrawData* drawData, const struct ImVec2 sc);
// ImGuiTextFilter
CIMGUI_API void ImGuiTextFilter_Init(struct ImGuiTextFilter* filter, const char* default_filter);
CIMGUI_API void ImGuiTextFilter_Clear(struct ImGuiTextFilter* filter);
CIMGUI_API bool ImGuiTextFilter_Draw(struct ImGuiTextFilter* filter, const char* label, float width);
CIMGUI_API bool ImGuiTextFilter_PassFilter(struct ImGuiTextFilter* filter, const char* text, const char* text_end);
CIMGUI_API bool ImGuiTextFilter_IsActive(struct ImGuiTextFilter* filter);
CIMGUI_API void ImGuiTextFilter_Build(struct ImGuiTextFilter* filter);
// ImFontAtlas
CIMGUI_API void ImFontAtlas_GetTexDataAsRGBA32(struct ImFontAtlas* atlas, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel);
CIMGUI_API void ImFontAtlas_GetTexDataAsAlpha8(struct ImFontAtlas* atlas, unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel);
CIMGUI_API void ImFontAtlas_SetTexID(struct ImFontAtlas* atlas, ImTextureID id);
CIMGUI_API struct ImFont* ImFontAtlas_AddFont(struct ImFontAtlas* atlas, CONST struct ImFontConfig* font_cfg);
CIMGUI_API struct ImFont* ImFontAtlas_AddFontDefault(struct ImFontAtlas* atlas, CONST struct ImFontConfig* font_cfg);
CIMGUI_API struct ImFont* ImFontAtlas_AddFontFromFileTTF(struct ImFontAtlas* atlas, CONST char* filename, float size_pixels, CONST struct ImFontConfig* font_cfg, CONST ImWchar* glyph_ranges);
CIMGUI_API struct ImFont* ImFontAtlas_AddFontFromMemoryTTF(struct ImFontAtlas* atlas, void* font_data, int font_size, float size_pixels, CONST struct ImFontConfig* font_cfg, CONST ImWchar* glyph_ranges);
CIMGUI_API struct ImFont* ImFontAtlas_AddFontFromMemoryCompressedTTF(struct ImFontAtlas* atlas, CONST void* compressed_font_data, int compressed_font_size, float size_pixels, CONST struct ImFontConfig* font_cfg, CONST ImWchar* glyph_ranges);
CIMGUI_API struct ImFont* ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(struct ImFontAtlas* atlas, CONST char* compressed_font_data_base85, float size_pixels, CONST struct ImFontConfig* font_cfg, CONST ImWchar* glyph_ranges);
CIMGUI_API void ImFontAtlas_ClearTexData(struct ImFontAtlas* atlas);
CIMGUI_API void ImFontAtlas_Clear(struct ImFontAtlas* atlas);
CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesDefault(struct ImFontAtlas* atlas);
CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesKorean(struct ImFontAtlas* atlas);
CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesJapanese(struct ImFontAtlas* atlas);
CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesChinese(struct ImFontAtlas* atlas);
CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesCyrillic(struct ImFontAtlas* atlas);
CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesThai(struct ImFontAtlas* atlas);
// ImGuiTextEditCallbackData
CIMGUI_API void ImGuiTextEditCallbackData_DeleteChars(struct ImGuiTextEditCallbackData* data, int pos, int bytes_count);
CIMGUI_API void ImGuiTextEditCallbackData_InsertChars(struct ImGuiTextEditCallbackData* data, int pos, const char* text, const char* text_end);
CIMGUI_API bool ImGuiTextEditCallbackData_HasSelection(struct ImGuiTextEditCallbackData* data);
CIMGUI_API ImTextureID ImFontAtlas_GetTexID(struct ImFontAtlas* atlas);
CIMGUI_API unsigned char* ImFontAtlas_GetTexPixelsAlpha8(struct ImFontAtlas* atlas);
CIMGUI_API unsigned int* ImFontAtlas_GetTexPixelsRGBA32(struct ImFontAtlas* atlas);
CIMGUI_API int ImFontAtlas_GetTexWidth(struct ImFontAtlas* atlas);
CIMGUI_API int ImFontAtlas_GetTexHeight(struct ImFontAtlas* atlas);
CIMGUI_API int ImFontAtlas_GetTexDesiredWidth(struct ImFontAtlas* atlas);
CIMGUI_API void ImFontAtlas_SetTexDesiredWidth(struct ImFontAtlas* atlas, int TexDesiredWidth_);
CIMGUI_API int ImFontAtlas_GetTexGlyphPadding(struct ImFontAtlas* atlas);
CIMGUI_API void ImFontAtlas_SetTexGlyphPadding(struct ImFontAtlas* atlas, int TexGlyphPadding_);
CIMGUI_API void ImFontAtlas_GetTexUvWhitePixel(struct ImFontAtlas* atlas, ImVec2* pOut);
// ImGuiStorage
CIMGUI_API void ImGuiStorage_Init(struct ImGuiStorage* storage);
CIMGUI_API void ImGuiStorage_Clear(struct ImGuiStorage* storage);
CIMGUI_API int ImGuiStorage_GetInt(struct ImGuiStorage* storage, ImGuiID key, int default_val);
CIMGUI_API void ImGuiStorage_SetInt(struct ImGuiStorage* storage, ImGuiID key, int val);
CIMGUI_API bool ImGuiStorage_GetBool(struct ImGuiStorage* storage, ImGuiID key, bool default_val);
CIMGUI_API void ImGuiStorage_SetBool(struct ImGuiStorage* storage, ImGuiID key, bool val);
CIMGUI_API float ImGuiStorage_GetFloat(struct ImGuiStorage* storage, ImGuiID key, float default_val);
CIMGUI_API void ImGuiStorage_SetFloat(struct ImGuiStorage* storage, ImGuiID key, float val);
CIMGUI_API void* ImGuiStorage_GetVoidPtr(struct ImGuiStorage* storage, ImGuiID key);
CIMGUI_API void ImGuiStorage_SetVoidPtr(struct ImGuiStorage* storage, ImGuiID key, void* val);
CIMGUI_API int* ImGuiStorage_GetIntRef(struct ImGuiStorage* storage, ImGuiID key, int default_val);
CIMGUI_API bool* ImGuiStorage_GetBoolRef(struct ImGuiStorage* storage, ImGuiID key, bool default_val);
CIMGUI_API float* ImGuiStorage_GetFloatRef(struct ImGuiStorage* storage, ImGuiID key, float default_val);
CIMGUI_API void** ImGuiStorage_GetVoidPtrRef(struct ImGuiStorage* storage, ImGuiID key, void* default_val);
CIMGUI_API void ImGuiStorage_SetAllInt(struct ImGuiStorage* storage, int val);
// ImFontAtlas::Fonts;
CIMGUI_API int ImFontAtlas_Fonts_size(struct ImFontAtlas* atlas);
CIMGUI_API ImFont* ImFontAtlas_Fonts_index(struct ImFontAtlas* atlas, int index);
// ImFont
CIMGUI_API float ImFont_GetFontSize(const struct ImFont* font);
CIMGUI_API void ImFont_SetFontSize(struct ImFont* font, float FontSize_);
CIMGUI_API float ImFont_GetScale(const struct ImFont* font);
CIMGUI_API void ImFont_SetScale(struct ImFont* font, float Scale_);
CIMGUI_API void ImFont_GetDisplayOffset(const struct ImFont* font, ImVec2* pOut);
CIMGUI_API const struct ImFont::Glyph* ImFont_GetFallbackGlyph(const struct ImFont* font);
CIMGUI_API void ImFont_SetFallbackGlyph(struct ImFont* font, const struct ImFont::Glyph* FallbackGlyph_);
CIMGUI_API float ImFont_GetFallbackXAdvance(const struct ImFont* font);
CIMGUI_API ImWchar ImFont_GetFallbackChar(const struct ImFont* font);
CIMGUI_API short ImFont_GetConfigDataCount(const struct ImFont* font);
CIMGUI_API struct ImFontConfig* ImFont_GetConfigData(struct ImFont* font);
CIMGUI_API struct ImFontAtlas* ImFont_GetContainerAtlas(struct ImFont* font);
CIMGUI_API float ImFont_GetAscent(const struct ImFont* font);
CIMGUI_API float ImFont_GetDescent(const struct ImFont* font);
CIMGUI_API int ImFont_GetMetricsTotalSurface(const struct ImFont* font);
CIMGUI_API void ImFont_Clear(struct ImFont* font);
CIMGUI_API void ImFont_BuildLookupTable(struct ImFont* font);
CIMGUI_API const struct ImFont::Glyph* ImFont_FindGlyph(const struct ImFont* font, ImWchar c);
CIMGUI_API void ImFont_SetFallbackChar(struct ImFont* font, ImWchar c);
CIMGUI_API float ImFont_GetCharAdvance(const struct ImFont* font, ImWchar c);
CIMGUI_API bool ImFont_IsLoaded(const struct ImFont* font);
CIMGUI_API void ImFont_CalcTextSizeA(const struct ImFont* font, ImVec2* pOut, float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL); // utf8
CIMGUI_API const char* ImFont_CalcWordWrapPositionA(const struct ImFont* font, float scale, const char* text, const char* text_end, float wrap_width);
CIMGUI_API void ImFont_RenderChar(const struct ImFont* font, ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, unsigned short c);
CIMGUI_API void ImFont_RenderText(const struct ImFont* font, ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4* clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false);
// ImFont::Glyph
CIMGUI_API int ImFont_Glyphs_size(const struct ImFont* font);
CIMGUI_API struct ImFont::Glyph* ImFont_Glyphs_index(struct ImFont* font, int index);
// ImFont::IndexXAdvance
CIMGUI_API int ImFont_IndexXAdvance_size(const struct ImFont* font);
CIMGUI_API float ImFont_IndexXAdvance_index(const struct ImFont* font, int index);
// ImFont::IndexLookup
CIMGUI_API int ImFont_IndexLookup_size(const struct ImFont* font);
CIMGUI_API unsigned short ImFont_IndexLookup_index(const struct ImFont* font, int index);

View File

@@ -2,6 +2,16 @@
#include "../imgui/imgui.h"
#include "cimgui.h"
CIMGUI_API void ImDrawData_DeIndexAllBuffers(ImDrawData* drawData)
{
return drawData->DeIndexAllBuffers();
}
CIMGUI_API void ImDrawData_ScaleClipRects(ImDrawData* drawData, const struct ImVec2 sc)
{
return drawData->ScaleClipRects(sc);
}
CIMGUI_API int ImDrawList_GetVertexBufferSize(ImDrawList* list)
{
return list->VtxBuffer.size();
@@ -32,16 +42,6 @@ CIMGUI_API ImDrawCmd* ImDrawList_GetCmdPtr(ImDrawList* list, int n)
return &list->CmdBuffer[n];
}
CIMGUI_API void ImDrawData_DeIndexAllBuffers(ImDrawData* drawData)
{
return drawData->DeIndexAllBuffers();
}
CIMGUI_API void ImDrawData_ScaleClipRects(ImDrawData* drawData, struct ImVec2 sc)
{
return drawData->ScaleClipRects(sc);
}
CIMGUI_API void ImDrawList_Clear(ImDrawList* list)
{
return list->Clear();

View File

@@ -2,11 +2,6 @@
#include "../imgui/imgui.h"
#include "cimgui.h"
CIMGUI_API void ImFontConfig_DefaultConstructor(ImFontConfig* config)
{
*config = ImFontConfig();
}
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);
@@ -57,6 +52,16 @@ CIMGUI_API void ImFontAtlas_ClearTexData(ImFontAtlas* atlas)
return atlas->ClearTexData();
}
CIMGUI_API void ImFontAtlas_ClearInputData(ImFontAtlas* atlas)
{
return atlas->ClearInputData();
}
CIMGUI_API void ImFontAtlas_ClearFonts(ImFontAtlas* atlas)
{
return atlas->ClearFonts();
}
CIMGUI_API void ImFontAtlas_Clear(ImFontAtlas* atlas)
{
return atlas->Clear();
@@ -91,3 +96,223 @@ CIMGUI_API CONST ImWchar* ImFontAtlas_GetGlyphRangesThai(struct ImFontAtlas* a
{
return atlas->GetGlyphRangesThai();
}
CIMGUI_API ImTextureID ImFontAtlas_GetTexID(struct ImFontAtlas* atlas)
{
return atlas->TexID;
}
CIMGUI_API unsigned char* ImFontAtlas_GetTexPixelsAlpha8(struct ImFontAtlas* atlas)
{
return atlas->TexPixelsAlpha8;
}
CIMGUI_API unsigned int* ImFontAtlas_GetTexPixelsRGBA32(struct ImFontAtlas* atlas)
{
return atlas->TexPixelsRGBA32;
}
CIMGUI_API int ImFontAtlas_GetTexWidth(struct ImFontAtlas* atlas)
{
return atlas->TexWidth;
}
CIMGUI_API int ImFontAtlas_GetTexHeight(struct ImFontAtlas* atlas)
{
return atlas->TexHeight;
}
CIMGUI_API int ImFontAtlas_GetTexDesiredWidth(struct ImFontAtlas* atlas)
{
return atlas->TexDesiredWidth;
}
CIMGUI_API void ImFontAtlas_SetTexDesiredWidth(struct ImFontAtlas* atlas, int TexDesiredWidth_)
{
atlas->TexDesiredWidth = TexDesiredWidth_;
}
CIMGUI_API int ImFontAtlas_GetTexGlyphPadding(struct ImFontAtlas* atlas)
{
return atlas->TexGlyphPadding;
}
CIMGUI_API void ImFontAtlas_SetTexGlyphPadding(struct ImFontAtlas* atlas, int TexGlyphPadding_)
{
atlas->TexGlyphPadding = TexGlyphPadding_;
}
CIMGUI_API void ImFontAtlas_GetTexUvWhitePixel(struct ImFontAtlas* atlas, ImVec2* pOut)
{
*pOut = atlas->TexUvWhitePixel;
}
// ImFontAtlas::Fonts;
CIMGUI_API int ImFontAtlas_Fonts_size(struct ImFontAtlas* atlas)
{
return atlas->Fonts.size();
}
CIMGUI_API ImFont* ImFontAtlas_Fonts_index(struct ImFontAtlas* atlas, int index)
{
return atlas->Fonts[index];
}
// ImFont
CIMGUI_API float ImFont_GetFontSize(const struct ImFont* font)
{
return font->FontSize;
}
CIMGUI_API void ImFont_SetFontSize(struct ImFont* font, float FontSize_)
{
font->FontSize = FontSize_;
}
CIMGUI_API float ImFont_GetScale(const struct ImFont* font)
{
return font->Scale;
}
CIMGUI_API void ImFont_SetScale(struct ImFont* font, float Scale_)
{
font->Scale = Scale_;
}
CIMGUI_API void ImFont_GetDisplayOffset(const struct ImFont* font, ImVec2* pOut)
{
*pOut = font->DisplayOffset;
}
CIMGUI_API const struct ImFont::Glyph* ImFont_GetFallbackGlyph(const struct ImFont* font)
{
return font->FallbackGlyph;
}
CIMGUI_API void ImFont_SetFallbackGlyph(struct ImFont* font, const struct ImFont::Glyph* FallbackGlyph_)
{
font->FallbackGlyph = FallbackGlyph_;
}
CIMGUI_API float ImFont_GetFallbackXAdvance(const struct ImFont* font)
{
return font->FallbackXAdvance;
}
CIMGUI_API ImWchar ImFont_GetFallbackChar(const struct ImFont* font)
{
return font->FallbackChar;
}
CIMGUI_API short ImFont_GetConfigDataCount(const struct ImFont* font)
{
return font->ConfigDataCount;
}
CIMGUI_API struct ImFontConfig* ImFont_GetConfigData(struct ImFont* font)
{
return font->ConfigData;
}
CIMGUI_API struct ImFontAtlas* ImFont_GetContainerAtlas(struct ImFont* font)
{
return font->ContainerAtlas;
}
CIMGUI_API float ImFont_GetAscent(const struct ImFont* font)
{
return font->Ascent;
}
CIMGUI_API float ImFont_GetDescent(const struct ImFont* font)
{
return font->Descent;
}
CIMGUI_API int ImFont_GetMetricsTotalSurface(const struct ImFont* font)
{
return font->MetricsTotalSurface;
}
CIMGUI_API void ImFont_Clear(struct ImFont* font)
{
font->Clear();
}
CIMGUI_API void ImFont_BuildLookupTable(struct ImFont* font)
{
font->BuildLookupTable();
}
CIMGUI_API const struct ImFont::Glyph* ImFont_FindGlyph(const struct ImFont* font, ImWchar c)
{
return font->FindGlyph(c);
}
CIMGUI_API void ImFont_SetFallbackChar(struct ImFont* font, ImWchar c)
{
font->SetFallbackChar(c);
}
CIMGUI_API float ImFont_GetCharAdvance(const struct ImFont* font, ImWchar c)
{
return font->GetCharAdvance(c);
}
CIMGUI_API bool ImFont_IsLoaded(const struct ImFont* font)
{
return font->IsLoaded();
}
CIMGUI_API void ImFont_CalcTextSizeA(const struct ImFont* font, ImVec2* pOut, float size, float max_width, float wrap_width, const char* text_begin, const char* text_end, const char** remaining)
{
*pOut = font->CalcTextSizeA(size, max_width, wrap_width, text_begin, text_end, remaining);
}
CIMGUI_API const char* ImFont_CalcWordWrapPositionA(const struct ImFont* font, float scale, const char* text, const char* text_end, float wrap_width)
{
return font->CalcWordWrapPositionA(scale, text, text_end, wrap_width);
}
CIMGUI_API void ImFont_RenderChar(const struct ImFont* font, ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, unsigned short c)
{
return font->RenderChar(draw_list, size, pos, col, c);
}
CIMGUI_API void ImFont_RenderText(const struct ImFont* font, ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4* clip_rect, const char* text_begin, const char* text_end, float wrap_width, bool cpu_fine_clip)
{
return font->RenderText(draw_list, size, pos, col, *clip_rect, text_begin, text_end, wrap_width, cpu_fine_clip);
}
// ImFont::Glyph
CIMGUI_API int ImFont_Glyphs_size(const struct ImFont* font)
{
return font->Glyphs.size();
}
CIMGUI_API struct ImFont::Glyph* ImFont_Glyphs_index(struct ImFont* font, int index)
{
return &font->Glyphs[index];
}
// ImFont::IndexXAdvance
CIMGUI_API int ImFont_IndexXAdvance_size(const struct ImFont* font)
{
return font->IndexXAdvance.size();
}
CIMGUI_API float ImFont_IndexXAdvance_index(const struct ImFont* font, int index)
{
return font->IndexXAdvance[index];
}
// ImFont::IndexLookup
CIMGUI_API int ImFont_IndexLookup_size(const struct ImFont* font)
{
return font->IndexLookup.size();
}
CIMGUI_API unsigned short ImFont_IndexLookup_index(const struct ImFont* font, int index)
{
return font->IndexLookup[index];
}