Love2dCS icon indicating copy to clipboard operation
Love2dCS copied to clipboard

Question about maybe using imgui for love2dcs?

Open Shadowblitz16 opened this issue 6 years ago • 5 comments

is it possible to draw onto a imgui widget?

Shadowblitz16 avatar May 17 '19 00:05 Shadowblitz16

In my oponion, It is feasible. I search for C# version of ImGui. and i get https://github.com/mellinoe/ImGui.NET It said :

Dear ImGui does not care what technology you use for rendering; it simply outputs textured triangles.

And I found that ImGui.NET can be used with XNA : https://github.com/mellinoe/ImGui.NET/tree/master/src/ImGui.NET.SampleProgram.XNA

So you just need to adapt this folder with Love2DCS, you should be able to achieve your goal.

endlesstravel avatar May 17 '19 04:05 endlesstravel

That would be nice, love needs a gui system

ghost avatar May 17 '19 04:05 ghost

wait so this should run in love2cs's draw hook? or does it need special implementation?

Shadowblitz16 avatar May 18 '19 00:05 Shadowblitz16

i think it need to update IO information and generate rendering instructions, so we need give the ImGui the input, and implement the rendering instructions: :


// on load ..
 ImGui.SetCurrentContext(ImGui.CreateContext())

// ... game loop ...
while (true )
{ 
            var io = ImGui.GetIO();
             io.deltaTime =  ... // update time
            io.KeysDown =// ... update mouse & key input
            ImGui.NewFrame();

           ImGui.Text()  //  ... layout gui
           //   layout gui
           ImGui.Image()  // layout gui ....

            ImGui.Render();
            var drawData = ImGui.GetDrawData()
            // render the draw data here :
            Render_drawData(drawData);
}

endlesstravel avatar May 19 '19 01:05 endlesstravel

this would be nice but there is actually Eto.Forms which might be better for native looking gui https://github.com/picoe/Eto it would need a love2dcs implementation though.

Shadowblitz16 avatar May 20 '19 23:05 Shadowblitz16