question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I use ImGuiListClipper for drawing a flow container of tiles

See original GitHub issue

I am trying to simulate a scroll area and only draw the visible tiles…

                    var size  = ImGui.GetContentRegionAvail();
                    var index = 0;
                    var count = Tiles.Length;

                    var clipper = new ImGuiListClipperPtr();
                    clipper.Begin((int)(size.X * size.Y), TileSizeY);


                    for (var i=0; i<Tiles.Length; i++)
                    {
                        if (ImGui.GetItemRectMax().X < size.X) ImGui.SameLine();

                        var image = Image(Tiles[index].GetTexture(), new(1,0), new(0,1));
                        Raylib.BeginTextureMode(image);
                        Raylib.DrawRectangleLines(0,0, TileSizeX, TileSizeY, Color.WHITE);
                        Raylib.EndTextureMode();
                        index++;
                    }
                    clipper.End();
  • How exactly does the .net version of the listclipper work>?
  • How would I simulate a fake scroll area without looping 60000 times?
  • How do I get the min and max rows and columns of the visible scroll area?

Issue Analytics

  • State:closed
  • Created 6 months ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
TheLostTreecommented, Apr 29, 2023

Nevermind! I figured out that using this works without crashing

ImGuiListClipperPtr listClipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
1reaction
ocornutcommented, Jun 13, 2023
Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found