-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Tip/Demo: Log example as helper class. #300
Comments
yes. yes. yes. it would be extra nice if you could provide one that only draws the visible lines of text, using imgui's clipping mechanisms. |
Please open a new topic for that. |
FYI if you are stumbling on this thread: this is old code. Prefer using the equivalent code in |
The wiki link appears to be dead. Code in imgui_demo.cpp was very helpful though thanks! |
Here is that code updated on the official demo: Line 6859 in 0359f6e
Anybody can clarify on here: for (int line_no = 0; line != NULL; line_no++)
{
const char* line_end = (line_no < LineOffsets.Size) ? buf_begin + LineOffsets[line_no] : NULL;
if (Filter.PassFilter(line, line_end))
ImGui::TextUnformatted(line, line_end);
line = line_end && line_end[1] ? line_end + 1 : NULL;
} What are I understand that this kind of accelerated, as uses special types from ImGui like I tried to replace my code with that but I ended using my old system, Any suggestions for learning / good practices are appreciated! |
I have added a simple Log example in imgui_demo.cpp
The way you use it is:
Complete code below.
The reason I added it is that it is a very common and desirable pattern to have a log window.
Now, this pattern is SO common that I am considering promoting this to a helper, e.g. ImGuiAppLog.
The only reason to do that is most people are too lazy to build their own log window. But if you build own you can make something that's more suited to your application (add multiple channels, add options to find the log emitter object in your game scene, click on filename to open them or folder in Windows Explorer, etc.). So I am on the fence as to whether I should provide this sort of stuff in the main library code. Opinion?
Similar to the memory editor I've posted here #270 (comment) , perhaps this is the sign that we could start a wiki or repository to post that sort of higher-level stuff ?
Demo code
Same without filter
Minimal version with no option, no filter:
The text was updated successfully, but these errors were encountered: