@ -336,7 +336,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- font/atlas: dynamic font atlas to avoid baking huge ranges into bitmap and make scaling easier.
- font/draw: vertical and/or rotated text renderer (#705) - vertical is easier clipping wise
- font/draw: need to be able to specify wrap start position.
- font/draw: better reserve policy for large horizontal block of text (shouldn't reserve for all clipped lines)
- font/draw: better reserve policy for large horizontal block of text (shouldn't reserve for all clipped lines). also see #3349.
- font/draw: fix for drawing 16k+ visible characters in same call.
- font/draw: underline, squiggle line rendering helpers.
- font: optimization: for monospace font (like the default one) we can trim IndexXAdvance as long as trailing value is == FallbackXAdvance (need to make sure TAB is still correct), would save on cache line.
- font: add support for kerning, probably optional. A) perhaps default to (32..128)^2 matrix ~ 9K entries = 36KB, then hash for non-ascii?. B) or sparse lookup into per-char list?
#define GLFW_INCLUDE_NONE // GLFW including OpenGL headers causes ambiguity or multiple definition errors.
#include<glbinding/Binding.h> // Initialize with glbinding::Binding::initialize()
@ -79,6 +81,8 @@ int main(int, char**)
boolerr=glewInit()!=GLEW_OK;
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD)
boolerr=gladLoadGL()==0;
#elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD2)
boolerr=gladLoadGL((GLADloadfunc)SDL_GL_GetProcAddress)==0;// glad2 recommend using the windowing library loader instead of the (optionally) bundled one.
DisplayWindowPadding=ImVec2(19,19);// Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows.
DisplaySafeAreaPadding=ImVec2(3,3);// If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
MouseCursorScale=1.0f;// Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later.
AntiAliasedLines=true;// Enable anti-aliasing on lines/borders. Disable if you are really short on CPU/GPU.
AntiAliasedFill=true;// Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
AntiAliasedLines=true;// Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU.
AntiAliasedLinesUseTex=true;// Enable anti-aliased lines/borders using textures where possible. Require back-end to render with bilinear filtering.
CurveTessellationTol=1.25f;// Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
CircleSegmentMaxError=1.60f;// Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry.
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
@ -158,7 +158,7 @@ typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A
typedefintImGuiStyleVar;// -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling
typedefintImDrawCornerFlags;// -> enum ImDrawCornerFlags_ // Flags: for ImDrawList::AddRect(), AddRectFilled() etc.
typedefintImDrawListFlags;// -> enum ImDrawListFlags_ // Flags: for ImDrawList
typedefintImFontAtlasFlags;// -> enum ImFontAtlasFlags_ // Flags: for ImFontAtlas
typedefintImFontAtlasFlags;// -> enum ImFontAtlasFlags_ // Flags: for ImFontAtlas build
typedefintImGuiBackendFlags;// -> enum ImGuiBackendFlags_ // Flags: for io.BackendFlags
typedefintImGuiColorEditFlags;// -> enum ImGuiColorEditFlags_ // Flags: for ColorEdit4(), ColorPicker4() etc.
typedefintImGuiConfigFlags;// -> enum ImGuiConfigFlags_ // Flags: for io.ConfigFlags
@ -770,7 +770,7 @@ namespace ImGui
IMGUI_APIboolIsMouseDown(ImGuiMouseButtonbutton);// is mouse button held?
IMGUI_APIboolIsMouseClicked(ImGuiMouseButtonbutton,boolrepeat=false);// did mouse button clicked? (went from !Down to Down)
IMGUI_APIboolIsMouseReleased(ImGuiMouseButtonbutton);// did mouse button released? (went from Down to !Down)
IMGUI_APIboolIsMouseDoubleClicked(ImGuiMouseButtonbutton);// did mouse button double-clicked? a double-click returns false in IsMouseClicked(). uses io.MouseDoubleClickTime.
IMGUI_APIboolIsMouseDoubleClicked(ImGuiMouseButtonbutton);// did mouse button double-clicked? (note that a double-click will also report IsMouseClicked() == true)
IMGUI_APIboolIsMouseHoveringRect(constImVec2&r_min,constImVec2&r_max,boolclip=true);// is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block.
IMGUI_APIboolIsMousePosValid(constImVec2*mouse_pos=NULL);// by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available
IMGUI_APIboolIsAnyMouseDown();// is any mouse button held?
@ -1513,8 +1513,9 @@ struct ImGuiStyle
ImVec2DisplayWindowPadding;// Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows.
ImVec2DisplaySafeAreaPadding;// If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly!
floatMouseCursorScale;// Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). We apply per-monitor DPI scaling over this scale. May be removed later.
boolAntiAliasedLines;// Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU.
boolAntiAliasedFill;// Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
boolAntiAliasedLines;// Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).
boolAntiAliasedLinesUseTex;// Enable anti-aliased lines/borders using textures where possible. Require back-end to render with bilinear filtering. Latched at the beginning of the frame (copied to ImDrawList).
boolAntiAliasedFill;// Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.). Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).
floatCurveTessellationTol;// Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
floatCircleSegmentMaxError;// Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry.
ImVec4Colors[ImGuiCol_COUNT];
@ -2000,6 +2001,11 @@ struct ImColor
// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList.
// The maximum line width to bake anti-aliased textures for. Build atlas with ImFontAtlasFlags_NoBakedLines to disable baking.
#ifndef IM_DRAWLIST_TEX_LINES_WIDTH_MAX
#define IM_DRAWLIST_TEX_LINES_WIDTH_MAX (63)
#endif
// ImDrawCallback: Draw callbacks for advanced uses [configurable type: override in imconfig.h]
// NB: You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering,
// you can poke into the draw list for that! Draw callback may be useful for example to:
@ -2096,12 +2102,15 @@ enum ImDrawCornerFlags_
ImDrawCornerFlags_All=0xF// In your function calls you may use ~0 (= all bits sets) instead of ImDrawCornerFlags_All, as a convenience
};
// Flags for ImDrawList. Those are set automatically by ImGui:: functions from ImGuiIO settings, and generally not manipulated directly.
// It is however possible to temporarily alter flags between calls to ImDrawList:: functions.
enumImDrawListFlags_
{
ImDrawListFlags_None=0,
ImDrawListFlags_AntiAliasedLines=1<<0,// Lines are anti-aliased (*2 the number of triangles for 1.0f wide line, otherwise *3 the number of triangles)
ImDrawListFlags_AntiAliasedFill=1<<1,// Filled shapes have anti-aliased edges (*2 the number of vertices)
ImDrawListFlags_AllowVtxOffset=1<<2// Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled.
ImDrawListFlags_AntiAliasedLines=1<<0,// Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures, otherwise *3 the number of triangles)
ImDrawListFlags_AntiAliasedLinesUseTex=1<<1,// Enable anti-aliased lines/borders using textures when possible. Require back-end to render with bilinear filtering.
ImDrawListFlags_AntiAliasedFill=1<<2,// Enable anti-aliased edge around filled shapes (rounded rectangles, circles).
ImDrawListFlags_AllowVtxOffset=1<<3// Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled.
ImFontAtlasFlags_NoPowerOfTwoHeight=1<<0,// Don't round the height to next power of two
ImFontAtlasFlags_NoMouseCursors=1<<1// Don't build software mouse cursors into the atlas
ImFontAtlasFlags_NoMouseCursors=1<<1,// Don't build software mouse cursors into the atlas (save a little texture memory)
ImFontAtlasFlags_NoBakedLines=1<<2// Don't build thick line textures into the atlas (save a little texture memory). The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU).
};
// Load and rasterize multiple TTF/OTF fonts into a same texture. The font atlas will build a single texture holding:
@ -2394,7 +2405,7 @@ struct ImFontAtlas
// Note: this API may be redesigned later in order to support multi-monitor varying DPI settings.
ImVec2TexUvWhitePixel;// Texture coordinates to a white pixel
ImVector<ImFont*>Fonts;// Hold all the fonts returned by AddFont*. Fonts[0] is the default font upon calling ImGui::NewFrame(), use ImGui::PushFont()/PopFont() to change the current font.
ImVector<ImFontAtlasCustomRect>CustomRects;// Rectangles for packing custom texture data into the atlas.
ImVector<ImFontConfig>ConfigData;// Internal data
intCustomRectIds[1];// Identifiers of custom texture rectangle used by ImFontAtlas/ImDrawList
ImVector<ImFontConfig>ConfigData;// Configuration data
ImVec4TexUvLines[IM_DRAWLIST_TEX_LINES_WIDTH_MAX+1];// UVs for baked anti-aliased lines
// [Internal] Packing data
intPackIdMouseCursors;// Custom texture rectangle ID for white pixel and mouse cursors
intPackIdLines;// Custom texture rectangle ID for baked anti-aliased lines
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
typedefImFontAtlasCustomRectCustomRect;// OBSOLETED in 1.72+
ImGui::SameLine();HelpMarker("Instruct Dear ImGui to render a mouse cursor itself. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).");
ImGui::Text("Also see Style->Rendering for rendering options.");
ImVec2ArcFastVtx[12*IM_DRAWLIST_ARCFAST_TESSELLATION_MULTIPLIER];// FIXME: Bake rounded corners fill/borders in atlas
ImU8CircleSegmentCounts[64];// Precomputed segment count for given radius (array index + 1) before we calculate it dynamically (to avoid calculation overhead)
constImVec4*TexUvLines;// UV of anti-aliased lines in the atlas