|
|
|
@ -53,7 +53,7 @@
|
|
|
|
|
- every frame:
|
|
|
|
|
1/ in your mainloop or right after you got your keyboard/mouse info, call ImGui::GetIO() and fill the 'Input' data, then call ImGui::NewFrame().
|
|
|
|
|
2/ use any ImGui function you want between NewFrame() and Render()
|
|
|
|
|
3/ ImGui::Render() to render all the accumulated command-lists. it will cack your RenderDrawListFn handler set in the IO structure.
|
|
|
|
|
3/ ImGui::Render() to render all the accumulated command-lists. it will call your RenderDrawListFn handler that you set in the IO structure.
|
|
|
|
|
- all rendering information are stored into command-lists until ImGui::Render() is called.
|
|
|
|
|
- effectively it means you can create widgets at any time in your code, regardless of "update" vs "render" considerations.
|
|
|
|
|
- a typical application skeleton may be:
|
|
|
|
@ -87,6 +87,10 @@
|
|
|
|
|
// swap video buffer, etc.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- if text or lines are blurry when integrating ImGui in your engine:
|
|
|
|
|
- in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
|
|
|
|
- try adjusting ImGui::GetIO().PixelCenterOffset to 0.5f or 0.375f
|
|
|
|
|
|
|
|
|
|
- some widgets carry state and requires an unique ID to do so.
|
|
|
|
|
- unique ID are typically derived from a string label, an indice or a pointer.
|
|
|
|
|
- use PushID/PopID to easily create scopes and avoid ID conflicts. A Window is also an implicit scope.
|
|
|
|
@ -101,7 +105,7 @@
|
|
|
|
|
|
|
|
|
|
- if you want to use a different font than the default
|
|
|
|
|
- create bitmap font data using BMFont. allocate ImGui::GetIO().Font and use ->LoadFromFile()/LoadFromMemory(), set ImGui::GetIO().FontHeight
|
|
|
|
|
- load your texture yourself. texture *MUST* have white pixel at UV coordinate 'IMGUI_FONT_TEX_UV_FOR_WHITE' (you can #define it in imconfig.h), this is used by solid objects.
|
|
|
|
|
- load your texture yourself. texture *MUST* have white pixel at UV coordinate Imgui::GetIO().FontTexUvForWhite. This is used to draw all solid shapes.
|
|
|
|
|
|
|
|
|
|
- tip: the construct 'if (IMGUI_ONCE_UPON_A_FRAME)' will evaluate to true only once a frame, you can use it to add custom UI in the middle of a deep nested inner loop in your code.
|
|
|
|
|
- tip: you can call Render() multiple times (e.g for VR renders), up to you to communicate the extra state to your RenderDrawListFn function.
|
|
|
|
@ -150,6 +154,7 @@
|
|
|
|
|
- input: support trackpad style scrolling & slider edit.
|
|
|
|
|
- misc: not thread-safe
|
|
|
|
|
- misc: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon?
|
|
|
|
|
- style editor: add a button to print C code.
|
|
|
|
|
- optimisation/render: use indexed rendering
|
|
|
|
|
- optimisation/render: move clip-rect to vertex data? would allow merging all commands
|
|
|
|
|
- optimisation/render: merge command-list of all windows into one command-list?
|
|
|
|
@ -178,10 +183,12 @@ namespace ImGui
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
static bool ButtonBehaviour(const ImGuiAabb& bb, const ImGuiID& id, bool* out_hovered, bool* out_held, bool allow_key_modifiers, bool repeat = false);
|
|
|
|
|
static void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);
|
|
|
|
|
static void RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, const bool hide_text_after_hash = true);
|
|
|
|
|
static void LogText(const ImVec2& ref_pos, const char* text, const char* text_end = NULL);
|
|
|
|
|
|
|
|
|
|
static void RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, const bool hide_text_after_hash = true);
|
|
|
|
|
static void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);
|
|
|
|
|
static void RenderCollapseTriangle(ImVec2 p_min, bool open, float scale = 1.0f, bool shadow = false);
|
|
|
|
|
|
|
|
|
|
static void ItemSize(ImVec2 size, ImVec2* adjust_start_offset = NULL);
|
|
|
|
|
static void ItemSize(const ImGuiAabb& aabb, ImVec2* adjust_start_offset = NULL);
|
|
|
|
|
static void PushColumnClipRect(int column_index = -1);
|
|
|
|
@ -272,8 +279,9 @@ ImGuiIO::ImGuiIO()
|
|
|
|
|
IniFilename = "imgui.ini";
|
|
|
|
|
LogFilename = "imgui_log.txt";
|
|
|
|
|
Font = NULL;
|
|
|
|
|
FontTexUvForWhite = ImVec2(0.0f,0.0f);
|
|
|
|
|
FontAllowScaling = false;
|
|
|
|
|
PixelCenterOffset = 0.5f;
|
|
|
|
|
PixelCenterOffset = 0.0f;
|
|
|
|
|
MousePos = ImVec2(-1,-1);
|
|
|
|
|
MousePosPrev = ImVec2(-1,-1);
|
|
|
|
|
MouseDoubleClickTime = 0.30f;
|
|
|
|
@ -1553,12 +1561,14 @@ static void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border,
|
|
|
|
|
window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);
|
|
|
|
|
if (border && (window->Flags & ImGuiWindowFlags_ShowBorders))
|
|
|
|
|
{
|
|
|
|
|
window->DrawList->AddRect(p_min+ImVec2(1,1), p_max+ImVec2(1,1), window->Color(ImGuiCol_BorderShadow), rounding);
|
|
|
|
|
window->DrawList->AddRect(p_min, p_max, window->Color(ImGuiCol_Border), rounding);
|
|
|
|
|
// FIXME: I have no idea how this is working correctly but it is the best I've found that works on multiple rendering
|
|
|
|
|
const float offset = GImGui.IO.PixelCenterOffset;
|
|
|
|
|
window->DrawList->AddRect(p_min+ImVec2(1.5f-offset,1.5f-offset), p_max+ImVec2(1.0f-offset*2,1.0f-offset*2), window->Color(ImGuiCol_BorderShadow), rounding);
|
|
|
|
|
window->DrawList->AddRect(p_min+ImVec2(0.5f-offset,0.5f-offset), p_max+ImVec2(0.0f-offset*2,0.0f-offset*2), window->Color(ImGuiCol_Border), rounding);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void RenderCollapseTriangle(ImVec2 p_min, bool open, float scale = 1.0f, bool shadow = false)
|
|
|
|
|
static void RenderCollapseTriangle(ImVec2 p_min, bool open, float scale, bool shadow)
|
|
|
|
|
{
|
|
|
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
|
|
|
|
|
|
|
@ -1581,7 +1591,7 @@ static void RenderCollapseTriangle(ImVec2 p_min, bool open, float scale = 1.0f,
|
|
|
|
|
c = center + ImVec2(-0.500f,-0.866f)*r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (shadow)
|
|
|
|
|
if (shadow && (window->Flags & ImGuiWindowFlags_ShowBorders) != 0)
|
|
|
|
|
window->DrawList->AddTriangleFilled(a+ImVec2(2,2), b+ImVec2(2,2), c+ImVec2(2,2), window->Color(ImGuiCol_BorderShadow));
|
|
|
|
|
window->DrawList->AddTriangleFilled(a, b, c, window->Color(ImGuiCol_Border));
|
|
|
|
|
}
|
|
|
|
@ -2066,8 +2076,7 @@ bool Begin(const char* name, bool* open, ImVec2 size, float fill_alpha, ImGuiWin
|
|
|
|
|
ImGuiAabb scrollbar_bb(window->Aabb().Max.x - style.ScrollBarWidth, title_bar_aabb.Max.y+1, window->Aabb().Max.x, window->Aabb().Max.y-1);
|
|
|
|
|
//window->DrawList->AddLine(scrollbar_bb.GetTL(), scrollbar_bb.GetBL(), g.Colors[ImGuiCol_Border]);
|
|
|
|
|
window->DrawList->AddRectFilled(scrollbar_bb.Min, scrollbar_bb.Max, window->Color(ImGuiCol_ScrollbarBg));
|
|
|
|
|
scrollbar_bb.Max.x -= 3;
|
|
|
|
|
scrollbar_bb.Expand(ImVec2(0,-3));
|
|
|
|
|
scrollbar_bb.Expand(ImVec2(-3,-3));
|
|
|
|
|
|
|
|
|
|
const float grab_size_y_norm = ImSaturate(window->Size.y / ImMax(window->SizeContentsFit.y, window->Size.y));
|
|
|
|
|
const float grab_size_y = scrollbar_bb.GetHeight() * grab_size_y_norm;
|
|
|
|
@ -2761,21 +2770,22 @@ static bool CloseWindowButton(bool* open)
|
|
|
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
|
|
|
|
|
|
|
|
const ImGuiID id = window->GetID("##CLOSE");
|
|
|
|
|
const float title_bar_height = window->TitleBarHeight();
|
|
|
|
|
const ImGuiAabb bb(window->Aabb().GetTR() + ImVec2(-title_bar_height+3.0f,2.0f), window->Aabb().GetTR() + ImVec2(-2.0f,+title_bar_height-2.0f));
|
|
|
|
|
const float size = window->TitleBarHeight() - 4.0f;
|
|
|
|
|
const ImGuiAabb bb(window->Aabb().GetTR() + ImVec2(-3.0f-size,2.0f), window->Aabb().GetTR() + ImVec2(-3.0f,2.0f+size));
|
|
|
|
|
|
|
|
|
|
bool hovered, held;
|
|
|
|
|
bool pressed = ButtonBehaviour(bb, id, &hovered, &held, true);
|
|
|
|
|
|
|
|
|
|
// Render
|
|
|
|
|
const ImU32 col = window->Color((held && hovered) ? ImGuiCol_CloseButtonActive : hovered ? ImGuiCol_CloseButtonHovered : ImGuiCol_CloseButton);
|
|
|
|
|
window->DrawList->AddCircleFilled(bb.GetCenter(), ImMax(2.0f,title_bar_height*0.5f-4), col, 16);
|
|
|
|
|
const ImVec2 center = bb.GetCenter();
|
|
|
|
|
window->DrawList->AddCircleFilled(center, ImMax(2.0f,size*0.5f), col, 16);
|
|
|
|
|
|
|
|
|
|
const float cross_padding = 4;
|
|
|
|
|
if (hovered && bb.GetWidth() >= (cross_padding+1)*2 && bb.GetHeight() >= (cross_padding+1)*2)
|
|
|
|
|
const float cross_extent = (size * 0.5f * 0.7071f) - 1.0f;
|
|
|
|
|
if (hovered)
|
|
|
|
|
{
|
|
|
|
|
window->DrawList->AddLine(bb.GetTL()+ImVec2(+cross_padding,+cross_padding), bb.GetBR()+ImVec2(-cross_padding,-cross_padding), window->Color(ImGuiCol_Text));
|
|
|
|
|
window->DrawList->AddLine(bb.GetBL()+ImVec2(+cross_padding,-cross_padding), bb.GetTR()+ImVec2(-cross_padding,+cross_padding), window->Color(ImGuiCol_Text));
|
|
|
|
|
window->DrawList->AddLine(center + ImVec2(+cross_extent,+cross_extent), center + ImVec2(-cross_extent,-cross_extent), window->Color(ImGuiCol_Text));
|
|
|
|
|
window->DrawList->AddLine(center + ImVec2(+cross_extent,-cross_extent), center + ImVec2(-cross_extent,+cross_extent), window->Color(ImGuiCol_Text));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (open != NULL && pressed)
|
|
|
|
@ -2883,8 +2893,8 @@ bool CollapsingHeader(const char* label, const char* str_id, const bool display_
|
|
|
|
|
ImGuiAabb bb = ImGuiAabb(pos_min, ImVec2(pos_max.x, pos_min.y + text_size.y));
|
|
|
|
|
if (display_frame)
|
|
|
|
|
{
|
|
|
|
|
bb.Min.x -= window_padding.x*0.5f;
|
|
|
|
|
bb.Max.x += window_padding.x*0.5f;
|
|
|
|
|
bb.Min.x -= window_padding.x*0.5f - 1;
|
|
|
|
|
bb.Max.x += window_padding.x*0.5f - 1;
|
|
|
|
|
bb.Max.y += style.FramePadding.y * 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2920,7 +2930,7 @@ bool CollapsingHeader(const char* label, const char* str_id, const bool display_
|
|
|
|
|
{
|
|
|
|
|
if ((held && hovered) || hovered)
|
|
|
|
|
RenderFrame(bb.Min, bb.Max, col, false);
|
|
|
|
|
RenderCollapseTriangle(bb.Min + ImVec2(style.FramePadding.x, window->FontSize()*0.15f), opened, 0.70f);
|
|
|
|
|
RenderCollapseTriangle(bb.Min + ImVec2(style.FramePadding.x, window->FontSize()*0.15f), opened, 0.70f, false);
|
|
|
|
|
RenderText(bb.Min + ImVec2(window->FontSize() + style.FramePadding.x*2,0), label);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3284,7 +3294,7 @@ bool SliderFloat(const char* label, float* v, float v_min, float v_max, const ch
|
|
|
|
|
|
|
|
|
|
// Draw
|
|
|
|
|
const float grab_x = ImLerp(slider_effective_x1, slider_effective_x2, grab_t);
|
|
|
|
|
const ImGuiAabb grab_bb(ImVec2(grab_x-grab_size_in_pixels*0.5f,frame_bb.Min.y+2.0f), ImVec2(grab_x+grab_size_in_pixels*0.5f,frame_bb.Max.y-1.0f));
|
|
|
|
|
const ImGuiAabb grab_bb(ImVec2(grab_x-grab_size_in_pixels*0.5f,frame_bb.Min.y+2.0f), ImVec2(grab_x+grab_size_in_pixels*0.5f,frame_bb.Max.y-2.0f));
|
|
|
|
|
window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, window->Color(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3464,7 +3474,6 @@ static void Plot(ImGuiPlotType plot_type, const char* label, const float* values
|
|
|
|
|
else if (plot_type == ImGuiPlotType_Histogram)
|
|
|
|
|
window->DrawList->AddRectFilled(ImLerp(graph_bb.Min, graph_bb.Max, p0), ImLerp(graph_bb.Min, graph_bb.Max, ImVec2(p1.x, 1.0f))+ImVec2(-1,0), v_hovered == v_idx ? col_hovered : col_base);
|
|
|
|
|
|
|
|
|
|
v0 = v1;
|
|
|
|
|
t0 = t1;
|
|
|
|
|
p0 = p1;
|
|
|
|
|
}
|
|
|
|
@ -3522,7 +3531,7 @@ void Checkbox(const char* label, bool* v)
|
|
|
|
|
RenderFrame(check_bb.Min, check_bb.Max, window->Color(hovered ? ImGuiCol_CheckHovered : ImGuiCol_FrameBg));
|
|
|
|
|
if (*v)
|
|
|
|
|
{
|
|
|
|
|
window->DrawList->AddRectFilled(check_bb.Min+ImVec2(4,4), check_bb.Max-ImVec2(4,4), window->Color(ImGuiCol_CheckActive));
|
|
|
|
|
window->DrawList->AddRectFilled(check_bb.Min+ImVec2(3,3), check_bb.Max-ImVec2(3,3), window->Color(ImGuiCol_CheckActive));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g.LogEnabled)
|
|
|
|
@ -3575,7 +3584,7 @@ bool RadioButton(const char* label, bool active)
|
|
|
|
|
|
|
|
|
|
window->DrawList->AddCircleFilled(center, radius, window->Color(hovered ? ImGuiCol_CheckHovered : ImGuiCol_FrameBg), 16);
|
|
|
|
|
if (active)
|
|
|
|
|
window->DrawList->AddCircleFilled(center, radius-2, window->Color(ImGuiCol_CheckActive), 16);
|
|
|
|
|
window->DrawList->AddCircleFilled(center, radius-3.0f, window->Color(ImGuiCol_CheckActive), 16);
|
|
|
|
|
|
|
|
|
|
if (window->Flags & ImGuiWindowFlags_ShowBorders)
|
|
|
|
|
{
|
|
|
|
@ -4804,22 +4813,24 @@ void ImDrawList::AddVtx(const ImVec2& pos, ImU32 col)
|
|
|
|
|
{
|
|
|
|
|
vtx_write->pos = pos;
|
|
|
|
|
vtx_write->col = col;
|
|
|
|
|
vtx_write->uv = IMGUI_FONT_TEX_UV_FOR_WHITE;
|
|
|
|
|
vtx_write->uv = GImGui.IO.FontTexUvForWhite;
|
|
|
|
|
vtx_write++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ImDrawList::AddVtxLine(const ImVec2& a, const ImVec2& b, ImU32 col)
|
|
|
|
|
{
|
|
|
|
|
const ImVec2 n = (b - a) / ImLength(b - a);
|
|
|
|
|
const ImVec2 hn = ImVec2(n.y, -n.x) * 0.5f;
|
|
|
|
|
const float offset = GImGui.IO.PixelCenterOffset;
|
|
|
|
|
const ImVec2 hn = (b - a) * (0.50f / ImLength(b - a)); // half normal
|
|
|
|
|
const ImVec2 hp0 = ImVec2(offset - hn.y, offset + hn.x); // half perpendiculars + user offset
|
|
|
|
|
const ImVec2 hp1 = ImVec2(offset + hn.y, offset - hn.x);
|
|
|
|
|
|
|
|
|
|
AddVtx(a - hn, col);
|
|
|
|
|
AddVtx(b - hn, col);
|
|
|
|
|
AddVtx(a + hn, col);
|
|
|
|
|
|
|
|
|
|
AddVtx(b - hn, col);
|
|
|
|
|
AddVtx(b + hn, col);
|
|
|
|
|
AddVtx(a + hn, col);
|
|
|
|
|
// Two triangles makes up one line. Using triangles allows us to make draw calls.
|
|
|
|
|
AddVtx(a + hp0, col);
|
|
|
|
|
AddVtx(b + hp0, col);
|
|
|
|
|
AddVtx(a + hp1, col);
|
|
|
|
|
AddVtx(b + hp0, col);
|
|
|
|
|
AddVtx(b + hp1, col);
|
|
|
|
|
AddVtx(a + hp1, col);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col)
|
|
|
|
@ -4961,10 +4972,12 @@ void ImDrawList::AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec
|
|
|
|
|
if ((col >> 24) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
const ImVec2 offset(GImGui.IO.PixelCenterOffset,GImGui.IO.PixelCenterOffset);
|
|
|
|
|
|
|
|
|
|
ReserveVertices(3);
|
|
|
|
|
AddVtx(a, col);
|
|
|
|
|
AddVtx(b, col);
|
|
|
|
|
AddVtx(c, col);
|
|
|
|
|
AddVtx(a + offset, col);
|
|
|
|
|
AddVtx(b + offset, col);
|
|
|
|
|
AddVtx(c + offset, col);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments)
|
|
|
|
@ -4972,13 +4985,15 @@ void ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int nu
|
|
|
|
|
if ((col >> 24) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
const ImVec2 offset(GImGui.IO.PixelCenterOffset,GImGui.IO.PixelCenterOffset);
|
|
|
|
|
|
|
|
|
|
ReserveVertices((unsigned int)num_segments*6);
|
|
|
|
|
const float a_step = 2*PI/(float)num_segments;
|
|
|
|
|
float a0 = 0.0f;
|
|
|
|
|
for (int i = 0; i < num_segments; i++)
|
|
|
|
|
{
|
|
|
|
|
const float a1 = (i + 1) == num_segments ? 0.0f : a0 + a_step;
|
|
|
|
|
AddVtxLine(centre + ImVec2(cos(a0),sin(a0))*radius, centre + ImVec2(cos(a1),sin(a1))*radius, col);
|
|
|
|
|
AddVtxLine(centre + offset + ImVec2(cos(a0),sin(a0))*radius, centre + ImVec2(cos(a1),sin(a1))*radius, col);
|
|
|
|
|
a0 = a1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -4988,15 +5003,17 @@ void ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col,
|
|
|
|
|
if ((col >> 24) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
const ImVec2 offset(GImGui.IO.PixelCenterOffset,GImGui.IO.PixelCenterOffset);
|
|
|
|
|
|
|
|
|
|
ReserveVertices((unsigned int)num_segments*3);
|
|
|
|
|
const float a_step = 2*PI/(float)num_segments;
|
|
|
|
|
float a0 = 0.0f;
|
|
|
|
|
for (int i = 0; i < num_segments; i++)
|
|
|
|
|
{
|
|
|
|
|
const float a1 = (i + 1) == num_segments ? 0.0f : a0 + a_step;
|
|
|
|
|
AddVtx(centre + ImVec2(cos(a0),sin(a0))*radius, col);
|
|
|
|
|
AddVtx(centre + ImVec2(cos(a1),sin(a1))*radius, col);
|
|
|
|
|
AddVtx(centre, col);
|
|
|
|
|
AddVtx(centre + offset + ImVec2(cos(a0),sin(a0))*radius, col);
|
|
|
|
|
AddVtx(centre + offset + ImVec2(cos(a1),sin(a1))*radius, col);
|
|
|
|
|
AddVtx(centre + offset, col);
|
|
|
|
|
a0 = a1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -5031,11 +5048,14 @@ void ImDrawList::AddText(ImFont font, float font_size, const ImVec2& pos, ImU32
|
|
|
|
|
ImBitmapFont::ImBitmapFont()
|
|
|
|
|
{
|
|
|
|
|
Data = NULL;
|
|
|
|
|
DataSize = 0;
|
|
|
|
|
DataOwned = false;
|
|
|
|
|
Info = NULL;
|
|
|
|
|
Common = NULL;
|
|
|
|
|
Glyphs = NULL;
|
|
|
|
|
GlyphsCount = 0;
|
|
|
|
|
Kerning = NULL;
|
|
|
|
|
KerningCount = 0;
|
|
|
|
|
TabCount = 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -5223,13 +5243,11 @@ void ImBitmapFont::RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& c
|
|
|
|
|
const float outline = (float)Info->Outline;
|
|
|
|
|
|
|
|
|
|
// Align to be pixel perfect
|
|
|
|
|
pos.x = (float)(int)pos.x + 0.5f;
|
|
|
|
|
pos.y = (float)(int)pos.y + 0.5f;
|
|
|
|
|
pos.x = (float)(int)pos.x;
|
|
|
|
|
pos.y = (float)(int)pos.y;
|
|
|
|
|
|
|
|
|
|
const ImVec4 clip_rect = clip_rect_ref;
|
|
|
|
|
|
|
|
|
|
const float uv_offset = GImGui.IO.PixelCenterOffset;
|
|
|
|
|
|
|
|
|
|
float x = pos.x;
|
|
|
|
|
float y = pos.y;
|
|
|
|
|
for (const char* s = text_begin; s < text_end; s++)
|
|
|
|
@ -5266,10 +5284,10 @@ void ImBitmapFont::RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& c
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const float s1 = (uv_offset + glyph->X) * tex_scale_x;
|
|
|
|
|
const float t1 = (uv_offset + glyph->Y) * tex_scale_y;
|
|
|
|
|
const float s2 = (uv_offset + glyph->X + glyph->Width) * tex_scale_x;
|
|
|
|
|
const float t2 = (uv_offset + glyph->Y + glyph->Height) * tex_scale_y;
|
|
|
|
|
const float s1 = (glyph->X) * tex_scale_x;
|
|
|
|
|
const float t1 = (glyph->Y) * tex_scale_y;
|
|
|
|
|
const float s2 = (glyph->X + glyph->Width) * tex_scale_x;
|
|
|
|
|
const float t2 = (glyph->Y + glyph->Height) * tex_scale_y;
|
|
|
|
|
|
|
|
|
|
out_vertices[0].pos = ImVec2(x1, y1);
|
|
|
|
|
out_vertices[0].uv = ImVec2(s1, t1);
|
|
|
|
@ -5504,10 +5522,10 @@ void ShowTestWindow(bool* open)
|
|
|
|
|
|
|
|
|
|
if (ImGui::CollapsingHeader("Window options"))
|
|
|
|
|
{
|
|
|
|
|
ImGui::Checkbox("no titlebar", &no_titlebar); ImGui::SameLine(200);
|
|
|
|
|
ImGui::Checkbox("no border", &no_border); ImGui::SameLine(400);
|
|
|
|
|
ImGui::Checkbox("no titlebar", &no_titlebar); ImGui::SameLine(150);
|
|
|
|
|
ImGui::Checkbox("no border", &no_border); ImGui::SameLine(300);
|
|
|
|
|
ImGui::Checkbox("no resize", &no_resize);
|
|
|
|
|
ImGui::Checkbox("no move", &no_move); ImGui::SameLine(200);
|
|
|
|
|
ImGui::Checkbox("no move", &no_move); ImGui::SameLine(150);
|
|
|
|
|
ImGui::Checkbox("no scrollbar", &no_scrollbar);
|
|
|
|
|
ImGui::SliderFloat("fill alpha", &fill_alpha, 0.0f, 1.0f);
|
|
|
|
|
if (ImGui::TreeNode("Style Editor"))
|
|
|
|
@ -5590,6 +5608,9 @@ void ShowTestWindow(bool* open)
|
|
|
|
|
ImGui::EndTooltip();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ImGui::Separator();
|
|
|
|
|
ImGui::Text("^ Horizontal separator");
|
|
|
|
|
|
|
|
|
|
static int item = 1;
|
|
|
|
|
ImGui::Combo("combo", &item, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
|
|
|
|
|
|
|
|
|
@ -5896,7 +5917,8 @@ void ShowTestWindow(bool* open)
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// Font data
|
|
|
|
|
// Bitmap exported from proggy_clean.fon (c) by Tristan Grimmer http://www.proggyfonts.net
|
|
|
|
|
// Bitmap exported from proggy_clean.fon (c) by Tristan Grimmer http://upperbounds.net/
|
|
|
|
|
// Also available on unofficial ProggyFonts mirror http://www.proggyfonts.net
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
/*
|
|
|
|
|
// Copyright (c) 2004, 2005 Tristan Grimmer
|
|
|
|
|