ImGuiNET / ImGui.NET

An ImGui wrapper for .NET.
MIT License
1.87k stars 304 forks source link

Can we get a wiki page or something for how to get a minimum working start project? #404

Open se5a opened 1 year ago

se5a commented 1 year ago

Whenever I want to try get a simple project started quickly I end up either going around in circles trying to get it working, or copy pasta/cargo culting in a whole bunch of extraneous stuff just to get something working, and it just looks messy and bloated. My last attempt at something bare bones just crashes/exits without error when ImGui.Text is called. Followed that down into the internals a bit more to ImGuiNative.igText(numPtr); but got no further that.

Something along the lines of: a list of nuget packages a chunk of code or Program.cs to set it up.

with a small section of extra stuff you might want. (i.e. implot)

I realize there's a couple of ways to do this depending on what render you're wanting to use, but that shouldn't complicate stuff too much I don't think.

zaafar commented 1 year ago

https://github.com/ImGuiNET/ImGui.NET/tree/master/src/ImGui.NET.SampleProgram is not enough?

se5a commented 1 year ago

not really, there's six other projects in that, which is fine if you're wanting to futz around with imgui.net project itself, but not so great if you just want to get something bare bones working for a project.

zaafar commented 1 year ago

I don't think, so other 6 projects actually work at this point in time. The only working one is imgui.net

NoahStolk commented 1 year ago

For what it's worth, Silk.NET has a pretty minimal demo program that (indirectly) uses ImGui.NET, but of course it also relies on various Silk.NET dependencies.

https://github.com/dotnet/Silk.NET/tree/main/examples/CSharp/OpenGL%20Demos/ImGui

They have their own ImGui extensions library that relies on ImGui.NET. I found it to be pretty useful. If you're trying to set something up from scratch, I recommend looking into their ImGuiController: https://github.com/dotnet/Silk.NET/blob/main/src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.ImGui/ImGuiController.cs

But of course it's pretty much the same thing as the ImGuiController in the ImGui.NET sample, except it relies on Silk.NET instead of Veldrid.

zaafar commented 1 year ago

