mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 09:27:00 +00:00
Merge branch 'master' into viewport
This commit is contained in:
commit
64cbbed152
@ -46,6 +46,8 @@ Various internal refactors have also been done, as part of the navigation work a
|
|||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
(IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.60)
|
(IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.60)
|
||||||
|
|
||||||
|
- Fonts: changed ImFont::DisplayOffset.y to defaults to 0 instead of +1. Fixed vertical rounding of Ascent/Descent to match TrueType renderer.
|
||||||
|
If you were adding or subtracting to ImFont::DisplayOffset check if your fonts are correctly aligned vertically. (#1619)
|
||||||
- BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment.
|
- BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment.
|
||||||
- Obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render(). Use ImGui::GetDrawData() to retrieve the ImDrawData* to display.
|
- Obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render(). Use ImGui::GetDrawData() to retrieve the ImDrawData* to display.
|
||||||
- Reorganized context handling to be more explicit,
|
- Reorganized context handling to be more explicit,
|
||||||
@ -104,14 +106,16 @@ Other Changes:
|
|||||||
- Popup: Better handling of user mistakenly calling OpenPopup() every frame (with reopen_existing option). The error will now be more visible and easier to understand. (#1497)
|
- Popup: Better handling of user mistakenly calling OpenPopup() every frame (with reopen_existing option). The error will now be more visible and easier to understand. (#1497)
|
||||||
- Popup: BeginPopup(): Exposed extra_flags parameter that are passed through to Begin(). (#1533)
|
- Popup: BeginPopup(): Exposed extra_flags parameter that are passed through to Begin(). (#1533)
|
||||||
- Popup: BeginPopupModal: fixed the conditional test for SetNextWindowPos() which was polling the wrong window, which in practice made the test succeed all the time.
|
- Popup: BeginPopupModal: fixed the conditional test for SetNextWindowPos() which was polling the wrong window, which in practice made the test succeed all the time.
|
||||||
- Tooltip: BeginTooltip() sets NoInputs flag.
|
- Tooltip: BeginTooltip() sets ImGuiWindowFlags_NoInputs flag.
|
||||||
- Scrollbar: Fixed ScrollbarY enable test after ScrollbarX has been enabled being a little off (small regression from Nov 2017). (#1574)
|
- Scrollbar: Fixed ScrollbarY enable test after ScrollbarX has been enabled being a little off (small regression from Nov 2017). (#1574)
|
||||||
- Scrollbar: Fixed ScrollbarX enable test subtracting WindowPadding.x (this has been there since the addition of horizontal scroll bar!).
|
- Scrollbar: Fixed ScrollbarX enable test subtracting WindowPadding.x (this has been there since the addition of horizontal scroll bar!).
|
||||||
- Columns: Clear offsets data when columns count changed. (#1525)
|
- Columns: Clear offsets data when columns count changed. (#1525)
|
||||||
- Columns: Fixed a memory leak of ImGuiColumnsSet's Columns vector. (#1529) [@unprompted]
|
- Columns: Fixed a memory leak of ImGuiColumnsSet's Columns vector. (#1529) [@unprompted]
|
||||||
|
- Columns: Fixed resizing a window very small breaking some columns positioning (broken in 1.53).
|
||||||
|
- Columns: The available column extent takes consideration of the right-most clipped pixel, so the right-most column may look a little wider but will contain the same amount of visible contents.
|
||||||
- MenuBar: Fixed menu bar pushing a clipping rect outside of its allocated bound (usually unnoticeable).
|
- MenuBar: Fixed menu bar pushing a clipping rect outside of its allocated bound (usually unnoticeable).
|
||||||
- TreeNode: nodes with the ImGuiTreeNodeFlags_Leaf flag correctly disable highlight when DragDrop is active. (#143, #581)
|
- TreeNode: nodes with the ImGuiTreeNodeFlags_Leaf flag correctly disable highlight when DragDrop is active. (#143, #581)
|
||||||
- Drag and Drop: Increased payload type string to 12 characters instead of 8. (#143)
|
- Drag and Drop: Increased payload type string to 32 characters instead of 8. (#143)
|
||||||
- Drag and Drop: TreeNode as drop target displays rectangle over full frame. (#1597, #143)
|
- Drag and Drop: TreeNode as drop target displays rectangle over full frame. (#1597, #143)
|
||||||
- DragFloat: Fix/workaround for backends which do not preserve a valid mouse position when dragged out of bounds. (#1559)
|
- DragFloat: Fix/workaround for backends which do not preserve a valid mouse position when dragged out of bounds. (#1559)
|
||||||
- Slider, Combo: Use ImGuiCol_FrameBgHovered color when hovered. (#1456) [@stfx]
|
- Slider, Combo: Use ImGuiCol_FrameBgHovered color when hovered. (#1456) [@stfx]
|
||||||
@ -119,6 +123,12 @@ Other Changes:
|
|||||||
- Combo: BeginCombo(): Added ImGuiComboFlags_NoPreview to disable the preview and only display a square arrow button.
|
- Combo: BeginCombo(): Added ImGuiComboFlags_NoPreview to disable the preview and only display a square arrow button.
|
||||||
- Combo: Arrow button isn't displayed over frame background so its blended color matches other buttons. Left side of the button isn't rounded.
|
- Combo: Arrow button isn't displayed over frame background so its blended color matches other buttons. Left side of the button isn't rounded.
|
||||||
- PlotLines: plot a flat line if scale_min==scale_max. (#1621)
|
- PlotLines: plot a flat line if scale_min==scale_max. (#1621)
|
||||||
|
- Fonts: Changed DisplayOffset.y to defaults to 0 instead of +1. Fixed rounding of Ascent/Descent to match TrueType renderer.
|
||||||
|
If you were adding or subtracting to ImFont::DisplayOffset check if your fonts are correctly aligned vertically. (#1619)
|
||||||
|
- Fonts: Updated stb_truetype from 1.14 to stb_truetype 1.19. (w/ include fix from some platforms #1622)
|
||||||
|
- Fonts: Added optional FreeType rasterizer in misc/freetype. Moved from imgui_club repo. (#618) [@Vuhdo, @mikesart, @ocornut]
|
||||||
|
- Fonts: Moved extra_fonts/ to misc/fonts/.
|
||||||
|
- ImFontAtlas: Fixed cfg.MergeMode not reusing existing glyphs if available (always overwrote).
|
||||||
- ImFontAtlas: Handle stb_truetype stbtt_InitFont() and stbtt_PackBegin() possible failures more gracefully, GetTexDataAsRGBA32() won't crash during conversion. (#1527)
|
- ImFontAtlas: Handle stb_truetype stbtt_InitFont() and stbtt_PackBegin() possible failures more gracefully, GetTexDataAsRGBA32() won't crash during conversion. (#1527)
|
||||||
- ImFontAtlas: Moved mouse cursor data out of ImGuiContext, fix drawing them with multiple contexts. Also remove the last remaining undesirable dependency on ImGui in imgui_draw.cpp. (#939)
|
- ImFontAtlas: Moved mouse cursor data out of ImGuiContext, fix drawing them with multiple contexts. Also remove the last remaining undesirable dependency on ImGui in imgui_draw.cpp. (#939)
|
||||||
- ImFontAtlas: Added ImFontAtlasFlags_NoPowerOfTwoHeight flag to disable padding font height to nearest power of two. (#1613)
|
- ImFontAtlas: Added ImFontAtlasFlags_NoPowerOfTwoHeight flag to disable padding font height to nearest power of two. (#1613)
|
||||||
@ -134,18 +144,17 @@ Other Changes:
|
|||||||
- Misc: Updated stb_rect_pack from 0.10 to 0.11 (minor changes).
|
- Misc: Updated stb_rect_pack from 0.10 to 0.11 (minor changes).
|
||||||
- Misc: Added ImGuiConfigFlags_IsSRGB and ImGuiConfigFlags_IsTouchScreen user flags (for io.ConfigFlags).
|
- Misc: Added ImGuiConfigFlags_IsSRGB and ImGuiConfigFlags_IsTouchScreen user flags (for io.ConfigFlags).
|
||||||
(Those flags are not used by ImGui itself, they only exists to make it easy for the engine/back-end to pass information to the application in a standard manner.)
|
(Those flags are not used by ImGui itself, they only exists to make it easy for the engine/back-end to pass information to the application in a standard manner.)
|
||||||
- Fonts: Updated stb_truetype from 1.14 to stb_truetype 1.19. (w/ include fix from some platforms #1622)
|
- Metrics: Added display of Columns state.
|
||||||
- Fonts: Added optional FreeType rasterizer in misc/freetype. Moved from imgui_club repo. (#618) [@Vuhdo, @mikesart, @ocornut]
|
|
||||||
- Fonts: Moved extra_fonts/ to misc/fonts/.
|
|
||||||
- Demo: Improved Selectable() examples. (#1528)
|
- Demo: Improved Selectable() examples. (#1528)
|
||||||
- Demo: Tweaked the Child demos, added a menu bar to the second child to test some navigation functions.
|
- Demo: Tweaked the Child demos, added a menu bar to the second child to test some navigation functions.
|
||||||
- Demo: Console: Using ImGuiCol_Text to be more friendly to color changes.
|
- Demo: Console: Using ImGuiCol_Text to be more friendly to color changes.
|
||||||
- Demo: Using IM_COL32() instead of ImColor() in ImDrawList centric contexts. Trying to phase out use of the ImColor helper whenever possible.
|
- Demo: Using IM_COL32() instead of ImColor() in ImDrawList centric contexts. Trying to phase out use of the ImColor helper whenever possible.
|
||||||
- Examples: Files in examples/ now include their own changelog so it is easier to occasionally update your bindings if needed.
|
- Examples: Files in examples/ now include their own changelog so it is easier to occasionally update your bindings if needed.
|
||||||
- Examples: Using Dark theme by default. (#707). Tweaked demo code.
|
- Examples: Using Dark theme by default. (#707). Tweaked demo code.
|
||||||
- Examples: Added support for horizontal mouse wheel for API that allows it. (#1463)
|
- Examples: Added support for horizontal mouse wheel for API that allows it. (#1463) [@tseeker]
|
||||||
- Examples: DirectX12: Added DirectX 12 example. (#301) [@jdm3]
|
- Examples: DirectX12: Added DirectX 12 example. (#301) [@jdm3]
|
||||||
- Examples: OpenGL3+GLFW,SDL: Changed GLSL shader version to 150 (#1466, #1504).
|
- Examples: OpenGL3+GLFW,SDL: Changed GLSL shader version from 330 to 150. (#1466, #1504)
|
||||||
|
- Examples: OpenGL3+GLFW,SDL: Added a way to override the GLSL version string in the Init function. (#1466, #1504).
|
||||||
- Examples: OpenGL3+GLFW,SDL: Creating VAO in the render function so it can be more easily used by multiple shared OpenGL contexts. (#1217)
|
- Examples: OpenGL3+GLFW,SDL: Creating VAO in the render function so it can be more easily used by multiple shared OpenGL contexts. (#1217)
|
||||||
- Examples: OpenGL3+GLFW: Using 3.2 context instead of 3.3. (#1466)
|
- Examples: OpenGL3+GLFW: Using 3.2 context instead of 3.3. (#1466)
|
||||||
- Examples: OpenGL: Setting up glPixelStorei() explicitly before uploading texture.
|
- Examples: OpenGL: Setting up glPixelStorei() explicitly before uploading texture.
|
||||||
|
@ -145,8 +145,7 @@ Frameworks:
|
|||||||
- Unreal Engine 4: [segross/UnrealImGui](https://github.com/segross/UnrealImGui) or [sronsse/UnrealEngine_ImGui](https://github.com/sronsse/UnrealEngine_ImGui)
|
- Unreal Engine 4: [segross/UnrealImGui](https://github.com/segross/UnrealImGui) or [sronsse/UnrealEngine_ImGui](https://github.com/sronsse/UnrealEngine_ImGui)
|
||||||
- SFML: [imgui-sfml](https://github.com/EliasD/imgui-sfml) or [imgui-backends](https://github.com/Mischa-Alff/imgui-backends)
|
- SFML: [imgui-sfml](https://github.com/EliasD/imgui-sfml) or [imgui-backends](https://github.com/Mischa-Alff/imgui-backends)
|
||||||
|
|
||||||
For other bindings: see [this page](https://github.com/ocornut/imgui/wiki/Links/).
|
For other bindings: see [this page](https://github.com/ocornut/imgui/wiki/Links/). Also see [wiki](https://github.com/ocornut/imgui/wiki) for a few other links and ideas. Contact me if you would like to add to those lists.
|
||||||
Please contact me with the Issues tracker or Twitter to fix/update this list.
|
|
||||||
|
|
||||||
Roadmap
|
Roadmap
|
||||||
-------
|
-------
|
||||||
|
5
TODO.txt
5
TODO.txt
@ -212,7 +212,10 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- pie menus patterns (#434)
|
- pie menus patterns (#434)
|
||||||
- markup: simple markup language for color change? (#902)
|
- markup: simple markup language for color change? (#902)
|
||||||
|
|
||||||
- font: better vertical centering (based e.g on height of lowercase 'x'?). currently Roboto-Medium size 16 px isn't currently centered.
|
!- font: need handling of missing glyphs by not packing/rasterizing glyph 0 of a given font.
|
||||||
|
- font: MergeMode: flags to select overwriting or not.
|
||||||
|
- font: MergeMode: duplicate glyphs are stored in the atlas texture which is suboptimal.
|
||||||
|
- font: better vertical centering (based e.g on height of lowercase 'x'?). currently Roboto-Medium size 16 px isn't currently centered. (#1619)
|
||||||
- font: free the Alpha buffer if user only requested RGBA.
|
- font: free the Alpha buffer if user only requested RGBA.
|
||||||
!- font: better CalcTextSizeA() API, at least for simple use cases. current one is horrible (perhaps have simple vs extended versions).
|
!- font: better CalcTextSizeA() API, at least for simple use cases. current one is horrible (perhaps have simple vs extended versions).
|
||||||
- font: enforce monospace through ImFontConfig (for icons?) + create dual ImFont output from same input, reusing rasterized data but with different glyphs/AdvanceX
|
- font: enforce monospace through ImFontConfig (for icons?) + create dual ImFont output from same input, reusing rasterized data but with different glyphs/AdvanceX
|
||||||
|
14
imgui.cpp
14
imgui.cpp
@ -19,7 +19,7 @@
|
|||||||
- Read first
|
- Read first
|
||||||
- How to update to a newer version of Dear ImGui
|
- How to update to a newer version of Dear ImGui
|
||||||
- Getting started with integrating Dear ImGui in your code/engine
|
- Getting started with integrating Dear ImGui in your code/engine
|
||||||
- Using gamepad/keyboard navigation [BETA]
|
- Using gamepad/keyboard navigation controls [BETA]
|
||||||
- API BREAKING CHANGES (read me when you update!)
|
- API BREAKING CHANGES (read me when you update!)
|
||||||
- ISSUES & TODO LIST
|
- ISSUES & TODO LIST
|
||||||
- FREQUENTLY ASKED QUESTIONS (FAQ), TIPS
|
- FREQUENTLY ASKED QUESTIONS (FAQ), TIPS
|
||||||
@ -76,7 +76,8 @@
|
|||||||
- ESCAPE to revert text to its original value.
|
- ESCAPE to revert text to its original value.
|
||||||
- You can apply arithmetic operators +,*,/ on numerical values. Use +- to subtract (because - would set a negative value!)
|
- You can apply arithmetic operators +,*,/ on numerical values. Use +- to subtract (because - would set a negative value!)
|
||||||
- Controls are automatically adjusted for OSX to match standard OSX text editing operations.
|
- Controls are automatically adjusted for OSX to match standard OSX text editing operations.
|
||||||
- Gamepad navigation: see suggested mappings in imgui.h ImGuiNavInput_ + download PNG/PSD at goo.gl/9LgVZW.
|
- General Keyboard controls: enable with ImGuiConfigFlags_NavEnableKeyboard.
|
||||||
|
- General Gamepad controls: enable with ImGuiConfigFlags_NavEnableGamepad. See suggested mappings in imgui.h ImGuiNavInput_ + download PNG/PSD at goo.gl/9LgVZW.
|
||||||
|
|
||||||
|
|
||||||
PROGRAMMER GUIDE
|
PROGRAMMER GUIDE
|
||||||
@ -210,9 +211,9 @@
|
|||||||
They tell you if ImGui intends to use your inputs. So for example, if 'io.WantCaptureMouse' is set you would typically want to hide
|
They tell you if ImGui intends to use your inputs. So for example, if 'io.WantCaptureMouse' is set you would typically want to hide
|
||||||
mouse inputs from the rest of your application. Read the FAQ below for more information about those flags.
|
mouse inputs from the rest of your application. Read the FAQ below for more information about those flags.
|
||||||
|
|
||||||
USING GAMEPAD/KEYBOARD NAVIGATION [BETA]
|
USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS [BETA]
|
||||||
|
|
||||||
- Ask questions and report issues at https://github.com/ocornut/imgui/issues/787
|
- The gamepad/keyboard navigation is in Beta. Ask questions and report issues at https://github.com/ocornut/imgui/issues/787
|
||||||
- The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable.
|
- The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable.
|
||||||
- Keyboard:
|
- Keyboard:
|
||||||
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeyDown[] + io.KeyMap[] arrays.
|
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeyDown[] + io.KeyMap[] arrays.
|
||||||
@ -227,13 +228,13 @@
|
|||||||
- See 'enum ImGuiNavInput_' in imgui.h for a description of inputs. For each entry of io.NavInputs[], set the following values:
|
- See 'enum ImGuiNavInput_' in imgui.h for a description of inputs. For each entry of io.NavInputs[], set the following values:
|
||||||
0.0f= not held. 1.0f= fully held. Pass intermediate 0.0f..1.0f values for analog triggers/sticks.
|
0.0f= not held. 1.0f= fully held. Pass intermediate 0.0f..1.0f values for analog triggers/sticks.
|
||||||
- We uses a simple >0.0f test for activation testing, and won't attempt to test for a dead-zone.
|
- We uses a simple >0.0f test for activation testing, and won't attempt to test for a dead-zone.
|
||||||
Your code will probably need to transform your raw inputs (such as e.g. remapping your 0.2..0.9 raw input range to 0.0..1.0 imgui range, maybe a power curve, etc.).
|
Your code will probably need to transform your raw inputs (such as e.g. remapping your 0.2..0.9 raw input range to 0.0..1.0 imgui range, etc.).
|
||||||
- You can download PNG/PSD files depicting the gamepad controls for common controllers at: goo.gl/9LgVZW.
|
- You can download PNG/PSD files depicting the gamepad controls for common controllers at: goo.gl/9LgVZW.
|
||||||
- If you need to share inputs between your game and the imgui parts, the easiest approach is to go all-or-nothing, with a buttons combo to toggle the target.
|
- If you need to share inputs between your game and the imgui parts, the easiest approach is to go all-or-nothing, with a buttons combo to toggle the target.
|
||||||
Please reach out if you think the game vs navigation input sharing could be improved.
|
Please reach out if you think the game vs navigation input sharing could be improved.
|
||||||
- Mouse:
|
- Mouse:
|
||||||
- PS4 users: Consider emulating a mouse cursor with DualShock4 touch pad or a spare analog stick as a mouse-emulation fallback.
|
- PS4 users: Consider emulating a mouse cursor with DualShock4 touch pad or a spare analog stick as a mouse-emulation fallback.
|
||||||
- Consoles/Tablet/Phone users: Consider using a Synergy 1.x server (on your PC) + uSynergy.c (in your console/tablet/phone app) to share your PC mouse/keyboard.
|
- Consoles/Tablet/Phone users: Consider using a Synergy 1.x server (on your PC) + uSynergy.c (on your console/tablet/phone app) to share your PC mouse/keyboard.
|
||||||
- On a TV/console system where readability may be lower or mouse inputs may be awkward, you may want to set the ImGuiConfigFlags_NavMoveMouse flag.
|
- On a TV/console system where readability may be lower or mouse inputs may be awkward, you may want to set the ImGuiConfigFlags_NavMoveMouse flag.
|
||||||
Enabling ImGuiConfigFlags_NavMoveMouse instructs dear imgui to move your mouse cursor along with navigation movements.
|
Enabling ImGuiConfigFlags_NavMoveMouse instructs dear imgui to move your mouse cursor along with navigation movements.
|
||||||
When enabled, the NewFrame() function may alter 'io.MousePos' and set 'io.WantMoveMouse' to notify you that it wants the mouse cursor to be moved.
|
When enabled, the NewFrame() function may alter 'io.MousePos' and set 'io.WantMoveMouse' to notify you that it wants the mouse cursor to be moved.
|
||||||
@ -250,6 +251,7 @@
|
|||||||
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
||||||
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||||
|
|
||||||
|
- 2018/03/08 (1.60) - Changed ImFont::DisplayOffset.y to default to 0 instead of +1. Fixed rounding of Ascent/Descent to match TrueType renderer. If you were adding or subtracting to ImFont::DisplayOffset check if your fonts are correctly aligned vertically.
|
||||||
- 2018/03/03 (1.60) - Renamed ImGuiStyleVar_Count_ to ImGuiStyleVar_COUNT and ImGuiMouseCursor_Count_ to ImGuiMouseCursor_COUNT for consistency with other public enums.
|
- 2018/03/03 (1.60) - Renamed ImGuiStyleVar_Count_ to ImGuiStyleVar_COUNT and ImGuiMouseCursor_Count_ to ImGuiMouseCursor_COUNT for consistency with other public enums.
|
||||||
- 2018/02/27 (1.XX) - removed io.DisplayVisibleMin, io.DisplayVisibleMax settings (it was used to clip within the DisplayPos..DisplayPos+Size range, I don't know of anyone using it)
|
- 2018/02/27 (1.XX) - removed io.DisplayVisibleMin, io.DisplayVisibleMax settings (it was used to clip within the DisplayPos..DisplayPos+Size range, I don't know of anyone using it)
|
||||||
- 2018/02/18 (1.60) - BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment.
|
- 2018/02/18 (1.60) - BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment.
|
||||||
|
11
imgui.h
11
imgui.h
@ -462,7 +462,7 @@ namespace ImGui
|
|||||||
// Drag and Drop
|
// Drag and Drop
|
||||||
// [BETA API] Missing Demo code. API may evolve.
|
// [BETA API] Missing Demo code. API may evolve.
|
||||||
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
|
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
|
||||||
IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t size, ImGuiCond cond = 0);// type is a user defined string of maximum 12 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
|
IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t size, ImGuiCond cond = 0);// type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
|
||||||
IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDragDropSource() returns true!
|
IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDragDropSource() returns true!
|
||||||
IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may receive an item. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()
|
IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may receive an item. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()
|
||||||
IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0); // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.
|
IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0); // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.
|
||||||
@ -758,7 +758,7 @@ enum ImGuiNavInput_
|
|||||||
ImGuiNavInput_TweakFast, // faster tweaks // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
|
ImGuiNavInput_TweakFast, // faster tweaks // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
|
||||||
|
|
||||||
// [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them.
|
// [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them.
|
||||||
// Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) may be directly reading from io.KeyDown[] instead of io.NavInputs[].
|
// Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from io.KeyDown[] instead of io.NavInputs[].
|
||||||
ImGuiNavInput_KeyMenu_, // toggle menu // = io.KeyAlt
|
ImGuiNavInput_KeyMenu_, // toggle menu // = io.KeyAlt
|
||||||
ImGuiNavInput_KeyLeft_, // move left // = Arrow keys
|
ImGuiNavInput_KeyLeft_, // move left // = Arrow keys
|
||||||
ImGuiNavInput_KeyRight_, // move right
|
ImGuiNavInput_KeyRight_, // move right
|
||||||
@ -1400,7 +1400,7 @@ struct ImGuiPayload
|
|||||||
ImGuiID SourceId; // Source item id
|
ImGuiID SourceId; // Source item id
|
||||||
ImGuiID SourceParentId; // Source parent id (if available)
|
ImGuiID SourceParentId; // Source parent id (if available)
|
||||||
int DataFrameCount; // Data timestamp
|
int DataFrameCount; // Data timestamp
|
||||||
char DataType[12 + 1]; // Data type tag (short user-supplied string, 12 characters max)
|
char DataType[32+1]; // Data type tag (short user-supplied string, 32 characters max)
|
||||||
bool Preview; // Set when AcceptDragDropPayload() was called and mouse has been hovering the target item (nb: handle overlapping drag targets)
|
bool Preview; // Set when AcceptDragDropPayload() was called and mouse has been hovering the target item (nb: handle overlapping drag targets)
|
||||||
bool Delivery; // Set when AcceptDragDropPayload() was called and mouse button is released over the target item.
|
bool Delivery; // Set when AcceptDragDropPayload() was called and mouse button is released over the target item.
|
||||||
|
|
||||||
@ -1680,7 +1680,7 @@ struct ImFontConfig
|
|||||||
float RasterizerMultiply; // 1.0f // Brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable.
|
float RasterizerMultiply; // 1.0f // Brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable.
|
||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
char Name[32]; // Name (strictly to ease debugging)
|
char Name[40]; // Name (strictly to ease debugging)
|
||||||
ImFont* DstFont;
|
ImFont* DstFont;
|
||||||
|
|
||||||
IMGUI_API ImFontConfig();
|
IMGUI_API ImFontConfig();
|
||||||
@ -1815,7 +1815,7 @@ struct ImFont
|
|||||||
// Members: Hot ~62/78 bytes
|
// Members: Hot ~62/78 bytes
|
||||||
float FontSize; // <user set> // Height of characters, set during loading (don't change after loading)
|
float FontSize; // <user set> // Height of characters, set during loading (don't change after loading)
|
||||||
float Scale; // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale()
|
float Scale; // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale()
|
||||||
ImVec2 DisplayOffset; // = (0.f,1.f) // Offset font rendering by xx pixels
|
ImVec2 DisplayOffset; // = (0.f,0.f) // Offset font rendering by xx pixels
|
||||||
ImVector<ImFontGlyph> Glyphs; // // All glyphs.
|
ImVector<ImFontGlyph> Glyphs; // // All glyphs.
|
||||||
ImVector<float> IndexAdvanceX; // // Sparse. Glyphs->AdvanceX in a directly indexable way (more cache-friendly, for CalcTextSize functions which are often bottleneck in large UI).
|
ImVector<float> IndexAdvanceX; // // Sparse. Glyphs->AdvanceX in a directly indexable way (more cache-friendly, for CalcTextSize functions which are often bottleneck in large UI).
|
||||||
ImVector<unsigned short> IndexLookup; // // Sparse. Index glyphs by Unicode code-point.
|
ImVector<unsigned short> IndexLookup; // // Sparse. Index glyphs by Unicode code-point.
|
||||||
@ -1828,6 +1828,7 @@ struct ImFont
|
|||||||
ImFontConfig* ConfigData; // // Pointer within ContainerAtlas->ConfigData
|
ImFontConfig* ConfigData; // // Pointer within ContainerAtlas->ConfigData
|
||||||
ImFontAtlas* ContainerAtlas; // // What we has been loaded into
|
ImFontAtlas* ContainerAtlas; // // What we has been loaded into
|
||||||
float Ascent, Descent; // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
|
float Ascent, Descent; // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
|
||||||
|
bool DirtyLookupTables;
|
||||||
int MetricsTotalSurface;// // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
|
int MetricsTotalSurface;// // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
|
@ -1525,6 +1525,7 @@ ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)
|
|||||||
|
|
||||||
const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85();
|
const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85();
|
||||||
ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, GetGlyphRangesDefault());
|
ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, GetGlyphRangesDefault());
|
||||||
|
font->DisplayOffset.y = 1.0f;
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1543,7 +1544,7 @@ ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels,
|
|||||||
// Store a short copy of filename into into the font name for convenience
|
// Store a short copy of filename into into the font name for convenience
|
||||||
const char* p;
|
const char* p;
|
||||||
for (p = filename + strlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\'; p--) {}
|
for (p = filename + strlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\'; p--) {}
|
||||||
snprintf(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "%s, %.0fpx", p, size_pixels);
|
ImFormatString(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "%s, %.0fpx", p, size_pixels);
|
||||||
}
|
}
|
||||||
return AddFontFromMemoryTTF(data, data_size, size_pixels, &font_cfg, glyph_ranges);
|
return AddFontFromMemoryTTF(data, data_size, size_pixels, &font_cfg, glyph_ranges);
|
||||||
}
|
}
|
||||||
@ -1817,13 +1818,15 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||||||
ImFontConfig& cfg = atlas->ConfigData[input_i];
|
ImFontConfig& cfg = atlas->ConfigData[input_i];
|
||||||
ImFontTempBuildData& tmp = tmp_array[input_i];
|
ImFontTempBuildData& tmp = tmp_array[input_i];
|
||||||
ImFont* dst_font = cfg.DstFont; // We can have multiple input fonts writing into a same destination font (when using MergeMode=true)
|
ImFont* dst_font = cfg.DstFont; // We can have multiple input fonts writing into a same destination font (when using MergeMode=true)
|
||||||
|
if (cfg.MergeMode)
|
||||||
|
dst_font->BuildLookupTable();
|
||||||
|
|
||||||
const float font_scale = stbtt_ScaleForPixelHeight(&tmp.FontInfo, cfg.SizePixels);
|
const float font_scale = stbtt_ScaleForPixelHeight(&tmp.FontInfo, cfg.SizePixels);
|
||||||
int unscaled_ascent, unscaled_descent, unscaled_line_gap;
|
int unscaled_ascent, unscaled_descent, unscaled_line_gap;
|
||||||
stbtt_GetFontVMetrics(&tmp.FontInfo, &unscaled_ascent, &unscaled_descent, &unscaled_line_gap);
|
stbtt_GetFontVMetrics(&tmp.FontInfo, &unscaled_ascent, &unscaled_descent, &unscaled_line_gap);
|
||||||
|
|
||||||
const float ascent = unscaled_ascent * font_scale;
|
const float ascent = ImFloor(unscaled_ascent * font_scale + ((unscaled_ascent > 0.0f) ? +1 : -1));
|
||||||
const float descent = unscaled_descent * font_scale;
|
const float descent = ImFloor(unscaled_descent * font_scale + ((unscaled_descent > 0.0f) ? +1 : -1));
|
||||||
ImFontAtlasBuildSetupFont(atlas, dst_font, &cfg, ascent, descent);
|
ImFontAtlasBuildSetupFont(atlas, dst_font, &cfg, ascent, descent);
|
||||||
const float off_x = cfg.GlyphOffset.x;
|
const float off_x = cfg.GlyphOffset.x;
|
||||||
const float off_y = cfg.GlyphOffset.y + (float)(int)(dst_font->Ascent + 0.5f);
|
const float off_y = cfg.GlyphOffset.y + (float)(int)(dst_font->Ascent + 0.5f);
|
||||||
@ -1960,6 +1963,7 @@ void ImFontAtlasBuildFinish(ImFontAtlas* atlas)
|
|||||||
|
|
||||||
// Build all fonts lookup tables
|
// Build all fonts lookup tables
|
||||||
for (int i = 0; i < atlas->Fonts.Size; i++)
|
for (int i = 0; i < atlas->Fonts.Size; i++)
|
||||||
|
if (atlas->Fonts[i]->DirtyLookupTables)
|
||||||
atlas->Fonts[i]->BuildLookupTable();
|
atlas->Fonts[i]->BuildLookupTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2136,7 +2140,7 @@ ImFont::ImFont()
|
|||||||
{
|
{
|
||||||
Scale = 1.0f;
|
Scale = 1.0f;
|
||||||
FallbackChar = (ImWchar)'?';
|
FallbackChar = (ImWchar)'?';
|
||||||
DisplayOffset = ImVec2(0.0f, 1.0f);
|
DisplayOffset = ImVec2(0.0f, 0.0f);
|
||||||
ClearOutputData();
|
ClearOutputData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2165,6 +2169,7 @@ void ImFont::ClearOutputData()
|
|||||||
ConfigData = NULL;
|
ConfigData = NULL;
|
||||||
ContainerAtlas = NULL;
|
ContainerAtlas = NULL;
|
||||||
Ascent = Descent = 0.0f;
|
Ascent = Descent = 0.0f;
|
||||||
|
DirtyLookupTables = true;
|
||||||
MetricsTotalSurface = 0;
|
MetricsTotalSurface = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2177,6 +2182,7 @@ void ImFont::BuildLookupTable()
|
|||||||
IM_ASSERT(Glyphs.Size < 0xFFFF); // -1 is reserved
|
IM_ASSERT(Glyphs.Size < 0xFFFF); // -1 is reserved
|
||||||
IndexAdvanceX.clear();
|
IndexAdvanceX.clear();
|
||||||
IndexLookup.clear();
|
IndexLookup.clear();
|
||||||
|
DirtyLookupTables = false;
|
||||||
GrowIndex(max_codepoint + 1);
|
GrowIndex(max_codepoint + 1);
|
||||||
for (int i = 0; i < Glyphs.Size; i++)
|
for (int i = 0; i < Glyphs.Size; i++)
|
||||||
{
|
{
|
||||||
@ -2241,6 +2247,7 @@ void ImFont::AddGlyph(ImWchar codepoint, float x0, float y0, float x1, float y1,
|
|||||||
glyph.AdvanceX = (float)(int)(glyph.AdvanceX + 0.5f);
|
glyph.AdvanceX = (float)(int)(glyph.AdvanceX + 0.5f);
|
||||||
|
|
||||||
// Compute rough surface usage metrics (+1 to account for average padding, +0.99 to round)
|
// Compute rough surface usage metrics (+1 to account for average padding, +0.99 to round)
|
||||||
|
DirtyLookupTables = true;
|
||||||
MetricsTotalSurface += (int)((glyph.U1 - glyph.U0) * ContainerAtlas->TexWidth + 1.99f) * (int)((glyph.V1 - glyph.V0) * ContainerAtlas->TexHeight + 1.99f);
|
MetricsTotalSurface += (int)((glyph.U1 - glyph.U0) * ContainerAtlas->TexWidth + 1.99f) * (int)((glyph.V1 - glyph.V0) * ContainerAtlas->TexHeight + 1.99f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ struct ImGuiContext
|
|||||||
ImGuiID DragDropAcceptIdPrev; // Target item id from previous frame (we need to store this to allow for overlapping drag and drop targets)
|
ImGuiID DragDropAcceptIdPrev; // Target item id from previous frame (we need to store this to allow for overlapping drag and drop targets)
|
||||||
int DragDropAcceptFrameCount; // Last time a target expressed a desire to accept the source
|
int DragDropAcceptFrameCount; // Last time a target expressed a desire to accept the source
|
||||||
ImVector<unsigned char> DragDropPayloadBufHeap; // We don't expose the ImVector<> directly
|
ImVector<unsigned char> DragDropPayloadBufHeap; // We don't expose the ImVector<> directly
|
||||||
unsigned char DragDropPayloadBufLocal[8];
|
unsigned char DragDropPayloadBufLocal[8]; // Local buffer for small payloads
|
||||||
|
|
||||||
// Widget state
|
// Widget state
|
||||||
ImGuiTextEditState InputTextState;
|
ImGuiTextEditState InputTextState;
|
||||||
|
@ -315,6 +315,8 @@ bool ImGuiFreeType::BuildFontAtlas(ImFontAtlas* atlas, unsigned int extra_flags)
|
|||||||
ImFontConfig& cfg = atlas->ConfigData[input_i];
|
ImFontConfig& cfg = atlas->ConfigData[input_i];
|
||||||
FreeTypeFont& font_face = fonts[input_i];
|
FreeTypeFont& font_face = fonts[input_i];
|
||||||
ImFont* dst_font = cfg.DstFont;
|
ImFont* dst_font = cfg.DstFont;
|
||||||
|
if (cfg.MergeMode)
|
||||||
|
dst_font->BuildLookupTable();
|
||||||
|
|
||||||
const float ascent = font_face.Info.Ascender;
|
const float ascent = font_face.Info.Ascender;
|
||||||
const float descent = font_face.Info.Descender;
|
const float descent = font_face.Info.Descender;
|
||||||
|
Loading…
Reference in New Issue
Block a user