extrawurst / DerelictImgui

Dynamic bindings to the cimgui library (a c-api for IMGUI) for the D programming language
MIT License
54 stars 13 forks source link

supporting imgui_demo.d #12

Closed yosikawa closed 6 years ago

yosikawa commented 7 years ago

Hello,

I'm working to support imgui_demo.d, D-lang version of imgui_demo.cpp. It will show how to use DerelictImgui and demonstrate it works fine. I need some arrange and bug fix of cimgui as well. It will become available soon and let me contribute the code.

Regards, Aki.

extrawurst commented 7 years ago

sure go ahead! looking forward

yosikawa commented 6 years ago

Hello,

It seems that my proposal is difficult to be accepted. Provably it's better to open my own project as an forked project of this?

I also planning to add another API which is suitable for D-lang. Usually Derelict series of library is simple binding for DLL. But it is sometimes not suitable to use with D-lang because ImGui is designed for C++.

For example, this is igInputFloat3 function provided by cimgui. alias da_igInputFloat3 = bool function(const char* label, ref float[3] v, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);

and this is one of it's usage. static float[4] vec4a = [ 0.10f, 0.20f, 0.30f, 0.44f ]; igInputFloat3("input float3", vec4a[0..3]);

Here, igInputFloat3 wont accept vec4a because it does not match with ref float[3]. I like to provide thin wrapper for D-lang that support following call for example. digInputFloat!3("input float3", vec4a);

Other example is igText: alias da_igText = void function(const char* fmt, ...);

It calls C's formatting function. And it expects Zero-terminated string. It's much better to provide D-lang version of igText that accepts D's formatting arguments. void digText(Char, Args...)(in Char[] fmt, Args args) if (isSomeChar!Char);

I think I will open another project. How do you think? Do you mind if I state it is forked project of DerelictImgui by Extrawurst?

Regards, Aki.

extrawurst commented 6 years ago

sorry it went unnoticed, cause it did not mention the issue.

i merged it now: https://github.com/Extrawurst/DerelictImgui/pull/13

thanks for the help!