there are also controllers that rely on just win32/directX API (via vortice lib (https://github.com/amerkoleci)) https://github.com/zaafar/ClickableTransparentOverlay/blob/master/ClickableTransparentOverlay/ImGuiRenderer.cs (old version: https://github.com/YaakovDavis/VorticeImGui)

but yeah they only show you how imgui works in C#.....imgui extensions (implot, etc) in C# is kind of broken/not-updated.

se5a commented 1 year ago

Why can't we have instructions for doing it ourselfs? I want to start from zero and add stuff, not start from bloat and remove stuff.

zaafar commented 1 year ago

I want to start from zero and add stuff, not start from bloat and remove stuff.

Define zero? I think your definition of zero is very different from (users of this library) definition of zero.

se5a commented 1 year ago

I think my op and following comments make it clear what I'm asking for.

zaafar commented 1 year ago

I think my op and following comments make it clear what I'm asking for.

Actually it does not, what backend you want in that wiki? Imgui doesn't work without a backend, so what does ZERO mean over here? Does it mean with or without backend?

FYI: Following are the list of backends imgui supports. https://github.com/ocornut/imgui/tree/master/backends

Imgui doesn't work without keyboard, mouse, controller input system, what input system you want in that wiki? There are 1000s of configuration that be different when using imgui so which configuration should be considered ZERO and included in the wiki? imgui works with android, windows machine, macbook, so in your "non bloat" idea should we include Windows machine, android machine or both?

se5a commented 1 year ago

I really feel like I'm being deliberately misunderstood and dismissed here.

I challenge you to open visual studio/code/rider or whatever your editor of choice is, create a new project and figure out exactly what nuget packages you need, drop in the code from the SampleProgram and get it working.

If I understand correctly, veldrid libraries handle most of the backend stuff, use those. and/or use openGL just for the cross platform ability.

Better yet, get someone who's proficient with C# but never used imgui.net before and watch them do it.

bootzin commented 1 year ago

Se5a, you're not being misunderstood. You're failing to understand. Let me try to explain: ImGui is a immediate Gui library. ImGui.Net is a dot net wrapper for that. Imgui (and therefore imgui.net) has no way of opening windows, nor drawing shapes to the screen. It doesn't know rendering, it simply allows for structured creation of a GUI. If you want to manage windows, you need a separate library for that. If you wanna render fonts, you need a dedicated graphics library for that. ImGui does not support that by default It doesn't have sdl2 as a dependency, nor does it have opengl as a dependency. You can use whatever you want So there is no MVP with ImGui.Net alone. Conversely, there's no required dependencies either. If you wanna do a barebones project, you absolutely need to understand at least one of the samples. You don't need to use it in your project, but you need to understand what it's doing, how it's doing, and how to adapt it to your own project. This is not a math library that you can just drop in any project. You need to study and experiment with it. And, for the record, before I tried anything with ImGui, I was a proficient C# developer. And yes, it was challenging as hell, but what's provided in the samples is more than enough to get you going, all you need is to be willing to learn, and not copy paste everything. Lastly: a window manager library, an input managing library (sdl2 does both) and a graphics rendering library should be everything you need to get started with ImGui. Check the original repo (in cpp). It's not hard to adapt, and you'll see they'll have a lot of examples, for a plethora of different window managers and graphics libraries. Study, learn, and one day, you'll see we were right, afterall

DarthPointer commented 11 months ago

I agree that this project really needs an introduction on what to add to make the library work.

Requiring the users to find themselves out what to include is just unreasonable. End-users of UI frameworks are those who design user UI apps, not necessarily familiar with all the layers of app rendering pipeline. Having these template projects is not enough. They really combine together few things that are unnecessary detail to people trying the framework out for the first time to see if its approach fits them. Reading these on plain github repo view page is not much helpful and downloading them from the repo to read with an IDE is a frustrating way to learn something.

I don't say the entire library should be graspable within 10 minutes. If it does some crazy shit under the hood with lots of specific detail for fine tune then no one could understand it in these 10 minutes. But an entry level tutorial to start using the product is crucial. You won't get large userbase if everybody entering will be met with the 10-metre high brickwall of undocumented sample projects. If you want people to enjoy your product you must tell them how to get first experience with the product, not the poor exception traces. I may not assume the reason for the people behind ImGUI.Net to create and support it. But if they want to make something great and share it with people, pretending the current non-existence of tutorial is fine is plain hypocrisy. The tools and libraries you used to create this wrap had their documentation and abstractions good enough to let you focus on the port, not finding out the ways how to implement CPU and GPU-specific optimizations, hadn't they?

I have no doubt that it took great effort to make the original DearGUI work and this .Net wrap run, but it is embarassing how low grade the entry level experience is when working with it for the first time. Thousands of hours spent are suffering extreme loss of value because no one made a get-and-run page which could take no more than 10 hours to write. So that people could at least see that the library works and they would start learning it before sinking their own hours into selecting lower levels of their app. Which may be completely irrelevant for small applications where UI performance and other lib differences won't be noticeable.

Edit: the fact that you seem to have to build parts of library with native lib sources is atrocious. It takes just too many things to remember and do to get the first app running that making a mistake in one place will result in hours wasted to localize the problem. Excuse me, this is 2023, not 1980's.

bootzin commented 11 months ago

because no one made a get-and-run page which could take no more than 10 hours to write

Listen, if you're so keen on having this sort of documentation, you are very welcome to contribute to the repo. Take a moment to learn it as it is and write about your findings along the way. Then compile those findings in a document and submit a PR. Everyone would appreciate the initiative.

DarthPointer commented 11 months ago

Yeah taking a "moment" to learn means I will need to dedicate a full day or few to first learn, then write a guide and then check that I didn't miss something in the process.

The amount of time it would take anyone new to make such a guide is way more than for someone who has experience with it and has already created projects that use it. I found it out that for me it is too time-demanding and unreasonable to relearn from the available "documentation" to bother with this library. Why should I bother pointing out X if it has already been done by others? This is past for breaking point for me to get the thing working. It makes me ask questions about the creators being interested in maintaining and supporting the product. About having a chance to get help if I encounter an issue.

I do respect the effort to build a wheel, but it sinks in futility if everyone else is forced to reinvent it anyway.

zaafar commented 11 months ago

I am going to lock this issue now, if anyone has some time to do this, feel free to create a PR.

This should be a good first issue to solve. :)