Giter Site home page Giter Site logo

imguics's Introduction

ImGuiCS

dear ImGui + fork of ImGui.NET + SDL2-CS, XNA and FNA samples

MIT-licensed, fork recursively

Special thanks to my patrons on Patreon:

ImGui.NET exists already, why fork?

ImGui.NET didn't fit my personal needs. It removed the ImGui prefix from the classes and while it already wraps imgui structs well, accessing some things like the fonts still required unsafe blocks in your own project. ImGuiCS aims to avoid forcing you to go the "dirty" route.
Admittedly, going unsafe is the more accurate route, but it makes dealing with things like ImVector more complicated as it should be for a beginner.

SDL2-CS doesn't load / it's an empty directory! What happened?

You need to git clone --recursive to download the SDL2-CS "submodule". If you're not using ImGuiSDL2CS (f.e. you're using ImGuiXNA instead), you can simply disable SDL2-CS in your IDE (Visual Studio / MonoDevelop).

Visual Studio 2010 can't deal with the new language features!

If you require compatibility, I'd be thankful if you could help me as I don't plan to install Visual Studio 2010. This also means that I don't plan on preserving compatibility with any C# version older than the one provided in VS2015.
You can still build ImGuiCS and the other projects in VS2015+ and use the resulting binaries.
Tip: If you're dealing with XNA Game Studio, MXA provides downloads to get it up and running in VS2015: https://mxa.codeplex.com/releases

There is an unofficial, VS2010-compatible lock-step fork available here: https://github.com/conatuscreative/ImGuiCS

cimgui.dll / SDL2.dll doesn't load!

Use the native libraries from libs/x86 (32 bit) or libs/x64 (64 bit) instead. You could also ship both directories and create a .dll.config file for ImGuiCS.dll / SDL2-CS.dll that takes this into account.

imguics's People

Contributors

0x0ade avatar danielcrenna avatar se5a avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

imguics's Issues

ImGuiFNA / ImGuiXNA discussion

Feel free to discuss anything regarding the FNA and XNA samples here.

The XNA sample is just the FNA sample with some differences regarding text input and clipboard management.

Currently, the XNA sample suffers from an issue when rendering. Feel free to open the two following images in new tabs and to switch between them. The issue is clearly visible in the ImGui Demo window title bar:

ImGuiFNA:
Screenshot of ImGuiFNA

ImGuiXNA:
Screenshot of ImGuiXNA

Missing cimgui.dll mapping on Linux

"Use the native libraries from libs/x86 (32 bit) or libs/x64 (64 bit) instead. You could also ship both directories and create a .dll.config file for ImGuiCS.dll / SDL2-CS.dll that takes this into account."

Can you clarify this? I'm getting System.Dll not found exception on cimgui.dll in Monodevelop on linux Mint when I try debugrun the ImGuiSDL2CS-Example.
However I can see the above x64 libs in the project getting copied to the output directory. not sure what the problem is.
Do I need to find that and compile it on linux?

PlotHistogram - Example?

I've been struggling to figure this out,
just trying to display a game physics frame rate as a histogram.
I'm storing the length of time for a frame to an float[] array.
I had some idea that the valueOffset could be used to position the 'start' of the array when drawing the histogram. so I set the array to 120, then stored the currentIndex for the position of the last write to the array, when the currentIndex got to array.Length (120) I set the currentIndex to 0. and write over top of the existing array position. I then used the currentIndex as the valueOffset.
is this correct? no matter what I do, it seems to draw the most recent value somewhere in the middle of the plot. I've tried looking at some of the C examples but it looks like most of them seem to have the valueOffset a set number, I'm kind of not sure what I'm supposed to be doing or how this is supposed to work here.

The other problem I was having was the minScale and maxScale, how do these work?
if I check the array that I'm trying to display I get values of all < 1.0 however the histogram repeatedly shows bars of > 1.0, and sometimes even negative numbers. even though no such values exist in the array.
Been messing with this for a day now and I must be missing something, I've tried all sorts of things and feel more confused about how this works than before I started.

Mysterious crashes

I'm using ImGuiCS like in your examples, but it crashes with an access violation the first time I call NewFrame. If I manually set custom alloc/free functions it invokes the alloc function a couple times instead of AVing, and then hangs for a while and my process exits with a random exit code.

Any idea what's gong on here? I'm baffled.

HitTest ~10 pixels off on y axis

i just cloned the repo for the first time, compiled the sdl2cs example. it works but the mouse needs to be like 10 pixels below UI elements to get them working.

Is FileDialog complete?

I don't see a scenario where ChosenPath or I.chosenPath is ever set, so at the very least it appears non-functional for folder dialogs. I don't see a way to use it that doesn't involve changing code.

ImageButton, can't get image to display.

am I doing this right?
Loading and storing the image:

IntPtr playImg = SDL.SDL_LoadBMP("Resources/Play.bmp");
ImageDictionary.Add("PlayImg", SDL.SDL_CreateTextureFromSurface(rendererPtr, playImg).ToInt32());

a breakpoint here shows that the intPtr is not null so it appears to be loading fine.

The button:

if (ImGui.ImageButton(_state.ImageDictionary["PlayImg"], new ImVec2(16, 16), new ImVec2(0, 0), new ImVec2(16, 16), 0, new ImVec4(), new ImVec4()))
   DoStuff();

The parameters are a bit obtuse but with a bit of goggling and searching through the imgui.cs and imgui.cpp files I think I figured most of it out:

userTextureID was confusing at first but looking at the code it's just casting it to an IntPtr, so I guess loading and image and turning it into a texture, then casting the resulting IntPtr to an int32 will work here?

Size is fairly obvious, and with a bit of playing around changes the size of the button itself. ok. happy with that, since my image is 16x16 we'll leave it at that for simplicity for now.

uv0 and uv1 are a little more obtuse but I'm guessing this is top left and bottom right of where the image will go on the button, I messed around with some other numbers but the result didn't change. still a blank button.
Other parameters I've messed around with and kinda make some sort of sense, left colour at 0, since I'm just trying to get something to show right now, did mess around with the alpha just in-case tint was setting the alpha of the actual image, but didn't appear to make the image show up.

InputInt Missing

I noticed you've missed InputInt?

I tried adding it myself but I'm not the best when it comes to adding functionality that should realistically be in already.

Could you add it in maybe?

Thanks.

(XNA)

Setting up 2d graphics with ImGuiCS

Trying to do something like this:

pulsarsystemmap

With some ImGuiCS menus 'floating' ontop of it.
Should I try do this in an ImGuiCS window of some kind or have an SDLCS window with an ImGuiCS window inside it? or some other thing?

I'm going to want to mousewheel zoom, click and drag pan, click on some things, rightclick menu etc.
The above picture is my attempt in eto.forms version of wpf/winforms canvas. the fading orbit circles are a bunch of arc segments each with slightly more alpha. the whole thing changes, ie the planets move around their orbits, those strange box things at earth are broken ship icons which are meant to be dynamic (ie the icon should be different depending on the ship's stats, cargo size engine size etc etc.)

MouseDrawCursor is acting as readonly

I know its because its in a struct, but even when getting it through ImGui.IO.Native->MouseDrawCursor = 0; still doesnt work.

Am i missing something.

Performance 30% CPU and 99% GPU

the performance hit seems to be way to high for this UI demo
tried SDL2 demos and my laptop goes bananas
30-50% CPU and 99% GPU on a 1050 GTX

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.