Skip to content

Commit

Permalink
ci: run wasm32-target betterC mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kassane committed Jan 15, 2025
1 parent 2005c4e commit ac160f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ jobs:
- name: (Zig) Build Native
run: zig build -Dimgui --summary all
- name: (Zig + emsdk) Build Wasm
run: zig build -Dimgui -DzigCC --summary all -Dtarget=wasm32-emscripten-none -Doptimize=ReleaseSmall
run: zig build -Dimgui -DzigCC --summary all -Dtarget=wasm32-emscripten-none -Doptimize=ReleaseSmall -DbetterC
34 changes: 12 additions & 22 deletions src/cimgui/cimgui.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ module cimgui.cimgui;
// get dcimgui headers to module - @system (unsafe) functions by default
public import cimgui.dcimgui;

version (D_BetterC)
{
// No conflict with object.size_t (DRT)
}
else
{
// replace object.size_t to cimgui.dcimgui.size_t
version (Windows) alias size_t = ulong;
}

scope ImGuiContext_t* CreateContext(scope const(ImFontAtlas_t)* shared_font_atlas) @trusted
{
return igCreateContext(cast(ImFontAtlas_t*) shared_font_atlas);
Expand Down Expand Up @@ -2774,7 +2764,7 @@ void applyRequests(
ImGuiSelectionExternalStorage_ApplyRequests(self, ms_io);
}

size_t getTexID(scope const(ImDrawCmd_t)* self) @trusted
auto getTexID(scope const(ImDrawCmd_t)* self) @trusted
{
return ImDrawCmd_GetTexID(cast(ImDrawCmd_t*) self);
}
Expand Down Expand Up @@ -2819,7 +2809,7 @@ void popClipRect(scope const(ImDrawList_t)* self) @trusted
ImDrawList_PopClipRect(cast(ImDrawList_t*) self);
}

void pushTextureID(scope const(ImDrawList_t)* self, ulong texture_id) @trusted
void pushTextureID(scope const(ImDrawList_t)* self, size_t texture_id) @trusted
{
ImDrawList_PushTextureID(cast(ImDrawList_t*) self, texture_id);
}
Expand Down Expand Up @@ -3004,27 +2994,27 @@ void addConcavePolyFilled(scope ImDrawList_t* self, scope const(ImVec2_t)* point
ImDrawList_AddConcavePolyFilled(self, cast(ImVec2_t*) points, num_points, col);
}

void addImage(scope ImDrawList_t* self, ulong user_texture_id, const ImVec2_t p_min, const ImVec2_t p_max) @trusted
void addImage(scope ImDrawList_t* self, size_t user_texture_id, const ImVec2_t p_min, const ImVec2_t p_max) @trusted
{
ImDrawList_AddImage(self, user_texture_id, p_min, p_max);
}

void addImageEx(scope ImDrawList_t* self, ulong user_texture_id, const ImVec2_t p_min, const ImVec2_t p_max, const ImVec2_t uv_min, const ImVec2_t uv_max, uint col) @trusted
void addImageEx(scope ImDrawList_t* self, size_t user_texture_id, const ImVec2_t p_min, const ImVec2_t p_max, const ImVec2_t uv_min, const ImVec2_t uv_max, uint col) @trusted
{
ImDrawList_AddImageEx(self, user_texture_id, p_min, p_max, uv_min, uv_max, col);
}

void addImageQuad(scope ImDrawList_t* self, ulong user_texture_id, const ImVec2_t p1, const ImVec2_t p2, const ImVec2_t p3, const ImVec2_t p4) @trusted
void addImageQuad(scope ImDrawList_t* self, size_t user_texture_id, const ImVec2_t p1, const ImVec2_t p2, const ImVec2_t p3, const ImVec2_t p4) @trusted
{
ImDrawList_AddImageQuad(self, user_texture_id, p1, p2, p3, p4);
}

