mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Merge branch 'master' into viewport
# Conflicts: # examples/imgui_impl_opengl2.cpp # examples/imgui_impl_opengl3.cpp # imgui.cpp
This commit is contained in:
commit
e5f2295398
17
.github/CONTRIBUTING.md
vendored
17
.github/CONTRIBUTING.md
vendored
@ -14,19 +14,26 @@ You may use the Issue Tracker to submit bug reports, feature requests or suggest
|
||||
|
||||
**Guidelines to report an issue or ask a question:**
|
||||
- Please provide your imgui version number.
|
||||
- If you are discussing an assert or a crash, please provide a debugger callstack. Never state "it crashes" without additional information.
|
||||
- Please state if you have made substantial modifications to your copy of imgui.
|
||||
- When discussing issues related to rendering or inputs, please state the OS/back-end/renderer you are using. Please state if you are using a vanilla copy of one of the back-end (imgui_impl_xxx files), or a modified one, or if you built your own.
|
||||
- Try to be explicit with your expectations and what you have tried.
|
||||
- Try to be explicit with your expectations and what you have tried. What you have in mind or in your code is not obvious to other people.
|
||||
- If you are discussing an assert or a crash, please provide a debugger callstack. Never state "it crashes" without additional information. If you don't know how to use a debugger and retrieve a callstack, learning about it will be useful.
|
||||
- Please make sure that your compilation settings have asserts enabled. Calls to IM_ASSERT() are scattered in the code to help catch common issues. By default IM_ASSERT() calls the standard assert() function. To verify that your asserts are enabled, add the line `IM_ASSERT(false);` in your main() function. Your application should display an error message and abort. If your application report an error, it means that your asserts are disabled. Please make sure they are enabled.
|
||||
- When discussing issues related to rendering or inputs, please state the OS/back-end/renderer you are using. Please state if you are using a vanilla copy of the example back-ends (imgui_impl_XXX files), or a modified one, or if you built your own.
|
||||
- Please provide a Minimal, Complete and Verifiable Example ([MCVE](https://stackoverflow.com/help/mcve)) to demonstrate your problem. An ideal submission includes a small piece of code that anyone can paste in one of the examples/ application (e.g. in main.cpp or imgui_demo.cpp) to understand and reproduce it. Narrowing your problem to its shortest and purest form is the easiest way to understand it. Please test your shortened code to ensure it actually exhibit the problem. Often while creating the MCVE you will end up solving the problem! Many questions that are missing a standalone verifiable example are missing the actual cause of their issue in the description, which ends up wasting everyone's time.
|
||||
- Try to attach screenshots to clarify the context. They often convey useful information that are omitted by the description. You can drag pictures/files here (prefer github attachments over 3rd party hosting).
|
||||
- When requesting a new feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
||||
- Due to frequent abuse of this service from a certain category of users, if your GitHub account is anonymous and was created five minutes ago please understand that your post will receive more scrutiny and less patience for incomplete questions.
|
||||
|
||||
If you have been using dear imgui for a while or have been using C/C++ for several years or have demonstrated good behavior here, it is ok to not fullfill every item to the letter. Those are guidelines and experienced users of dear imgui will know what information are useful in a given context.
|
||||
**Some unfortunate words of warning**
|
||||
- If you are or were involved in cheating schemes (e.g. DLL injection) for competitive online multi-player games, please don't post here. We won't answer and you will be blocked. We've had too many of you. Please stop.
|
||||
- Due to frequent abuse of this service from aforementioned users, if your GitHub account is anonymous and was created five minutes ago please understand that your post will receive more scrutiny and incomplete questions may be dismissed.
|
||||
|
||||
If you have been using dear imgui for a while or have been using C/C++ for several years or have demonstrated good behavior here, it is ok to not fullfill every item to the letter. Those are guidelines and experienced users or members of the community will know what information are useful in a given context.
|
||||
|
||||
## How to create an Pull Request
|
||||
- When adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
||||
- When fixing a warning or compilation problem, please post the compiler log and specify the version and OS you are using.
|
||||
- Try to attach screenshots to clarify the context and demonstrate the feature at a glance. You can drag pictures/files here (prefer github attachments over 3rd party hosting).
|
||||
- Make sure your code follows the coding style already used in imgui (spaces instead of tabs, "local_variable", "FunctionName", "MemberName", etc.). We don't use modern C++ idioms and can compile without C++11.
|
||||
- Make sure you create a branch for the pull request. In Git, 1 PR is associated to 1 branch. If you keep pushing to the same branch after you submitted the PR, your new commits will appear in the PR (we can still cherry-pick individual commits).
|
||||
|
||||
Thank you for reading!
|
||||
|
9
.github/issue_template.md
vendored
9
.github/issue_template.md
vendored
@ -1,11 +1,12 @@
|
||||
You may use the Issue Tracker to ask for help and submit bug reports, feature requests or suggestions.
|
||||
|
||||
PLEASE CAREFULLY READ THIS DOCUMENT before doing so:
|
||||
[CONTRIBUTING.md](https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md).
|
||||
PLEASE CAREFULLY READ THIS DOCUMENT before submitting any issue:
|
||||
https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md
|
||||
(Click "Preview" to turn the URL above into a clickable link)
|
||||
|
||||
SELECT "PREVIEW CHANGES" TO TURN THE URL ABOVE INTO A CLICKABLE LINK.
|
||||
PLEASE MAKE SURE that you have: read the FAQ in imgui.cpp; explored the contents of ShowDemoWindow() including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the CONTRIBUTING.md file linked above.
|
||||
|
||||
(Delete everything above this section before submitting your issue. Please read the CONTRIBUTING.md file!)
|
||||
(Delete everything above this section before submitting your issue.)
|
||||
|
||||
----
|
||||
|
||||
|
4
.github/pull_request_template.md
vendored
4
.github/pull_request_template.md
vendored
@ -1,8 +1,8 @@
|
||||
- Please read https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md
|
||||
- When adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.).
|
||||
- When fixing a warning or compilation problem, please post the compiler log and specify the version and OS you are using.
|
||||
- Try to attach screenshots to clarify the context and demonstrate the feature at a glance.
|
||||
- Make sure your code follows the coding style already used in imgui (spaces instead of tabs, "local_variable", "FunctionName", "MemberName", etc.).
|
||||
- Make sure your code follows the coding style already used in imgui (spaces instead of tabs, "local_variable", "FunctionName", "MemberName", etc.). We don't use modern C++ idioms and can compile without C++11.
|
||||
- Make sure you create a branch for the pull request. In Git, 1 PR is associated to 1 branch. If you keep pushing to the same branch after you submitted the PR, your new commits will appear in the PR.
|
||||
- You can read [CONTRIBUTING.md](https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md) for more details.
|
||||
|
||||
(Clear this form before submitting your PR)
|
||||
|
@ -45,7 +45,9 @@ Other Changes:
|
||||
|
||||
- ArrowButton: Fixed to honor PushButtonRepeat() setting (and internals' ImGuiItemFlags_ButtonRepeat).
|
||||
- ArrowButton: Setup current line text baseline so that ArrowButton() + SameLine() + Text() are aligned properly.
|
||||
- Nav: Added a CTRL+TAB window list and changed the highlight system accordingly. This is designed to allow CTRL+TAB between Tabs in the future. (#787)
|
||||
- Nav: Added a CTRL+TAB window list and changed the highlight system accordingly. The change is motivated by upcoming Docking features. (#787)
|
||||
- Nav: Made CTRL+TAB skip menus + skip the current navigation window if is has the ImGuiWindow_NoNavFocus set. (#787)
|
||||
While it was previously possible, you won't be able to CTRL-TAB out and immediately back in a window with the ImGuiWindow_NoNavFocus flag.
|
||||
- Window: Allow menu and popups windows from ignoring the style.WindowMinSize values so short menus/popups are not padded. (#1909)
|
||||
- Window: Added global io.OptResizeWindowsFromEdges option to enable resizing windows from their edges and from the lower-left corner. (#1495)
|
||||
- Window: Collapse button shows hovering highlight + clicking and dragging on it allows to drag the window as well.
|
||||
@ -64,6 +66,9 @@ Other Changes:
|
||||
- Fixed horizontal mouse wheel not forwarding the request to the parent window if ImGuiWindowFlags_NoScrollWithMouse is set. (#1463, #1380, #1502)
|
||||
- Fixed a include build issue for Cygwin in non-POSIX (Win32) mode. (#1917, #1319, #276)
|
||||
- OS/Windows: Fixed missing ImmReleaseContext() call in the default Win32 IME handler. (#1932) [@vby]
|
||||
- Metrics: Changed io.MetricsActiveWindows to reflect the number of active windows (!= from visible windows), which is useful
|
||||
for lazy/idle render mechanisms as new windows are typically not visible for one frame.
|
||||
- Metrics: Added io.MetricsRenderWindow to reflect the number of visible windows.
|
||||
- Demo: Added basic Drag and Drop demo. (#143)
|
||||
- Demo: Clarified the use of IsItemHovered()/IsItemActive() right after being in the "Active, Focused, Hovered & Focused Tests" section.
|
||||
- Examples: Tweaked the main.cpp of each example.
|
||||
@ -75,6 +80,7 @@ Other Changes:
|
||||
- Examples: OpenGL3: Tweaked the imgui_impl_opengl3.cpp to work as-is with Emscripten + WebGL 2.0. (#1941). [@o-micron]
|
||||
- Examples: OpenGL3: Made the example app default to GL 3.0 + GLSL 130 (instead of GL 3.2 + GLSL 150) unless on Mac.
|
||||
- Examples: OpenGL3: Added error output when shaders fail to compile/link.
|
||||
- Examples: OpenGL2: Disabling/restoring GL_LIGHTING and GL_COLOR_MATERIAL to increase compatibility with legacy OpenGL applications. (#1996)
|
||||
- Examples: DirectX10, DirectX11: Fixed unreleased resources in Init and Shutdown functions. (#1944)
|
||||
- Examples: DirectX11: Querying for IDXGIFactory instead of IDXGIFactory1 to increase compatibility. (#1989) [@matt77hias]
|
||||
- Examples: Win32, Glfw, SDL: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||
|
@ -125,7 +125,7 @@ Languages: (third-party bindings)
|
||||
- Swift [swift-imgui](https://github.com/mnmly/Swift-imgui)
|
||||
|
||||
Frameworks:
|
||||
- Renderers: DirectX 9, DirectX 10, DirectX 11, DirectX 12, Metal, OpenGL2, OpenGL3+, Vulkan: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||
- Renderers: DirectX 9, DirectX 10, DirectX 11, DirectX 12, Metal, OpenGL2, OpenGL3+/ES2/ES3, Vulkan: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||
- Platform: GLFW, SDL, Win32, OSX, Freeglut: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||
- Framework: Allegro 5, Marmalade: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||
- Unmerged PR: SDL2 + OpenGLES + Emscripten: [#336](https://github.com/ocornut/imgui/pull/336)
|
||||
@ -168,7 +168,7 @@ User screenshots:
|
||||
<br>[Gallery Part 3](https://github.com/ocornut/imgui/issues/772) (Aug 2016 to Jan 2017)
|
||||
<br>[Gallery Part 4](https://github.com/ocornut/imgui/issues/973) (Jan 2017 to Aug 2017)
|
||||
<br>[Gallery Part 5](https://github.com/ocornut/imgui/issues/1269) (Aug 2017 to Feb 2018)
|
||||
<br>[Gallery Part 6](https://github.com/ocornut/imgui/issues/1607) (Feb 2018 onward)
|
||||
<br>[Gallery Part 6](https://github.com/ocornut/imgui/issues/1607) (Feb 2018 to June 2018)
|
||||
<br>[Gallery Part 7](https://github.com/ocornut/imgui/issues/1902) (June 2018 onward)
|
||||
<br>Also see the [Mega screenshots](https://github.com/ocornut/imgui/issues/1273) for an idea of the available features.
|
||||
|
||||
|
46
TODO.txt
46
TODO.txt
@ -32,6 +32,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- window: investigate better auto-positioning for new windows.
|
||||
- scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet.
|
||||
- scrolling/clipping: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y). (2017-08-20: can't repro)
|
||||
- scrolling/style: shadows on scrollable areas to denote that there is more contents
|
||||
|
||||
- drawdata: make it easy to clone (or swap?) a ImDrawData so user can easily save that data if they use threaded rendering.
|
||||
- drawlist: end-user probably can't call Clear() directly because we expect a texture to be pushed in the stack.
|
||||
@ -40,9 +41,10 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- drawlist: make it easier to toggle AA per primitive, so we can use e.g. non-AA fill + AA borders more naturally
|
||||
- drawlist: non-AA strokes have gaps between points (#593, #288), especially RenderCheckmark().
|
||||
- drawlist: would be good to be able to deep copy of ImDrawData (we have a deep copy of ImDrawList now).
|
||||
- drawlist/opt: AddRect() axis aligned pixel aligned (no-aa) could use 8 triangles instead of 16 and no normal calculation.
|
||||
- drawlist: rendering: provide a way for imgui to output to a single/global vertex buffer, re-order indices only at the end of the frame (ref: https://gist.github.com/floooh/10388a0afbe08fce9e617d8aefa7d302)
|
||||
- drawlist: callback: add an extra void* in ImDrawCallback to allow passing render-local data to the callback (would break API).
|
||||
- drawlist/opt: store rounded corners in texture to use 1 quad per corner (filled and wireframe) to lower the cost of rounding. (#1962)
|
||||
- drawlist/opt: AddRect() axis aligned pixel aligned (no-aa) could use 8 triangles instead of 16 and no normal calculation.
|
||||
|
||||
- main: considering adding an Init() function? some constructs are awkward in the implementation because of the lack of them.
|
||||
- main: find a way to preserve relative orders of multiple reappearing windows (so an app toggling between "modes" e.g. fullscreen vs all tools) won't lose relative ordering.
|
||||
@ -54,6 +56,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- widgets: clean up widgets internal toward exposing everything and stabilizing imgui_internals.h.
|
||||
- widgets: add visuals for Disabled/ReadOnly mode and expose publicly (#211)
|
||||
- widgets: add always-allow-overlap mode.
|
||||
- widgets: start exposing PushItemFlag() and ImGuiItemFlags
|
||||
- widgets: alignment options in style (e.g. center Selectable, Right-Align within Button, etc.) #1260
|
||||
- widgets: activate by identifier (trigger button, focus given id)
|
||||
- widgets: a way to represent "mixed" values, so e.g. all values replaced with **, including check-boxes, colors, etc. with support for multi-components widgets (e.g. SliderFloat3, make only "Y" mixed)
|
||||
@ -70,13 +73,13 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- input text: easier ways to update buffer (from source char*) while owned. preserve some sort of cursor position for multi-line text.
|
||||
- input text: add discard flag (e.g. ImGuiInputTextFlags_DiscardActiveBuffer) or make it easier to clear active focus for text replacement during edition (#725)
|
||||
- input text: display bug when clicking a drag/slider after an input text in a different window has all-selected text (order dependent). actually a very old bug but no one appears to have noticed it.
|
||||
- input text: allow centering/positioning text so that ctrl+clicking Drag or Slider keeps the textual value at the same pixel position.
|
||||
- input text: what's the easiest way to implement a nice IP/Mac address input editor?
|
||||
- input text multi-line: don't directly call AddText() which does an unnecessary vertex reserve for character count prior to clipping. and/or more line-based clipping to AddText(). and/or reorganize TextUnformatted/RenderText for more efficiency for large text (e.g TextUnformatted could clip and log separately, etc).
|
||||
- input text multi-line: support for cut/paste without selection (cut/paste the current line)
|
||||
- input text multi-line: line numbers? status bar? (follow up on #200)
|
||||
- input text multi-line: behave better when user changes input buffer while editing is active (even though it is illegal behavior). namely, the change of buffer can create a scrollbar glitch (#725)
|
||||
- input text multi-line: better horizontal scrolling support (#383, #1224)
|
||||
- input text: allow centering/positioning text so that ctrl+clicking Drag or Slider keeps the textual value at the same pixel position.
|
||||
- input text: what's the easiest way to implement a nice IP/Mac address input editor?
|
||||
- input number: optional range min/max for Input*() functions
|
||||
- input number: holding [-]/[+] buttons could increase the step speed non-linearly (or user-controlled)
|
||||
- input number: use mouse wheel to step up/down
|
||||
@ -104,7 +107,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
|
||||
!- color: the color conversion helpers/types are a mess and needs sorting out.
|
||||
- color: (api breaking) ImGui::ColorConvertXXX functions should be loose ImColorConvertXX to match imgui_internals.h
|
||||
- coloredit: it is still somehow awkward to copy colors around (unless going through Hex mode).
|
||||
|
||||
- plot: full featured plot/graph api w/ scrolling, zooming etc. all bell & whistle. why not!
|
||||
- plot: PlotLines() should use the polygon-stroke facilities, less vertices (currently issues with averaging normals)
|
||||
@ -126,17 +128,17 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
|
||||
- tabs: re-ordering, close buttons, context menu, persistent order (#261, #351)
|
||||
|
||||
- ext: stl-ish friendly extension (imgui_stl.h) that has wrapped for std::string, std::vector etc.
|
||||
- ext: stl-ish friendly extension (imgui_stl.h) that has wrapper for std::string, std::vector etc.
|
||||
|
||||
- button: provide a button that looks framed.
|
||||
- image/image button: misalignment on padded/bordered button?
|
||||
- image/image button: parameters are confusing, image() has tint_col,border_col whereas imagebutton() has bg_col/tint_col. Even thou they are different parameters ordering could be more consistent. can we fix that?
|
||||
- image button: not taking an explicit id is odd.
|
||||
- slider: allow using the [-]/[+] buttons used by InputFloat()/InputInt()
|
||||
- slider: initial absolute click is imprecise. change to relative movement slider (same as scrollbar).
|
||||
- slider: initial absolute click is imprecise. change to relative movement slider (same as scrollbar). (#1946)
|
||||
- slider: add dragging-based widgets to edit values with mouse (on 2 axises), saving screen real-estate.
|
||||
- slider: tint background based on value (e.g. v_min -> v_max, or use 0.0f either side of the sign)
|
||||
- slider: precision dragging
|
||||
- slider: relative dragging? + precision dragging
|
||||
- slider: step option (#1183)
|
||||
- slider style: fill % of the bar instead of positioning a drag.
|
||||
- knob: rotating knob widget (#942)
|
||||
@ -157,6 +159,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- listbox: scrolling should track modified selection.
|
||||
|
||||
!- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402)
|
||||
- popups/modal: make modal title bar blink when trying to click outside the modal
|
||||
- popups: reopening context menu at new position should be the behavior by default? (equivalent to internal OpenPopupEx() with reopen_existing=true) (~#1497)
|
||||
- popups: if the popup functions took explicit ImGuiID it would allow the user to manage the scope of those ID. (#331)
|
||||
- popups: clicking outside (to close popup) and holding shouldn't drag window below.
|
||||
@ -165,15 +168,15 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- tooltip: drag and drop with tooltip near monitor edges lose/changes its last direction instead of locking one. The drag and drop tooltip should always follow without changing direction.
|
||||
- tooltip: tooltip that doesn't fit in entire screen seems to lose their "last preferred direction" and may teleport when moving mouse.
|
||||
- tooltip: allow to set the width of a tooltip to allow TextWrapped() etc. while keeping the height automatic.
|
||||
- tooltip: tooltips with delay timers? or general timer policy? (instantaneous vs timed) (#1485)
|
||||
- tooltip: tooltips with delay timers? or general timer policy? (instantaneous vs timed): IsItemHovered() with timer + implicit aabb-id for items with no ID. (#1485)
|
||||
|
||||
- menus: calling BeginMenu() twice with a same name doesn't append as Begin() does for regular windows (#1207)
|
||||
- menus: menu bars inside modals windows are acting weird.
|
||||
- statusbar: add a per-window status bar helper similar to what menubar does.
|
||||
- menus: menu bars inside modal windows are acting weird.
|
||||
- status-bar: add a per-window status bar helper similar to what menu-bar does.
|
||||
- shortcuts: local-style shortcut api, e.g. parse "&Save"
|
||||
- shortcuts,menus: global-style shortcut api e.g. "Save (CTRL+S)" -> explicit flag for recursing into closed menu
|
||||
- shortcuts: programmatically access shortcuts "Focus("&Save"))
|
||||
- menus: menubars: main menu-bar could affect clamping of windows position (~ akin to modifying DisplayMin)
|
||||
- menus: menu-bar: main menu-bar could affect clamping of windows position (~ akin to modifying DisplayMin)
|
||||
- menus: hovering from menu to menu on a menu-bar has 1 frame without any menu, which is a little annoying. ideally either 0 either longer.
|
||||
|
||||
- text: selectable text (for copy) as a generic feature (ItemFlags?)
|
||||
@ -198,7 +201,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
!- style: better default styles. (#707)
|
||||
- style: add a highlighted text color (for headers, etc.)
|
||||
- style: border types: out-screen, in-screen, etc. (#447)
|
||||
- style/optimization: store rounded corners in texture to use 1 quad per corner (filled and wireframe) to lower the cost of rounding.
|
||||
- style: add window shadow (fading away from the window. Paint-style calculation of vertices alpha after drawlist would be easier)
|
||||
- style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc.
|
||||
- style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation).
|
||||
@ -214,16 +216,17 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- log: let user copy any window content to clipboard easily (CTRL+C on windows? while moving it? context menu?). code is commented because it fails with multiple Begin/End pairs.
|
||||
|
||||
- filters: set a current filter that tree node can automatically query to hide themselves
|
||||
- filters: handle wildcards (with implicit leading/trailing *), regexps
|
||||
- filters: handle wild-cards (with implicit leading/trailing *), reg-exprs
|
||||
- filters: fuzzy matches (may use code at blog.forrestthewoods.com/4cffeed33fdb)
|
||||
|
||||
- drag and drop: add demo. (#143, #479)
|
||||
- drag and drop: have some way to know when a drag begin from BeginDragDropSource() pov
|
||||
- drag and drop: have some way to know when a drag begin from BeginDragDropSource() pov.
|
||||
- drag and drop: allow preview tooltip to be submitted from a different place than the drag source. (#1725)
|
||||
- drag and drop: allow using with other mouse buttons (where activeid won't be set). (#1637)
|
||||
- drag and drop: make it easier and provide a demo to have tooltip both are source and target site, with a more detailed one on target site (tooltip ordering problem)
|
||||
- drag and drop: test with reordering nodes (in a list, or a tree node). (#143)
|
||||
- drag and drop: test integrating with os drag and drop.
|
||||
- drag and drop: test integrating with os drag and drop (make it easy to do a naive WM_DROPFILE integration)
|
||||
- drag and drop: make payload optional? (#143)
|
||||
- drag and drop: feedback when hovering a modal (cursor?)
|
||||
- node/graph editor (#306)
|
||||
- pie menus patterns (#434)
|
||||
- markup: simple markup language for color change? (#902)
|
||||
@ -251,15 +254,16 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- font: fix AddRemapChar() to work before font has been built.
|
||||
- font: (api breaking) removed "TTF" from symbol names. also because it now supports OTF.
|
||||
|
||||
- nav: wrap around logic to allow e.g. grid based layout (pressing NavRight on the right-most element would go to the next row, etc.)
|
||||
- nav: wrap around logic to allow e.g. grid based layout (pressing NavRight on the right-most element would go to the next row, etc.). see internal's NavMoveRequestTryWrapping().
|
||||
- nav: patterns to make it possible for arrows key to update selection
|
||||
- nav: restore/find nearest navid when current one disappear (e.g. pressed a button that disappear, or perhaps auto restoring when current button change name)
|
||||
- nav: SetItemDefaultFocus() level of priority, so widget like Selectable when inside a popup could claim a low-priority default focus on the first selected iem
|
||||
- nav: allow input system to be be more tolerant of io.DeltaTime=0.0f
|
||||
- nav: ESC within a menu of a child window seems to exit the child window.
|
||||
- nav: NavFlattened: ESC on a flattened child should select something.
|
||||
- nav: NavFlattened: broken: in typical usage scenario, the items of a fully clipped child are currently not considered to enter into a NavFlattened child.
|
||||
- nav: NavFlattened: init request doesn't select items that are part of a NavFlattened child
|
||||
- nav: NavFlattened: cannot access menubar of a flattened child window with Alt/menu key (not a very common use case..).
|
||||
- nav: NavFlattened: cannot access menu-bar of a flattened child window with Alt/menu key (not a very common use case..).
|
||||
- nav: Left within a tree node block as a fallback (ImGuiTreeNodeFlags_NavLeftJumpsBackHere by default?)
|
||||
- nav: menus: pressing left-right on a vertically clipped menu bar tends to jump to the collapse/close buttons.
|
||||
- nav: menus: allow pressing Menu to leave a sub-menu.
|
||||
@ -300,19 +304,17 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
|
||||
- backend: bgfx? https://gist.github.com/RichardGale/6e2b74bc42b3005e08397236e4be0fd0
|
||||
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
|
||||
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
|
||||
- web/emscriptem: with refactored examples, we could provide a direct imgui_impl_emscripten platform layer (see eg. https://github.com/floooh/sokol-samples/blob/master/html5/imgui-emsc.cc#L42)
|
||||
|
||||
- remote: make a system like RemoteImGui first-class citizen/project (#75)
|
||||
|
||||
- demo: find a way to demonstrate textures in the examples application, as it such a a common issue for new users.
|
||||
- demo: add drag and drop demo.
|
||||
- demo: add vertical separator demo
|
||||
- demo: add virtual scrolling example?
|
||||
- demo: demonstration Plot offset
|
||||
- examples: window minimize, maximize (#583)
|
||||
- examples: provide a zero-framerate/idle example.
|
||||
- examples: apple: apple_example should be using modern GL3.
|
||||
- examples: provide a zero frame-rate/idle example.
|
||||
- examples: apple: example_apple should be using modern GL3.
|
||||
- examples: glfw: could go idle when minimized? if (glfwGetWindowAttrib(window, GLFW_ICONIFIED)) { glfwWaitEvents(); continue; } // issue: DeltaTime will be super high on resume, perhaps provide a way to let impl know (#440)
|
||||
- optimization: replace vsnprintf with stb_printf? or enable the defines/infrastructure to allow it (#1038)
|
||||
- optimization: add clipping for multi-component widgets (SliderFloatX, ColorEditX, etc.). one problem is that nav branch can't easily clip parent group when there is a move request.
|
||||
|
@ -118,7 +118,7 @@ List of Renderer Bindings in this repository:
|
||||
imgui_impl_dx12.cpp ; DirectX12
|
||||
imgui_impl_metal.mm ; Metal (with ObjC)
|
||||
imgui_impl_opengl2.cpp ; OpenGL2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
|
||||
imgui_impl_opengl3.cpp ; OpenGL3 (modern programmable pipeline)
|
||||
imgui_impl_opengl3.cpp ; OpenGL3, OpenGL ES 2, OpenGL ES 3 (modern programmable pipeline)
|
||||
imgui_impl_vulkan.cpp ; Vulkan
|
||||
|
||||
List of high-level Frameworks Bindings in this repository: (combine Platform + Renderer)
|
||||
@ -192,7 +192,7 @@ example_glfw_opengl2/
|
||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
|
||||
|
||||
example_glfw_opengl3/
|
||||
GLFW (Win32, Mac, Linux) + OpenGL3+ example (programmable pipeline, binding modern functions with GL3W).
|
||||
GLFW (Win32, Mac, Linux) + OpenGL3+/ES2/ES3 example (programmable pipeline, binding modern functions with GL3W).
|
||||
This uses more modern OpenGL calls and custom shaders.
|
||||
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
|
||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
|
||||
@ -213,7 +213,7 @@ example_sdl_opengl2/
|
||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
|
||||
|
||||
example_sdl_opengl3/
|
||||
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+ example.
|
||||
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+/ES2/ES3 example.
|
||||
This uses more modern OpenGL calls and custom shaders.
|
||||
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
|
||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
|
||||
|
@ -5,18 +5,18 @@
|
||||
|
||||
```
|
||||
set SDL2DIR=path_to_your_sdl2_folder
|
||||
cl /Zi /MD /I %SDL2DIR%\include /I ..\.. main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /link /LIBPATH:%SDL2DIR%\lib SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
||||
cl /Zi /MD /I %SDL2DIR%\include /I .. /I ..\.. main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /link /LIBPATH:%SDL2DIR%\lib SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
||||
```
|
||||
|
||||
- On Linux and similar Unixes
|
||||
|
||||
```
|
||||
c++ `sdl2-config --cflags` -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL
|
||||
c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL
|
||||
```
|
||||
|
||||
- On Mac OS X
|
||||
|
||||
```
|
||||
brew install sdl2
|
||||
c++ `sdl2-config --cflags` -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl
|
||||
c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl
|
||||
```
|
||||
|
@ -5,18 +5,18 @@
|
||||
|
||||
```
|
||||
set SDL2DIR=path_to_your_sdl2_folder
|
||||
cl /Zi /MD /I ..\.. /I ..\libs\gl3w /I %SDL2DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /link /libpath:%SDL2DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
||||
cl /Zi /MD /I .. /I ..\.. /I ..\libs\gl3w /I %SDL2DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /link /libpath:%SDL2DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console
|
||||
```
|
||||
|
||||
- On Linux and similar Unixes
|
||||
|
||||
```
|
||||
c++ `sdl2-config --cflags` -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -lGL -ldl
|
||||
c++ `sdl2-config --cflags` -I .. -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -lGL -ldl
|
||||
```
|
||||
|
||||
- On Mac OS X
|
||||
|
||||
```
|
||||
brew install sdl2
|
||||
c++ `sdl2-config --cflags` -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -framework OpenGl -framework CoreFoundation
|
||||
c++ `sdl2-config --cflags` -I .. -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -framework OpenGl -framework CoreFoundation
|
||||
```
|
||||
|
@ -219,7 +219,8 @@ void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data)
|
||||
ctx->RSSetScissorRects(1, &r);
|
||||
|
||||
// Bind texture, Draw
|
||||
ctx->PSSetShaderResources(0, 1, (ID3D10ShaderResourceView**)&pcmd->TextureId);
|
||||
ID3D10ShaderResourceView* texture_srv = (ID3D10ShaderResourceView*)pcmd->TextureId;
|
||||
ctx->PSSetShaderResources(0, 1, &texture_srv);
|
||||
ctx->DrawIndexed(pcmd->ElemCount, idx_offset, vtx_offset);
|
||||
}
|
||||
idx_offset += pcmd->ElemCount;
|
||||
@ -285,7 +286,7 @@ static void ImGui_ImplDX10_CreateFontsTexture()
|
||||
}
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (void *)g_pFontTextureView;
|
||||
io.Fonts->TexID = (ImTextureID)g_pFontTextureView;
|
||||
|
||||
// Create texture sampler
|
||||
{
|
||||
|
@ -224,7 +224,8 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
|
||||
ctx->RSSetScissorRects(1, &r);
|
||||
|
||||
// Bind texture, Draw
|
||||
ctx->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&pcmd->TextureId);
|
||||
ID3D11ShaderResourceView* texture_srv = (ID3D11ShaderResourceView*)pcmd->TextureId;
|
||||
ctx->PSSetShaderResources(0, 1, &texture_srv);
|
||||
ctx->DrawIndexed(pcmd->ElemCount, idx_offset, vtx_offset);
|
||||
}
|
||||
idx_offset += pcmd->ElemCount;
|
||||
@ -292,7 +293,7 @@ static void ImGui_ImplDX11_CreateFontsTexture()
|
||||
}
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (void *)g_pFontTextureView;
|
||||
io.Fonts->TexID = (ImTextureID)g_pFontTextureView;
|
||||
|
||||
// Create texture sampler
|
||||
{
|
||||
|
@ -369,7 +369,7 @@ static void ImGui_ImplDX12_CreateFontsTexture()
|
||||
|
||||
// Store our identifier
|
||||
static_assert(sizeof(ImTextureID) >= sizeof(g_hFontSrvGpuDescHandle.ptr), "Can't pack descriptor handle into TexID, 32-bit not supported yet.");
|
||||
io.Fonts->TexID = (void *)g_hFontSrvGpuDescHandle.ptr;
|
||||
io.Fonts->TexID = (ImTextureID)g_hFontSrvGpuDescHandle.ptr;
|
||||
}
|
||||
|
||||
bool ImGui_ImplDX12_CreateDeviceObjects()
|
||||
|
@ -177,7 +177,8 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
|
||||
else
|
||||
{
|
||||
const RECT r = { (LONG)(pcmd->ClipRect.x - pos.x), (LONG)(pcmd->ClipRect.y - pos.y), (LONG)(pcmd->ClipRect.z - pos.x), (LONG)(pcmd->ClipRect.w - pos.y) };
|
||||
g_pd3dDevice->SetTexture(0, (LPDIRECT3DTEXTURE9)pcmd->TextureId);
|
||||
const LPDIRECT3DTEXTURE9 texture = (LPDIRECT3DTEXTURE9)pcmd->TextureId;
|
||||
g_pd3dDevice->SetTexture(0, texture);
|
||||
g_pd3dDevice->SetScissorRect(&r);
|
||||
g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, vtx_offset, 0, (UINT)cmd_list->VtxBuffer.Size, idx_offset, pcmd->ElemCount/3);
|
||||
}
|
||||
@ -228,7 +229,7 @@ static bool ImGui_ImplDX9_CreateFontsTexture()
|
||||
g_FontTexture->UnlockRect(0);
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (void *)g_FontTexture;
|
||||
io.Fonts->TexID = (ImTextureID)g_FontTexture;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ bool ImGui_Marmalade_CreateDeviceObjects()
|
||||
g_FontTexture->Upload();
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (void *)g_FontTexture;
|
||||
io.Fonts->TexID = (ImTextureID)g_FontTexture;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ bool ImGui_ImplMetal_CreateFontsTexture(id<MTLDevice> device)
|
||||
[g_sharedMetalContext makeFontTextureWithDevice:device];
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.Fonts->TexID = (__bridge void *)g_sharedMetalContext.fontTexture;
|
||||
io.Fonts->TexID = (__bridge void *)g_sharedMetalContext.fontTexture; // ImTextureID == void*
|
||||
|
||||
return (g_sharedMetalContext.fontTexture != nil);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2018-08-03: OpenGL: Disabling/restoring GL_LIGHTING and GL_COLOR_MATERIAL to increase compatibility with legacy OpenGL applications.
|
||||
// 2018-06-08: Misc: Extracted imgui_impl_opengl2.cpp/.h away from the old combined GLFW/SDL+OpenGL2 examples.
|
||||
// 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
||||
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplGlfwGL2_RenderDrawData() in the .h file so you can call it yourself.
|
||||
@ -102,6 +103,8 @@ void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data)
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_COLOR_MATERIAL);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
@ -191,7 +194,7 @@ bool ImGui_ImplOpenGL2_CreateFontsTexture()
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
|
||||
io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontTexture;
|
||||
|
||||
// Restore state
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// ImGui Renderer for: OpenGL3 (modern OpenGL with shaders / programmatic pipeline)
|
||||
// ImGui Renderer for: OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
|
||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2018-08-09: OpenGL: Default to OpenGL ES 3 on iOS and Android. GLSL version default to "#version 300 ES".
|
||||
// 2018-07-30: OpenGL: Support for GLSL 300 ES and 410 core. Fixes for Emscripten compilation.
|
||||
// 2018-07-10: OpenGL: Support for more GLSL versions (based on the GLSL version string). Added error output when shaders fail to compile/link.
|
||||
// 2018-06-08: Misc: Extracted imgui_impl_opengl3.cpp/.h away from the old combined GLFW/SDL+OpenGL3 examples.
|
||||
@ -59,14 +60,24 @@
|
||||
#else
|
||||
#include <stdint.h> // intptr_t
|
||||
#endif
|
||||
#if defined(__APPLE__)
|
||||
#include "TargetConditionals.h"
|
||||
#endif
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
// iOS, Android and Emscripten can use GL ES 3
|
||||
// Call ImGui_ImplOpenGL3_Init() with "#version 300 es"
|
||||
#if (defined(__APPLE__) && TARGET_OS_IOS) || (defined(__ANDROID__)) || (defined(__EMSCRIPTEN__))
|
||||
#define USE_GL_ES3
|
||||
#endif
|
||||
|
||||
#ifdef USE_GL_ES3
|
||||
// OpenGL ES 3
|
||||
#include <GLES3/gl3.h> // Use GL ES 3
|
||||
#else
|
||||
// About OpenGL function loaders:
|
||||
// Modern OpenGL requires individual functions to be loaded manually. Helper libraries are often used for this purpose.
|
||||
// Here we are using gl3w.h, which requires a call to gl3wInit().
|
||||
// You may use another any other loader/header of your choice, such as glew, glext, glad, glLoadGen, etc.
|
||||
// OpenGL Regular
|
||||
// (About OpenGL function loaders: modern OpenGL doesn't have a standard header file and requires individual functions to be loaded manually.
|
||||
// Helper libraries are often used for this purpose! Here we are using gl3w.h, which requires a call to gl3wInit().
|
||||
// You may use another any other loader/header of your choice, such as glew, glext, glad, glLoadGen, etc.)
|
||||
#include <GL/gl3w.h>
|
||||
//#include <glew.h>
|
||||
//#include <glext.h>
|
||||
@ -89,8 +100,13 @@ static void ImGui_ImplOpenGL3_ShutdownPlatformInterface();
|
||||
bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
||||
{
|
||||
// Store GLSL version string so we can refer to it later in case we recreate shaders. Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
|
||||
#ifdef USE_GL_ES3
|
||||
if (glsl_version == NULL)
|
||||
glsl_version = "#version 300 es";
|
||||
#else
|
||||
if (glsl_version == NULL)
|
||||
glsl_version = "#version 130";
|
||||
#endif
|
||||
IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(g_GlslVersionString));
|
||||
strcpy(g_GlslVersionString, glsl_version);
|
||||
strcat(g_GlslVersionString, "\n");
|
||||
@ -277,7 +293,7 @@ bool ImGui_ImplOpenGL3_CreateFontsTexture()
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
|
||||
io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontTexture;
|
||||
|
||||
// Restore state
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// ImGui Renderer for: OpenGL3 (modern OpenGL with shaders / programmatic pipeline)
|
||||
// ImGui Renderer for: OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
|
||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
|
||||
|
||||
@ -16,8 +16,9 @@
|
||||
// You may use another any other loader/header of your choice, such as glew, glext, glad, glLoadGen, etc.
|
||||
|
||||
// About GLSL version:
|
||||
// The 'glsl_version' initialization parameter defaults to "#version 130" if NULL.
|
||||
// Only override if your GL version doesn't handle this GLSL version (see table at the top of imgui_impl_opengl3.cpp). Keep NULL if unsure!
|
||||
// The 'glsl_version' initialization parameter should be NULL (default) or a "#version XXX" string.
|
||||
// On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es"
|
||||
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown();
|
||||
|
@ -466,7 +466,7 @@ bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer)
|
||||
}
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (void *)(intptr_t)g_FontImage;
|
||||
io.Fonts->TexID = (ImTextureID)(intptr_t)g_FontImage;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -9,7 +9,9 @@
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_win32.h"
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
|
103
imgui.cpp
103
imgui.cpp
@ -859,14 +859,23 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static const ImS32 IM_S32_MIN = 0x80000000; // INT_MIN;
|
||||
static const ImS32 IM_S32_MAX = 0x7FFFFFFF; // INT_MAX;
|
||||
static const ImS32 IM_S32_MIN = INT_MIN; // (-2147483647 - 1), (0x80000000);
|
||||
static const ImS32 IM_S32_MAX = INT_MAX; // (2147483647), (0x7FFFFFFF)
|
||||
static const ImU32 IM_U32_MIN = 0;
|
||||
static const ImU32 IM_U32_MAX = 0xFFFFFFFF;
|
||||
static const ImS64 IM_S64_MIN = -9223372036854775807ll - 1ll;
|
||||
static const ImS64 IM_S64_MAX = 9223372036854775807ll;
|
||||
static const ImU32 IM_U32_MAX = UINT_MAX; // (0xFFFFFFFF)
|
||||
#ifdef LLONG_MIN
|
||||
static const ImS64 IM_S64_MIN = LLONG_MIN; // (-9223372036854775807ll - 1ll);
|
||||
static const ImS64 IM_S64_MAX = LLONG_MAX; // (9223372036854775807ll);
|
||||
#else
|
||||
static const ImS64 IM_S64_MIN = -9223372036854775807LL - 1;
|
||||
static const ImS64 IM_S64_MAX = 9223372036854775807LL;
|
||||
#endif
|
||||
static const ImU64 IM_U64_MIN = 0;
|
||||
static const ImU64 IM_U64_MAX = 0xFFFFFFFFFFFFFFFFull;
|
||||
#ifdef ULLONG_MAX
|
||||
static const ImU64 IM_U64_MAX = ULLONG_MAX; // (0xFFFFFFFFFFFFFFFFull);
|
||||
#else
|
||||
static const ImU64 IM_U64_MAX = (2ULL * 9223372036854775807LL + 1);
|
||||
#endif
|
||||
|
||||
// When using CTRL+TAB (or Gamepad Square+L/R) we delay the visual a little in order to reduce visual noise doing a fast switch.
|
||||
static const float NAV_WINDOWING_HIGHLIGHT_DELAY = 0.20f; // Time before the highlight and screen dimming starts fading in
|
||||
@ -2148,7 +2157,7 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name)
|
||||
Active = WasActive = false;
|
||||
WriteAccessed = false;
|
||||
Collapsed = false;
|
||||
CollapseToggleWanted = false;
|
||||
WantCollapseToggle = false;
|
||||
SkipItems = false;
|
||||
Appearing = false;
|
||||
Hidden = false;
|
||||
@ -3060,7 +3069,7 @@ static int FindWindowIndex(ImGuiWindow* window) // FIXME-OPT O(N)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static ImGuiWindow* FindWindowNavigable(int i_start, int i_stop, int dir) // FIXME-OPT O(N)
|
||||
static ImGuiWindow* FindWindowNavFocusable(int i_start, int i_stop, int dir) // FIXME-OPT O(N)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
for (int i = i_start; i >= 0 && i < g.Windows.Size && i != i_stop; i += dir)
|
||||
@ -3132,9 +3141,9 @@ static void NavUpdateWindowingHighlightWindow(int focus_change_dir)
|
||||
return;
|
||||
|
||||
const int i_current = FindWindowIndex(g.NavWindowingTarget);
|
||||
ImGuiWindow* window_target = FindWindowNavigable(i_current + focus_change_dir, -INT_MAX, focus_change_dir);
|
||||
ImGuiWindow* window_target = FindWindowNavFocusable(i_current + focus_change_dir, -INT_MAX, focus_change_dir);
|
||||
if (!window_target)
|
||||
window_target = FindWindowNavigable((focus_change_dir < 0) ? (g.Windows.Size - 1) : 0, i_current, focus_change_dir);
|
||||
window_target = FindWindowNavFocusable((focus_change_dir < 0) ? (g.Windows.Size - 1) : 0, i_current, focus_change_dir);
|
||||
if (window_target) // Don't reset windowing target if there's a single window in the list
|
||||
g.NavWindowingTarget = g.NavWindowingTargetAnim = window_target;
|
||||
g.NavWindowingToggleLayer = false;
|
||||
@ -3166,7 +3175,7 @@ static void ImGui::NavUpdateWindowing()
|
||||
bool start_windowing_with_gamepad = !g.NavWindowingTarget && IsNavInputPressed(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed);
|
||||
bool start_windowing_with_keyboard = !g.NavWindowingTarget && g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab) && (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard);
|
||||
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
||||
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavigable(g.Windows.Size - 1, -INT_MAX, -1))
|
||||
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.Windows.Size - 1, -INT_MAX, -1))
|
||||
{
|
||||
g.NavWindowingTarget = g.NavWindowingTargetAnim = window;
|
||||
g.NavWindowingTimer = g.NavWindowingHighlightAlpha = 0.0f;
|
||||
@ -3299,7 +3308,7 @@ void ImGui::NavUpdateWindowingList()
|
||||
SetNextWindowSizeConstraints(ImVec2(viewport->Size.x * 0.20f, viewport->Size.y * 0.20f), ImVec2(FLT_MAX, FLT_MAX));
|
||||
SetNextWindowPos(viewport->Pos + viewport->Size * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
PushStyleVar(ImGuiStyleVar_WindowPadding, g.Style.WindowPadding * 2.0f);
|
||||
Begin("###NavWindowingList", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_AlwaysAutoResize);
|
||||
Begin("###NavWindowingList", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings);
|
||||
for (int n = g.Windows.Size - 1; n >= 0; n--)
|
||||
{
|
||||
ImGuiWindow* window = g.Windows[n];
|
||||
@ -4888,6 +4897,8 @@ static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* d
|
||||
|
||||
static void AddWindowToDrawData(ImGuiWindow* window, int layer)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.IO.MetricsRenderWindows++;
|
||||
AddDrawListToDrawData(&window->Viewport->DrawDataBuilder.Layers[layer], window->DrawList);
|
||||
for (int i = 0; i < window->DC.ChildWindows.Size; i++)
|
||||
{
|
||||
@ -4900,8 +4911,6 @@ static void AddWindowToDrawData(ImGuiWindow* window, int layer)
|
||||
// Layer is locked for the root window, however child windows may use a different viewport (e.g. extruding menu)
|
||||
static void AddRootWindowToDrawData(ImGuiWindow* window)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.IO.MetricsActiveWindows++;
|
||||
int layer = (window->Flags & ImGuiWindowFlags_Tooltip) ? 1 : 0;
|
||||
AddWindowToDrawData(window, layer);
|
||||
}
|
||||
@ -5087,6 +5096,7 @@ void ImGui::EndFrame()
|
||||
|
||||
IM_ASSERT(g.Windows.Size == g.WindowsSortBuffer.Size); // we done something wrong
|
||||
g.Windows.swap(g.WindowsSortBuffer);
|
||||
g.IO.MetricsActiveWindows = g.WindowsActiveCount;
|
||||
|
||||
// Unlock font atlas
|
||||
g.IO.Fonts->Locked = false;
|
||||
@ -5109,8 +5119,8 @@ void ImGui::Render()
|
||||
ImGui::EndFrame();
|
||||
g.FrameCountRendered = g.FrameCount;
|
||||
|
||||
// Gather windows to render
|
||||
g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = g.IO.MetricsActiveWindows = 0;
|
||||
// Gather ImDrawList to render (for each active window)
|
||||
g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = g.IO.MetricsRenderWindows = 0;
|
||||
for (int n = 0; n != g.Viewports.Size; n++)
|
||||
g.Viewports[n]->DrawDataBuilder.Clear();
|
||||
ImGuiWindow* windows_to_render_front_most[2];
|
||||
@ -5127,28 +5137,8 @@ void ImGui::Render()
|
||||
AddRootWindowToDrawData(windows_to_render_front_most[n]);
|
||||
|
||||
// Draw software mouse cursor if requested
|
||||
ImVec2 offset, size, uv[4];
|
||||
if (g.IO.MouseDrawCursor && g.IO.Fonts->GetMouseCursorTexData(g.MouseCursor, &offset, &size, &uv[0], &uv[2]))
|
||||
{
|
||||
// We need to account for the possibility of the mouse cursor straddling multiple viewports...
|
||||
const ImVec2 pos = g.IO.MousePos - offset;
|
||||
const ImTextureID tex_id = g.IO.Fonts->TexID;
|
||||
const float sc = g.Style.MouseCursorScale;
|
||||
for (int viewport_n = 0; viewport_n < g.Viewports.Size; viewport_n++)
|
||||
{
|
||||
ImGuiViewportP* viewport = g.Viewports[viewport_n];
|
||||
if (viewport->GetRect().Overlaps(ImRect(pos, pos + ImVec2(2,2)*sc + size * sc)))
|
||||
{
|
||||
ImDrawList* draw_list = GetOverlayDrawList(viewport);
|
||||
draw_list->PushTextureID(tex_id);
|
||||
draw_list->AddImage(tex_id, pos+ImVec2(1,0)*sc, pos+ImVec2(1,0)*sc + size*sc, uv[2], uv[3], IM_COL32(0,0,0,48)); // Shadow
|
||||
draw_list->AddImage(tex_id, pos+ImVec2(2,0)*sc, pos+ImVec2(2,0)*sc + size*sc, uv[2], uv[3], IM_COL32(0,0,0,48)); // Shadow
|
||||
draw_list->AddImage(tex_id, pos, pos + size*sc, uv[2], uv[3], IM_COL32(0,0,0,255)); // Black border
|
||||
draw_list->AddImage(tex_id, pos, pos + size*sc, uv[0], uv[1], IM_COL32(255,255,255,255)); // White fill
|
||||
draw_list->PopTextureID();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (g.IO.MouseDrawCursor)
|
||||
RenderMouseCursor(g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor);
|
||||
|
||||
// Setup ImDrawData structures for end-user
|
||||
g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = 0;
|
||||
@ -5455,19 +5445,6 @@ void ImGui::RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding)
|
||||
}
|
||||
}
|
||||
|
||||
// Render an arrow. 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side.
|
||||
void ImGui::RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case ImGuiDir_Left: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col); return;
|
||||
case ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return;
|
||||
case ImGuiDir_Up: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col); return;
|
||||
case ImGuiDir_Down: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return;
|
||||
case ImGuiDir_None: case ImGuiDir_COUNT: break; // Fix warnings
|
||||
}
|
||||
}
|
||||
|
||||
// Render an arrow aimed to be aligned with text (p_min is a position in the same space text would be positioned). To e.g. denote expanded/collapsed state
|
||||
void ImGui::RenderArrow(ImVec2 p_min, ImGuiDir dir, float scale)
|
||||
{
|
||||
@ -7307,8 +7284,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
// We don't use a regular button+id to test for double-click on title bar (mostly due to legacy reason, could be fixed), so verify that we don't have items over the title bar.
|
||||
ImRect title_bar_rect = window->TitleBarRect();
|
||||
if (g.HoveredWindow == window && g.HoveredId == 0 && g.HoveredIdPreviousFrame == 0 && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max) && g.IO.MouseDoubleClicked[0])
|
||||
window->CollapseToggleWanted = true;
|
||||
if (window->CollapseToggleWanted)
|
||||
window->WantCollapseToggle = true;
|
||||
if (window->WantCollapseToggle)
|
||||
{
|
||||
window->Collapsed = !window->Collapsed;
|
||||
MarkIniSettingsDirty(window);
|
||||
@ -7319,7 +7296,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
{
|
||||
window->Collapsed = false;
|
||||
}
|
||||
window->CollapseToggleWanted = false;
|
||||
window->WantCollapseToggle = false;
|
||||
|
||||
// SIZE
|
||||
|
||||
@ -7701,7 +7678,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
// Collapse button
|
||||
if (!(flags & ImGuiWindowFlags_NoCollapse))
|
||||
if (CollapseButton(window->GetID("#COLLAPSE"), window->Pos))
|
||||
window->CollapseToggleWanted = true; // Defer collapsing to next frame as we are too far in the Begin() function
|
||||
window->WantCollapseToggle = true; // Defer collapsing to next frame as we are too far in the Begin() function
|
||||
|
||||
// Close button
|
||||
if (p_open != NULL)
|
||||
@ -8407,8 +8384,7 @@ bool ImGui::IsWindowFocused(ImGuiFocusedFlags flags)
|
||||
// Can we focus this window with CTRL+TAB (or PadMenu + PadFocusPrev/PadFocusNext)
|
||||
bool ImGui::IsWindowNavFocusable(ImGuiWindow* window)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
return window->Active && window == window->RootWindow && (!(window->Flags & ImGuiWindowFlags_NoNavFocus) || window == g.NavWindow);
|
||||
return window->Active && window == window->RootWindow && !(window->Flags & ImGuiWindowFlags_NoNavFocus);
|
||||
}
|
||||
|
||||
float ImGui::GetWindowWidth()
|
||||
@ -13176,7 +13152,9 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
||||
{
|
||||
// Sub-menus are ChildWindow so that mouse can be hovering across them (otherwise top-most popup menu would steal focus and not allow hovering on parent menu)
|
||||
SetNextWindowPos(popup_pos, ImGuiCond_Always);
|
||||
ImGuiWindowFlags flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings | ((window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu)) ? ImGuiWindowFlags_ChildMenu|ImGuiWindowFlags_ChildWindow : ImGuiWindowFlags_ChildMenu);
|
||||
ImGuiWindowFlags flags = ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoNavFocus;
|
||||
if (window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu))
|
||||
flags |= ImGuiWindowFlags_ChildWindow;
|
||||
menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
|
||||
}
|
||||
|
||||
@ -14932,8 +14910,9 @@ void ImGui::EndDragDropTarget()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS))
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef __MINGW32__
|
||||
#include <Windows.h>
|
||||
#else
|
||||
@ -15077,9 +15056,11 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
{
|
||||
static bool show_draw_cmd_clip_rects = true;
|
||||
static bool show_window_begin_order = false;
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui::Text("Dear ImGui %s", ImGui::GetVersion());
|
||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||
ImGui::Text("%d vertices, %d indices (%d triangles)", ImGui::GetIO().MetricsRenderVertices, ImGui::GetIO().MetricsRenderIndices, ImGui::GetIO().MetricsRenderIndices / 3);
|
||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
|
||||
ImGui::Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3);
|
||||
ImGui::Text("%d active windows (%d visible)", io.MetricsActiveWindows, io.MetricsRenderWindows);
|
||||
ImGui::Text("%d allocations", (int)GImAllocatorActiveAllocationsCount);
|
||||
ImGui::Checkbox("Show clipping rectangles when hovering draw commands", &show_draw_cmd_clip_rects);
|
||||
ImGui::Checkbox("Ctrl shows window begin order", &show_window_begin_order);
|
||||
|
3
imgui.h
3
imgui.h
@ -1182,7 +1182,8 @@ struct ImGuiIO
|
||||
float Framerate; // Application framerate estimation, in frame per second. Solely for convenience. Rolling average estimation based on IO.DeltaTime over 120 frames
|
||||
int MetricsRenderVertices; // Vertices output during last call to Render()
|
||||
int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3
|
||||
int MetricsActiveWindows; // Number of visible root windows (exclude child windows)
|
||||
int MetricsRenderWindows; // Number of visible windows
|
||||
int MetricsActiveWindows; // Number of active windows
|
||||
ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta.
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
@ -1023,14 +1023,25 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
|
||||
if (ImGui::TreeNode("Data Types"))
|
||||
{
|
||||
// The DragScalar, InputScalar, SliderScalar functions allow manipulating most common data types: signed/unsigned int/long long and float/double
|
||||
// To avoid polluting the public API with all possible combinations, we use the ImGuiDataType enum to pass the type, and argument-by-values are turned into argument-by-address.
|
||||
// The DragScalar/InputScalar/SliderScalar functions allow various data types: signed/unsigned int/long long and float/double
|
||||
// To avoid polluting the public API with all possible combinations, we use the ImGuiDataType enum to pass the type,
|
||||
// and passing all arguments by address.
|
||||
// This is the reason the test code below creates local variables to hold "zero" "one" etc. for each types.
|
||||
// In practice, if you frequently use a given type that is not covered by the normal API entry points, you may want to wrap it yourself inside a 1 line function
|
||||
// which can take typed values argument instead of void*, and then pass their address to the generic function. For example:
|
||||
// bool SliderU64(const char *label, u64* value, u64 min = 0, u64 max = 0, const char* format = "%lld") { return SliderScalar(label, ImGuiDataType_U64, value, &min, &max, format); }
|
||||
// Below are helper variables we can take the address of to work-around this:
|
||||
// In practice, if you frequently use a given type that is not covered by the normal API entry points, you can wrap it
|
||||
// yourself inside a 1 line function which can take typed argument as value instead of void*, and then pass their address
|
||||
// to the generic function. For example:
|
||||
// bool MySliderU64(const char *label, u64* value, u64 min = 0, u64 max = 0, const char* format = "%lld")
|
||||
// {
|
||||
// return SliderScalar(label, ImGuiDataType_U64, value, &min, &max, format);
|
||||
// }
|
||||
|
||||
// Limits (as helper variables that we can take the address of)
|
||||
// Note that the SliderScalar function has a maximum usable range of half the natural type maximum, hence the /2 below.
|
||||
#ifndef LLONG_MIN
|
||||
ImS64 LLONG_MIN = -9223372036854775807LL - 1;
|
||||
ImS64 LLONG_MAX = 9223372036854775807LL;
|
||||
ImU64 ULLONG_MAX = (2ULL * 9223372036854775807LL + 1);
|
||||
#endif
|
||||
const ImS32 s32_zero = 0, s32_one = 1, s32_fifty = 50, s32_min = INT_MIN/2, s32_max = INT_MAX/2, s32_hi_a = INT_MAX/2 - 100, s32_hi_b = INT_MAX/2;
|
||||
const ImU32 u32_zero = 0, u32_one = 1, u32_fifty = 50, u32_min = 0, u32_max = UINT_MAX/2, u32_hi_a = UINT_MAX/2 - 100, u32_hi_b = UINT_MAX/2;
|
||||
const ImS64 s64_zero = 0, s64_one = 1, s64_fifty = 50, s64_min = LLONG_MIN/2, s64_max = LLONG_MAX/2, s64_hi_a = LLONG_MAX/2 - 100, s64_hi_b = LLONG_MAX/2;
|
||||
|
@ -6,6 +6,7 @@
|
||||
// - ImDrawList
|
||||
// - ImDrawData
|
||||
// - ImFontAtlas
|
||||
// - Internal Render Helpers
|
||||
// - ImFont
|
||||
// - Default font data
|
||||
|
||||
@ -2786,8 +2787,62 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Internals Drawing Helpers
|
||||
// Internals Render Helpers
|
||||
// (progressively moved from imgui.cpp to here when they are redesigned to stop accessing ImGui global state)
|
||||
//-----------------------------------------------------------------------------
|
||||
// RenderMouseCursor()
|
||||
// RenderArrowPointingAt()
|
||||
// RenderRectFilledRangeH()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ImGui::RenderMouseCursor(ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor)
|
||||
{
|
||||
if (mouse_cursor == ImGuiMouseCursor_None)
|
||||
return;
|
||||
IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT);
|
||||
|
||||
const ImU32 col_shadow = IM_COL32(0, 0, 0, 48);
|
||||
const ImU32 col_border = IM_COL32(0, 0, 0, 255); // Black
|
||||
const ImU32 col_fill = IM_COL32(255, 255, 255, 255); // White
|
||||
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImFontAtlas* font_atlas = g.IO.Fonts;
|
||||
ImVec2 offset, size, uv[4];
|
||||
if (font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2]))
|
||||
{
|
||||
pos -= offset;
|
||||
const ImTextureID tex_id = font_atlas->TexID;
|
||||
|
||||
// We need to account for the possibility of the mouse cursor straddling multiple viewports...
|
||||
for (int viewport_n = 0; viewport_n < g.Viewports.Size; viewport_n++)
|
||||
{
|
||||
ImGuiViewportP* viewport = g.Viewports[viewport_n];
|
||||
if (!viewport->GetRect().Overlaps(ImRect(pos, pos + ImVec2(size.x + 2, size.y + 2) * scale)))
|
||||
continue;
|
||||
|
||||
ImDrawList* draw_list = GetOverlayDrawList(viewport);
|
||||
draw_list->PushTextureID(tex_id);
|
||||
draw_list->AddImage(tex_id, pos + ImVec2(1,0)*scale, pos + ImVec2(1,0)*scale + size*scale, uv[2], uv[3], col_shadow);
|
||||
draw_list->AddImage(tex_id, pos + ImVec2(2,0)*scale, pos + ImVec2(2,0)*scale + size*scale, uv[2], uv[3], col_shadow);
|
||||
draw_list->AddImage(tex_id, pos, pos + size*scale, uv[2], uv[3], col_border);
|
||||
draw_list->AddImage(tex_id, pos, pos + size*scale, uv[0], uv[1], col_fill);
|
||||
draw_list->PopTextureID();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Render an arrow. 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side.
|
||||
void ImGui::RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case ImGuiDir_Left: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col); return;
|
||||
case ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return;
|
||||
case ImGuiDir_Up: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col); return;
|
||||
case ImGuiDir_Down: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return;
|
||||
case ImGuiDir_None: case ImGuiDir_COUNT: break; // Fix warnings
|
||||
}
|
||||
}
|
||||
|
||||
static inline float ImAcos01(float x)
|
||||
{
|
||||
|
@ -314,6 +314,7 @@ enum ImGuiInputReadMode
|
||||
|
||||
enum ImGuiNavHighlightFlags_
|
||||
{
|
||||
ImGuiNavHighlightFlags_None = 0,
|
||||
ImGuiNavHighlightFlags_TypeDefault = 1 << 0,
|
||||
ImGuiNavHighlightFlags_TypeThin = 1 << 1,
|
||||
ImGuiNavHighlightFlags_AlwaysDraw = 1 << 2,
|
||||
@ -322,6 +323,7 @@ enum ImGuiNavHighlightFlags_
|
||||
|
||||
enum ImGuiNavDirSourceFlags_
|
||||
{
|
||||
ImGuiNavDirSourceFlags_None = 0,
|
||||
ImGuiNavDirSourceFlags_Keyboard = 1 << 0,
|
||||
ImGuiNavDirSourceFlags_PadDPad = 1 << 1,
|
||||
ImGuiNavDirSourceFlags_PadLStick = 1 << 2
|
||||
@ -329,6 +331,7 @@ enum ImGuiNavDirSourceFlags_
|
||||
|
||||
enum ImGuiNavMoveFlags_
|
||||
{
|
||||
ImGuiNavMoveFlags_None = 0,
|
||||
ImGuiNavMoveFlags_LoopX = 1 << 0, // On failed request, restart from opposite side
|
||||
ImGuiNavMoveFlags_LoopY = 1 << 1,
|
||||
ImGuiNavMoveFlags_WrapX = 1 << 2, // On failed request, request from opposite side one line down (when NavDir==right) or one line up (when NavDir==left)
|
||||
@ -1041,7 +1044,7 @@ struct IMGUI_API ImGuiWindow
|
||||
bool WasActive;
|
||||
bool WriteAccessed; // Set to true when any widget access the current window
|
||||
bool Collapsed; // Set when collapsing window to become only title-bar
|
||||
bool CollapseToggleWanted;
|
||||
bool WantCollapseToggle;
|
||||
bool SkipItems; // Set when items can safely be all clipped (e.g. window not visible or collapsed)
|
||||
bool Appearing; // Set during the frame where the window is appearing (or re-appearing)
|
||||
bool Hidden; // Do not display (== (HiddenFramesForResize > 0) ||
|
||||
@ -1233,7 +1236,7 @@ namespace ImGui
|
||||
|
||||
// Render helpers
|
||||
// AVOID USING OUTSIDE OF IMGUI.CPP! NOT FOR PUBLIC CONSUMPTION. THOSE FUNCTIONS ARE A MESS. THEIR SIGNATURE AND BEHAVIOR WILL CHANGE, THEY NEED TO BE REFACTORED INTO SOMETHING DECENT.
|
||||
// NB: All position are in absolute pixels coordinates (never using window coordinates internally)
|
||||
// NB: All position are in absolute pixels coordinates (we are never using window coordinates internally)
|
||||
IMGUI_API void RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true);
|
||||
IMGUI_API void RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width);
|
||||
IMGUI_API void RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0,0), const ImRect* clip_rect = NULL);
|
||||
@ -1241,13 +1244,16 @@ namespace ImGui
|
||||
IMGUI_API void RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding = 0.0f);
|
||||
IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding = 0.0f, int rounding_corners_flags = ~0);
|
||||
IMGUI_API void RenderArrow(ImVec2 pos, ImGuiDir dir, float scale = 1.0f);
|
||||
IMGUI_API void RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col);
|
||||
IMGUI_API void RenderBullet(ImVec2 pos);
|
||||
IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col, float sz);
|
||||
IMGUI_API void RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFlags flags = ImGuiNavHighlightFlags_TypeDefault); // Navigation highlight
|
||||
IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding);
|
||||
IMGUI_API void RenderMouseCursor(ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor = ImGuiMouseCursor_Arrow);
|
||||
IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text.
|
||||
|
||||
// Render helpers (those functions don't access any ImGui state!)
|
||||
IMGUI_API void RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col);
|
||||
IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding);
|
||||
|
||||
// Widgets
|
||||
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0);
|
||||
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius);
|
||||
|
Loading…
Reference in New Issue
Block a user