Comments (11)
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.
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.
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.
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.
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.
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.
Actually there is one other thing: ArrayPool in DrawList.AddText. Where does that come from?
from imgui.net.
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.
Oops -- didn't mean to close.
from imgui.net.
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.
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)
- Passing a string with a % to SetTooltip() causes garbage data to be printed HOT 3
- Cannot render any texture (including the Font texture) in my window using ImGui.Image
- How to add win32 and dx11 backends to cimgui?
- Can you provide a nuget package that includes ImGuizmo?
- ImgGui.Button() function is not rendering in my program (.NET 7, ImGui.net ver 1.90.0.1, Veldrid.ImGui ver 5.72.0, ClickableTransparentOverlay ver 9.1.0, SixLabors.ImageSharp ver 3.0.2, Vortice.Mathematics ver 1.7.2) HOT 1
- Breaking Changes For Handling Inputs > v1.90.0.0
- Is there a way to debug unbalanced ImGUI calls? Expecting IM_ASSERT_USER_ERROR but instead get silence HOT 3
- Access Violation With using ImGui.Begin HOT 2
- Unable to change the font for rendering text. HOT 18
- ImGui.PushStyleVar passes incorrect Y value for ImGuiStyleVar.WindowMinSize since version 1.90.0.0 HOT 5
- End of netstandard2.0 support
- ImGuiController problem HOT 1
- Problem merging font awesome into default font HOT 4
- Popups HOT 1
- Bad code gen for SlideInt2(), etc. HOT 2
- imgui.net is missing NuGet package README file
- Scaled fonts are low quality HOT 1
- Gamepad navigation does not work HOT 3
- CustomWidget sliders share the same value HOT 4
- Custom rendering examle HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgui.net.