Results 1 to 9 of 9

Thread: ImGui pascal bindings

  1. #1

    ImGui pascal bindings

    Hi, I'm working on pascal bindings for ImGui. It's a small library for immediate mode user interfaces, that's easy to integrate with SDL + OpenGL (and has examples for integrating with other frameworks / rendering APIs).
    This is what the readme says:
    dear imgui (AKA ImGui), is a bloat-free graphical user interface library for C++. It outputs optimized vertex buffers that you can render anytime in your 3D-pipeline enabled application. It is fast, portable, renderer agnostic and self-contained (no external dependencies).

    ImGui is designed to enable fast iteration and empower programmers to create content creation tools and visualization/ debug tools (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal, and thus lacks certain features normally found in more high-level libraries.

    ImGui is particularly suited to integration in realtime 3D applications, fullscreen applications, embedded applications, games, or any applications on consoles platforms where operating system features are non-standard.
    I was looking for a simple gui for my OpenGL projects and it is serving me well so far (and it's even quite fun to use).

    The bindings are here:
    ImGui is a C++ library, therefore a C wrapper dll is needed for other languages. It wraps the the static methods of ImGui classes as functions, which I had to import first and re-create a static class around them to mimic the original interface. I included a demo that shows how to use the library and includes the cimgui.dll build for Windows 64bit.

    This is how I use it in my model viewer - though I recommend ImGui's project page for way better examples:

    procedure DrawGui;
      style: PImGuiStyle;
      file_item: TFileListItem;
      fitem_selected: Boolean = false;
      selected_mesh_name: String;
      selected_item: TFileListItem;
      style := Imgui.GetStyle();
      style^.WindowRounding := 0;
        if not g_model_loading_failed then begin
        end else
            Imgui.Text('mesh loading failed :(');
      Imgui.Begin_('Rendering options');
        Imgui.Checkbox('points', @view.opts.points);
        Imgui.Checkbox('wireframe', @view.opts.wireframe);
        Imgui.Checkbox('textures', @view.opts.textures);
        Imgui.Checkbox('vertex colors', @view.opts.vcolors);
        if g_model <> nil then
            if Imgui.Button('Export to obj') then
      selected_mesh_name := EmptyStr;
      Imgui.Begin_('File list');
        //todo filter
        for file_item in g_filelist do begin
            fitem_selected := = g_model_name;
            if Imgui.Selectable(, fitem_selected) then begin
                selected_mesh_name :=;
                selected_item := file_item;
      if (selected_mesh_name <> EmptyStr) and (selected_mesh_name <> g_model_name) then begin
            g_model_name := selected_mesh_name;
            g_model_loading_failed := false;
            g_model_loading_failed := true;
    Last edited by imcold; 30-05-2017 at 05:57 PM.

  2. #2
    Examples look interesting, is it possible to make scaled container with it? Like a grid with ui elements on it that you can 'zoom' in and out.

  3. #3
    Not sure what you mean. There are columns (rather than grids) and they can contain ui elements, see Colums or Layouts in the original ShowTestWindow (uncomment line ImGui.ShowTestWindow() in ImGuiDemo.lpr). You can adjust font size per window through SetWindowFontScale, or scale the whole ui through DisplayFramebufferScale, but I don't think you can scale just part of the UI.

  4. #4
    Updated to newest imgui 1.50 and added Windows 32/64bit Debug/Release builds of cimgui so it's easier to start using it on Windows.

  5. #5
    Nice! I'll look more into this once I'm done with my randon name generator.

  6. #6
    That's awsome. I'll definitivly look into this. Keep up the good work!

    EDIT: There is a lack of good and SDL2 compatible GUI bindings.

  7. #7
    Updated to imgui 1.52, I have fallen a bit behind.

  8. #8
    Can you please share also imgui dll's?

  9. #9
    Sure! Updated to Imgui 1.53, dll's are in the demo package:
    Last edited by imcold; 23-06-2018 at 06:56 PM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Comodo SSL