ImGui::TextWrapped("This example implement a simple console. A more elaborate implementation may want to store individual entries along with extra data such as timestamp, emitter, etc. Here we automatically set focus on the text edition fields when hovering them.");
// TODO: display from bottom
// TODO: clip manually
// TODO: history
// TODO: completion
staticImVector<char*>items;
staticcharinput[256]="";
staticboolnew_items=false;
if(ImGui::SmallButton("Add Dummy Text")){items.push_back(ImStrdup("some text\nsome more text"));new_items=true;}
ImGui::SameLine();
if(ImGui::SmallButton("Add Dummy Error")){items.push_back(ImStrdup("[error] something went wrong"));new_items=true;}
// Display every line as a separate entry so we can change their color or add custom widgets. If you only want raw text you can use ImGui::TextUnformatted(log.begin(), log.end());
// NB- if you have lots of text this approach may be too inefficient. You can seek and display only the lines that are on display using a technique similar to what TextUnformatted() does,
// or faster if your entries are already stored into a table.
IMGUI_APIboolBegin(constchar*name="Debug",bool*open=NULL,ImVec2size=ImVec2(0,0),floatfill_alpha=-1.0f,ImGuiWindowFlagsflags=0);// return false when window is collapsed, so you can early out in your code.
IMGUI_APIvoidBeginChild(constchar*str_id,ImVec2size=ImVec2(0,0),boolborder=false,ImGuiWindowFlagsextra_flags=0);// size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). on each axis.
IMGUI_APIvoidPushTextWrapPos(floatwrap_pos_x);// word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space.
IMGUI_APIvoidPopTextWrapPos();
@ -345,6 +349,7 @@ enum ImGuiKey_
ImGuiKey_COUNT,
};
// Enumeration for PushStyleColor() / PopStyleColor()
enumImGuiCol_
{
ImGuiCol_Text,
@ -387,6 +392,19 @@ enum ImGuiCol_
ImGuiCol_COUNT,
};
// Enumeration for PushStyleVar() / PopStyleVar()
// NB: the enum only refers to fields of ImGuiStyle() which makes sense to be pushed/poped in UI code. Feel free to add others.