mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-28 17:40:56 +01:00
Examples: Comments.
This commit is contained in:
parent
83770e5e40
commit
448b262b37
12
imgui.cpp
12
imgui.cpp
@ -11536,7 +11536,6 @@ static void ShowExampleAppAutoResize(bool* opened)
|
||||
ImGui::SliderInt("Number of lines", &lines, 1, 20);
|
||||
for (int i = 0; i < lines; i++)
|
||||
ImGui::Text("%*sThis is line %d", i*4, "", i); // Pad with space to extend size horizontally
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
@ -11548,11 +11547,9 @@ static void ShowExampleAppFixedOverlay(bool* opened)
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui::Text("Simple overlay\non the top-left side of the screen.");
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Mouse Position: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
@ -11645,6 +11642,7 @@ static void ShowExampleAppCustomRendering(bool* opened)
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
// For the console example, here we are using a more C++ like approach of declaring a class to hold the data and the functions.
|
||||
struct ExampleAppConsole
|
||||
{
|
||||
char InputBuf[256];
|
||||
@ -11701,8 +11699,7 @@ struct ExampleAppConsole
|
||||
ImGui::TextWrapped("This example implements a console with basic coloring, completion and history. A more elaborate implementation may want to store entries along with extra data such as timestamp, emitter, etc.");
|
||||
ImGui::TextWrapped("Enter 'HELP' for help, press TAB to use text completion.");
|
||||
|
||||
// TODO: display from bottom
|
||||
// TODO: clip manually
|
||||
// TODO: display items starting from the bottom
|
||||
|
||||
if (ImGui::SmallButton("Add Dummy Text")) { AddLog("%d some text", Items.size()); AddLog("some more text"); AddLog("display very important message here!"); } ImGui::SameLine();
|
||||
if (ImGui::SmallButton("Add Dummy Error")) AddLog("[error] something went wrong"); ImGui::SameLine();
|
||||
@ -11714,7 +11711,6 @@ struct ExampleAppConsole
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0));
|
||||
static ImGuiTextFilter filter;
|
||||
filter.Draw("Filter (\"incl,-excl\") (\"error\")", 180);
|
||||
//if (ImGui::IsItemHovered()) ImGui::SetKeyboardFocusHere(-1); // Auto focus on hover
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::Separator();
|
||||
|
||||
@ -11801,7 +11797,7 @@ struct ExampleAppConsole
|
||||
}
|
||||
}
|
||||
|
||||
static int TextEditCallbackStub(ImGuiTextEditCallbackData* data)
|
||||
static int TextEditCallbackStub(ImGuiTextEditCallbackData* data) // In C++11 you are better off using lambdas for this sort of forwarding callbacks
|
||||
{
|
||||
ExampleAppConsole* console = (ExampleAppConsole*)data->UserData;
|
||||
return console->TextEditCallback(data);
|
||||
@ -12001,7 +11997,7 @@ static void ShowExampleAppLongText(bool* opened)
|
||||
ImGui::PopStyleVar();
|
||||
break;
|
||||
case 2:
|
||||
// Multiple calls to Text(), not clipped
|
||||
// Multiple calls to Text(), not clipped (slow)
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0));
|
||||
for (int i = 0; i < lines; i++)
|
||||
ImGui::Text("%i The quick brown fox jumps over the lazy dog\n", i);
|
||||
|
Loading…
Reference in New Issue
Block a user