Skip to content

Commit 893d6a8

Browse files
committed
move module cimgui to imgui
ci: undo betterC on wasm32-target
1 parent 8dd51e4 commit 893d6a8

File tree

7 files changed

+165
-72
lines changed

7 files changed

+165
-72
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ jobs:
5555
- name: (Zig) Build Native
5656
run: zig build -Dimgui --summary all
5757
- name: (Zig + emsdk) Build Wasm
58-
run: zig build -Dimgui -DzigCC --summary all -Dtarget=wasm32-emscripten-none -Doptimize=ReleaseSmall -DbetterC
58+
run: zig build -Dimgui -DzigCC --summary all -Dtarget=wasm32-emscripten-none -Doptimize=ReleaseSmall

build.zig

+8-8
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,17 @@ pub fn buildLibSokol(b: *Build, options: LibSokolOptions) !*CompileStep {
193193
.file = b.path(csrc_root ++ "sokol_imgui.c"),
194194
.flags = cflags,
195195
});
196-
const cimgui = try buildImgui(b, .{
196+
const imgui = try buildImgui(b, .{
197197
.target = options.target,
198198
.optimize = options.optimize,
199199
.emsdk = options.emsdk,
200200
.use_tsan = lib.root_module.sanitize_thread orelse false,
201201
.use_ubsan = lib.root_module.sanitize_c orelse false,
202202
});
203-
for (cimgui.root_module.include_dirs.items) |dir| {
203+
for (imgui.root_module.include_dirs.items) |dir| {
204204
try lib.root_module.include_dirs.append(b.allocator, dir);
205205
}
206-
lib.linkLibrary(cimgui);
206+
lib.linkLibrary(imgui);
207207
}
208208
return lib;
209209
}
@@ -422,7 +422,7 @@ pub fn ldcBuildStep(b: *Build, options: DCompileStep) !*std.Build.Step.InstallDi
422422
"-i=sokol",
423423
"-i=shaders",
424424
"-i=handmade",
425-
"-i=cimgui",
425+
"-i=imgui",
426426
});
427427

428428
// sokol include path
@@ -1149,8 +1149,8 @@ fn buildImgui(b: *Build, options: libImGuiOptions) !*CompileStep {
11491149
libimgui.root_module.sanitize_thread = options.use_tsan;
11501150

11511151
if (b.lazyDependency("imgui", .{})) |dep| {
1152-
const cimgui = dep.path(imguiver_path);
1153-
libimgui.addIncludePath(cimgui);
1152+
const imgui = dep.path(imguiver_path);
1153+
libimgui.addIncludePath(imgui);
11541154

11551155
if (options.emsdk) |emsdk| {
11561156
if (libimgui.rootModuleTarget().isWasm()) {
@@ -1168,13 +1168,13 @@ fn buildImgui(b: *Build, options: libImGuiOptions) !*CompileStep {
11681168
}
11691169
}
11701170
libimgui.addCSourceFiles(.{
1171-
.root = cimgui,
1171+
.root = imgui,
11721172
.files = &.{
11731173
"cimgui.cpp",
11741174
},
11751175
});
11761176
libimgui.addCSourceFiles(.{
1177-
.root = cimgui,
1177+
.root = imgui,
11781178
.files = &.{
11791179
"imgui.cpp",
11801180
"imgui_draw.cpp",

dub.sdl

+20-20
Large diffs are not rendered by default.

src/examples/droptest.d

+9-9
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import sg = sokol.gfx;
1111
import sgapp = sokol.glue;
1212
import sapp = sokol.app;
1313
import sfetch = sokol.fetch;
14-
import imgui = sokol.imgui;
14+
import simgui = sokol.imgui;
1515
import log = sokol.log;
16-
import cimgui.cimgui;
16+
import imgui;
1717

1818
enum MAX_FILE_SIZE = 1024 * 1024;
1919

@@ -41,8 +41,8 @@ extern (C) void init() @safe @nogc nothrow
4141
logger: {func: &log.slog_func}
4242
};
4343
sg.setup(gfx);
44-
imgui.Desc imgui_desc = {0};
45-
imgui.setup(imgui_desc);
44+
simgui.Desc imgui_desc = {0};
45+
simgui.setup(imgui_desc);
4646

4747
// ifndef emscripten
4848
// dfmt off
@@ -66,14 +66,14 @@ extern (C) void frame() @trusted
6666
{
6767
sfetch.dowork;
6868
}
69-
imgui.FrameDesc imgui_desc = {
69+
simgui.FrameDesc imgui_desc = {
7070
width: sapp.width(),
7171
height: sapp.height(),
7272
delta_time: sapp.frameDuration(),
7373
dpi_scale: sapp.dpiScale(),
7474
};
7575
// dfmt on
76-
imgui.newFrame(imgui_desc);
76+
simgui.newFrame(imgui_desc);
7777

7878
// /*=== UI CODE STARTS HERE ===*/
7979
const ImVec2 window_pos = {10, 10};
@@ -105,14 +105,14 @@ extern (C) void frame() @trusted
105105

106106
sg.Pass pass = {swapchain: sgapp.swapchain};
107107
sg.beginPass(pass);
108-
imgui.render;
108+
simgui.render;
109109
sg.endPass;
110110
sg.commit;
111111
}
112112

113113
extern (C) void event(const(sapp.Event)* ev) @trusted @nogc nothrow
114114
{
115-
imgui.simgui_handle_event(ev);
115+
simgui.simgui_handle_event(ev);
116116
if (ev.type == sapp.EventType.Files_dropped)
117117
{
118118
version (Emscripten)
@@ -146,7 +146,7 @@ extern (C) void cleanup() @safe @nogc nothrow
146146
sfetch.shutdown;
147147
}
148148
// dfmt on
149-
imgui.shutdown;
149+
simgui.shutdown;
150150
sg.shutdown;
151151
}
152152

src/examples/imgui.d

+9-9
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ private:
1111
import sg = sokol.gfx;
1212
import sgapp = sokol.glue;
1313
import sapp = sokol.app;
14-
import imgui = sokol.imgui;
14+
import simgui = sokol.imgui;
1515
import log = sokol.log;
16-
import cimgui.cimgui;
16+
import imgui;
1717

1818
extern (C):
1919
@safe:
@@ -39,19 +39,19 @@ void init() nothrow
3939
logger: {func: &log.slog_func}
4040
};
4141
sg.setup(gfx);
42-
imgui.Desc imgui_desc = {0};
43-
imgui.setup(imgui_desc);
42+
simgui.Desc imgui_desc = {0};
43+
simgui.setup(imgui_desc);
4444
}
4545

4646
void frame() @trusted
4747
{
48-
imgui.FrameDesc imgui_desc = {
48+
simgui.FrameDesc imgui_desc = {
4949
width: sapp.width(),
5050
height: sapp.height(),
5151
delta_time: sapp.frameDuration(),
5252
dpi_scale: sapp.dpiScale(),
5353
};
54-
imgui.newFrame(imgui_desc);
54+
simgui.newFrame(imgui_desc);
5555

5656
/*=== UI CODE STARTS HERE ===*/
5757
const ImVec2 window_pos = {10, 10};
@@ -71,19 +71,19 @@ void frame() @trusted
7171

7272
sg.Pass pass = {action: state.pass_action, swapchain: sgapp.swapchain};
7373
sg.beginPass(pass);
74-
imgui.render;
74+
simgui.render;
7575
sg.endPass;
7676
sg.commit;
7777
}
7878

7979
void event(const(sapp.Event)* ev) @trusted nothrow
8080
{
81-
imgui.simgui_handle_event(ev);
81+
simgui.simgui_handle_event(ev);
8282
}
8383

8484
void cleanup() @safe nothrow
8585
{
86-
imgui.shutdown;
86+
simgui.shutdown;
8787
sg.shutdown;
8888
}
8989

src/cimgui/dcimgui.c src/imgui/dcimgui.c

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// Use importC to import the C header files.
2-
32
#ifndef DCIMGUI_H
43
#define DCIMGUI_H
54
#pragma attribute(push, nogc, nothrow) // dmd-2.110.x feature

0 commit comments

Comments
 (0)