mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Merge branch 'master' into navigation
# Conflicts: # imgui.cpp # imgui.h
This commit is contained in:
@ -101,23 +101,23 @@ static void ShowHelpMarker(const char* desc)
|
||||
void ImGui::ShowUserGuide()
|
||||
{
|
||||
ImGui::BulletText("Double-click on title bar to collapse window.");
|
||||
ImGui::BulletText("Click and drag on lower right corner to resize window.");
|
||||
ImGui::BulletText("Click and drag on lower right corner to resize window\n(double-click to auto fit window to its contents).");
|
||||
ImGui::BulletText("Click and drag on any empty space to move window.");
|
||||
ImGui::BulletText("Mouse Wheel to scroll.");
|
||||
ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
||||
ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text.");
|
||||
if (ImGui::GetIO().FontAllowUserScaling)
|
||||
ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents.");
|
||||
ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields.");
|
||||
ImGui::BulletText("CTRL+Click on a slider or drag box to input text.");
|
||||
ImGui::BulletText(
|
||||
"While editing text:\n"
|
||||
"- Hold SHIFT or use mouse to select text\n"
|
||||
"- CTRL+Left/Right to word jump\n"
|
||||
"- CTRL+A or double-click to select all\n"
|
||||
"- CTRL+X,CTRL+C,CTRL+V clipboard\n"
|
||||
"- CTRL+Z,CTRL+Y undo/redo\n"
|
||||
"- ESCAPE to revert\n"
|
||||
"- You can apply arithmetic operators +,*,/ on numerical values.\n"
|
||||
" Use +- to subtract.\n");
|
||||
ImGui::BulletText("Mouse Wheel to scroll.");
|
||||
ImGui::BulletText("While editing text:\n");
|
||||
ImGui::Indent();
|
||||
ImGui::BulletText("Hold SHIFT or use mouse to select text.");
|
||||
ImGui::BulletText("CTRL+Left/Right to word jump.");
|
||||
ImGui::BulletText("CTRL+A or double-click to select all.");
|
||||
ImGui::BulletText("CTRL+X,CTRL+C,CTRL+V to use clipboard.");
|
||||
ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo.");
|
||||
ImGui::BulletText("ESCAPE to revert.");
|
||||
ImGui::BulletText("You can apply arithmetic operators +,*,/ on numerical values.\nUse +- to subtract.");
|
||||
ImGui::Unindent();
|
||||
}
|
||||
|
||||
// Demonstrate most ImGui features (big function!)
|
||||
@ -232,7 +232,8 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
ImGui::Spacing();
|
||||
if (ImGui::CollapsingHeader("Help"))
|
||||
{
|
||||
ImGui::TextWrapped("This window is being created by the ShowTestWindow() function. Please refer to the code for programming reference.\n\nUser Guide:");
|
||||
ImGui::TextWrapped("This window is being created by the ShowTestWindow() function. Please refer to the code in imgui_demo.cpp for reference.\n\n");
|
||||
ImGui::Text("USER GUIDE:");
|
||||
ImGui::ShowUserGuide();
|
||||
}
|
||||
|
||||
@ -545,17 +546,27 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
{
|
||||
ImGui::TextWrapped("Below we are displaying the font texture (which is the only texture we have access to in this demo). Use the 'ImTextureID' type as storage to pass pointers or identifier to your own texture data. Hover the texture for a zoomed view!");
|
||||
ImVec2 tex_screen_pos = ImGui::GetCursorScreenPos();
|
||||
float tex_w = (float)ImGui::GetIO().Fonts->TexWidth;
|
||||
float tex_h = (float)ImGui::GetIO().Fonts->TexHeight;
|
||||
ImTextureID tex_id = ImGui::GetIO().Fonts->TexID;
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
// Here we are grabbing the font texture because that's the only one we have access to inside the demo code.
|
||||
// Remember that ImTextureID is just storage for whatever you want it to be, it is essentially a value that will be passed to the render function inside the ImDrawCmd structure.
|
||||
// If you use one of the default imgui_impl_XXXX.cpp renderer, they all have comments at the top of their file to specify what they expect to be stored in ImTextureID.
|
||||
// (for example, the imgui_impl_dx11.cpp renderer expect a 'ID3D11ShaderResourceView*' pointer. The imgui_impl_glfw_gl3.cpp renderer expect a GLuint OpenGL texture identifier etc.)
|
||||
// If you decided that ImTextureID = MyEngineTexture*, then you can pass your MyEngineTexture* pointers to ImGui::Image(), and gather width/height through your own functions, etc.
|
||||
// Using ShowMetricsWindow() as a "debugger" to inspect the draw data that are being passed to your render will help you debug issues if you are confused about this.
|
||||
// Consider using the lower-level ImDrawList::AddImage() API, via ImGui::GetWindowDrawList()->AddImage().
|
||||
ImTextureID tex_id = io.Fonts->TexID;
|
||||
float tex_w = (float)io.Fonts->TexWidth;
|
||||
float tex_h = (float)io.Fonts->TexHeight;
|
||||
|
||||
ImGui::Text("%.0fx%.0f", tex_w, tex_h);
|
||||
ImGui::Image(tex_id, ImVec2(tex_w, tex_h), ImVec2(0,0), ImVec2(1,1), ImColor(255,255,255,255), ImColor(255,255,255,128));
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
float focus_sz = 32.0f;
|
||||
float focus_x = ImGui::GetMousePos().x - tex_screen_pos.x - focus_sz * 0.5f; if (focus_x < 0.0f) focus_x = 0.0f; else if (focus_x > tex_w - focus_sz) focus_x = tex_w - focus_sz;
|
||||
float focus_y = ImGui::GetMousePos().y - tex_screen_pos.y - focus_sz * 0.5f; if (focus_y < 0.0f) focus_y = 0.0f; else if (focus_y > tex_h - focus_sz) focus_y = tex_h - focus_sz;
|
||||
float focus_x = io.MousePos.x - tex_screen_pos.x - focus_sz * 0.5f; if (focus_x < 0.0f) focus_x = 0.0f; else if (focus_x > tex_w - focus_sz) focus_x = tex_w - focus_sz;
|
||||
float focus_y = io.MousePos.y - tex_screen_pos.y - focus_sz * 0.5f; if (focus_y < 0.0f) focus_y = 0.0f; else if (focus_y > tex_h - focus_sz) focus_y = tex_h - focus_sz;
|
||||
ImGui::Text("Min: (%.2f, %.2f)", focus_x, focus_y);
|
||||
ImGui::Text("Max: (%.2f, %.2f)", focus_x + focus_sz, focus_y + focus_sz);
|
||||
ImVec2 uv0 = ImVec2((focus_x) / tex_w, (focus_y) / tex_h);
|
||||
|
Reference in New Issue
Block a user