void addImageQuadEx(scope ImDrawList_t* self, ulong user_texture_id, const ImVec2_t p1, const ImVec2_t p2, const ImVec2_t p3, const ImVec2_t p4, const ImVec2_t uv1, const ImVec2_t uv2, const ImVec2_t uv3, const ImVec2_t uv4, uint col) @trusted
void addImageQuadEx(scope ImDrawList_t* self, size_t user_texture_id, const ImVec2_t p1, const ImVec2_t p2, const ImVec2_t p3, const ImVec2_t p4, const ImVec2_t uv1, const ImVec2_t uv2, const ImVec2_t uv3, const ImVec2_t uv4, uint col) @trusted
{
ImDrawList_AddImageQuadEx(self, user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
}

void addImageRounded(scope ImDrawList_t* self, ulong user_texture_id, const ImVec2_t p_min, const ImVec2_t p_max, const ImVec2_t uv_min, const ImVec2_t uv_max, uint col, float rounding, int flags) @trusted
void addImageRounded(scope ImDrawList_t* self, size_t user_texture_id, const ImVec2_t p_min, const ImVec2_t p_max, const ImVec2_t uv_min, const ImVec2_t uv_max, uint col, float rounding, int flags) @trusted
{
ImDrawList_AddImageRounded(self, user_texture_id, p_min, p_max, uv_min, uv_max, col, rounding, flags);
}
Expand Down Expand Up @@ -3101,7 +3091,7 @@ extern (C) void addCallback(scope ImDrawList_t* self, void function(scope const(
}

extern (C) void addCallbackEx(scope ImDrawList_t* self, void function(scope const(
ImDrawList_t)* parent_list, scope const(ImDrawCmd_t)* cmd) callback, scope void* userdata, ulong userdata_size) @trusted
ImDrawList_t)* parent_list, scope const(ImDrawCmd_t)* cmd) callback, scope void* userdata, size_t userdata_size) @trusted
{
ImDrawList_AddCallbackEx(self, callback, userdata, userdata_size);
}
Expand Down Expand Up @@ -3206,7 +3196,7 @@ void onChangedVtxOffset(scope ImDrawList_t* self) @trusted
ImDrawList__OnChangedVtxOffset(self);
}

void setTextureID(scope ImDrawList_t* self, ulong texture_id) @trusted
void setTextureID(scope ImDrawList_t* self, size_t texture_id) @trusted
{
ImDrawList__SetTextureID(self, texture_id);
}
Expand Down Expand Up @@ -3251,12 +3241,12 @@ void clearGlyphRangesBuilder(scope const(ImFontGlyphRangesBuilder_t)* self) @tru
ImFontGlyphRangesBuilder_Clear(cast(ImFontGlyphRangesBuilder_t*) self);
}

bool getBit(scope const(ImFontGlyphRangesBuilder_t)* self, ulong n) @trusted
bool getBit(scope const(ImFontGlyphRangesBuilder_t)* self, size_t n) @trusted
{
return ImFontGlyphRangesBuilder_GetBit(cast(ImFontGlyphRangesBuilder_t*) self, n);
}

void setBit(scope const(ImFontGlyphRangesBuilder_t)* self, ulong n) @trusted
void setBit(scope const(ImFontGlyphRangesBuilder_t)* self, size_t n) @trusted
{
ImFontGlyphRangesBuilder_SetBit(cast(ImFontGlyphRangesBuilder_t*) self, n);
}
Expand Down Expand Up @@ -3371,7 +3361,7 @@ bool isFontAtlasBuilt(scope const(ImFontAtlas_t)* self) @trusted
return ImFontAtlas_IsBuilt(cast(ImFontAtlas_t*) self);
}

void setTexID(scope const(ImFontAtlas_t)* self, ulong id) @trusted
void setTexID(scope const(ImFontAtlas_t)* self, size_t id) @trusted
{
ImFontAtlas_SetTexID(cast(ImFontAtlas_t*) self, id);
}
Expand Down

0 comments on commit ac160f3

Please sign in to comment.