Giter Club home page Giter Club logo

Comments (11)

mellinoe avatar mellinoe commented on May 18, 2024

Are you not able to simply call your structures "Vector2/3/4/" ? I expect that you could just add an extra .cs file to the project which defines the missing types. Is that not feasible?

from imgui.net.

dpethes avatar dpethes commented on May 18, 2024

The other way around? Sure, that would work. It means a bit more work when converting function declarations from c/imgui, but that's quite minor.

One more minor thing for now - I translated the ImGuiListClipper and I noticed that some structs and their native versions are kept in one file like DrawList + NativeDrawList (which I followed with the Clipper) and some are separated, like Style + NativeStyle. Which do you prefer / should I clean it up?

from imgui.net.

mellinoe avatar mellinoe commented on May 18, 2024

The other way around? Sure, that would work. It means a bit more work when converting function declarations from c/imgui, but that's quite minor.

I was thinking that you wouldn't need to make any changes to ImGuiNative at all, and you could just define your own structures in a different file. Or is the problem that you'd like to call them ImVec2/3/4? In theory we could add a conditional using statement at the top of the file, but that might get annoying.

Which do you prefer / should I clean it up?

I think I'd rather they be in the same file.

from imgui.net.

dpethes avatar dpethes commented on May 18, 2024

I was thinking that you wouldn't need to make any changes to ImGuiNative at all, and you could just define your own structures in a different file. Or is the problem that you'd like to call them ImVec2/3/4? In theory we could add a conditional using statement at the top of the file, but that might get annoying.

I defined my own Vector2/3/4 but I have to remove the using System.Numerics; line from every source where it's used as well. I can't think of any way to get rid of it (except using define/ifdef, which I don't like - any other ideas?). However it isn't that much pain after all, if I keep Vector name instead of ImVec.

from imgui.net.

mellinoe avatar mellinoe commented on May 18, 2024

There's a couple ways you could go about it, I think:

  • Add the #if's around each file. Kind of annoying that you have to put it in every file.
  • Define an internal dummy type in System.Numerics somewhere in your projects so the "using" statements are satisfied. Kind of "hacky", but hey it works.

Would you be interested in having your net40 configuration buildable from the main repo here? I would be happy to support an additional build configuration if there are only very small differences like this.

from imgui.net.

dpethes avatar dpethes commented on May 18, 2024

I like the second option!
The differences in imgui.net should be minimal - can't think of anything else besides Vectors. I'm aiming for usage with WinForms though, so the sample project is completely different. And it needs a software rasterizer as well, which isn't quite ready and mixing its development with imgui.net doesn't quite feel right.
Maybe after I'm mostly done with it?

from imgui.net.

dpethes avatar dpethes commented on May 18, 2024

Actually there is one other thing: ArrayPool in DrawList.AddText. Where does that come from?

from imgui.net.

mellinoe avatar mellinoe commented on May 18, 2024

ArrayPool is another new library from https://github.com/dotnet/corefx. It does not support .NET 4.0 either. It should be very trivial to replace it, though:

  • Just allocate a new array on every call -- creates lots of garbage.
  • Use stack allocation for appropriate sizes and fall back to arrays.
  • Use a persistent array, or a thread-static array, or something like that. Essentially implement our own buffer caching / re-use.

Actually, the current usage of ArrayPool is buggy, because I'm not returning the rented buffer. This is the equivalent of allocating a new array on every call. I'll fix that now.

from imgui.net.

mellinoe avatar mellinoe commented on May 18, 2024

Oops -- didn't mean to close.

from imgui.net.

dpethes avatar dpethes commented on May 18, 2024

The first option is basically what I do in the text_improvement branch in UTF8 functions with strings (1 temp array per string, even resized once): the effect is negligible, working set in task manager is stable around 80MB on Windows 7, 64bit, .Net4 + OpenTK 2.0. I think the GC can handle such short lived allocations well.

I'd go for the simplest solution first and I guess you have some use-case for it already, so you could easily see the effect.

from imgui.net.

mellinoe avatar mellinoe commented on May 18, 2024

I don't have any plans to change how vectors are marshalled. Now that the code is automatically generated it is, however, much easier to generate a version that uses a different vector type.

from imgui.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.