Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing ImGui Tables demo #33

Closed
dufferzafar opened this issue Nov 5, 2021 · 5 comments
Closed

Missing ImGui Tables demo #33

dufferzafar opened this issue Nov 5, 2021 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@dufferzafar
Copy link

Currently, Imtui seems to support Imgui v1.81 whose demo has a bunch of table related stuff, which Imtui seems to be missing.

ImGui Demo v1.81 (has lots of table related demo items):

image

ImTui (master) (ncurses_demo) (doesn't have majority of table related items):

image

@dufferzafar
Copy link
Author

dufferzafar commented Nov 5, 2021

Silly me. I thought Imtui was just rendering the ImGui demo directly! 😅

I looked at the code and with so many of the ImGui:: lines, i thought Line 43 was ImGui::ShowDemoWindow rather than ImTui::ShowDemoWindow

ImGui::NewFrame();
ImGui::SetNextWindowPos(ImVec2(4, 27), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(50.0, 10.0), ImGuiCond_Once);
ImGui::Begin("Hello, world!");
ImGui::Text("NFrames = %d", nframes++);
ImGui::Text("Mouse Pos : x = %g, y = %g", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
ImGui::Text("Time per frame %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
ImGui::Text("Float:");
ImGui::SameLine();
ImGui::SliderFloat("##float", &fval, 0.0f, 10.0f);
#ifndef __EMSCRIPTEN__
ImGui::Text("%s", "");
if (ImGui::Button("Exit program", { ImGui::GetContentRegionAvail().x, 2 })) {
break;
}
#endif
ImGui::End();
ImTui::ShowDemoWindow(&demo);
ImGui::Render();

Anyway, I still feel we should update our demo to match v1.81 demo as much as possible.

@ggerganov ggerganov added the enhancement New feature or request label Nov 6, 2021
ggerganov added a commit that referenced this issue Nov 6, 2021
Adding initial pass of "Tables & Columns" examples
@ggerganov
Copy link
Owner

Initial pass for adding "Tables & Columns" demo is now available on master. Probably needs some more refinements for proper display in the terminal

@ggerganov
Copy link
Owner

Here is quick preview:

tables

@ggerganov ggerganov self-assigned this Nov 6, 2021
@dufferzafar
Copy link
Author

I had copy-pasted the code from imgui_demo.cpp to imtui_demo.cpp and got this working as well.

Glad that you pushed it to master though.

Probably needs some more refinements for proper display in the terminal

Yeah. The tables don't look that good. I was going to create a separate issue for that as well!

I'll list all issues that I found here:

  1. Borders & Backgrounds are not correctly applied. In the default example, rows should have alternating colors while the first two rows have same color, and then the next two rows have same.
  2. Toggling any of the borders like ImGuiTableFlags_Borders totally breaks the table view.
  3. Columns can be resized, but the separator is not really visible. Missing ImGUI controls #28 mentions missing separator as well. In cases where the separator is visible, I feel it is "too thick"

This screenshot is from visidata - an ncurses application that i'm trying to partially recreate in C++. This is my ideal goal wrt columns. I think they just have a single character as a separator.

image

@ggerganov
Copy link
Owner

Most of the issues should be fixed now on latest master (don't forget to update the submodule too):

imtui-tables

I don't think we can support horizontal separators though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants