aybe / DearImGui

imgui & implot for .NET & OpenTK
MIT License
42 stars 3 forks source link

Is there an example of InputText? #25

Open PrimeraTech opened 7 months ago

PrimeraTech commented 7 months ago

I have been trying by trial and error to get C# to be happy with my syntax for ImGui.InputText ().

Can anyone provide a single example that will compile and work?

The function prototype is: public static bool InputText(string label, char* buf, UIntPtr buf_size, ImGuiInputTextFlags flags = (ImGuiInputTextFlags)(0), ImGuiInputTextCallback callback = null, IntPtr user_data = default)

How is a char * variable defined in c# to be compatible with the second parameter?

PrimeraTech commented 7 months ago

The following code compiles but does not work:

string foo = "this is a test"; unsafe { ImGui.InputText("xx", (char*)&foo, new UIntPtr(10)); }