mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-20 23:06:36 +00:00
Merge branch 'master' into docking
# Conflicts: # imgui.cpp # imgui.h # imgui_internal.h # imgui_widgets.cpp
This commit is contained in:
commit
25a9209b75
39
.github/workflows/build.yml
vendored
39
.github/workflows/build.yml
vendored
@ -389,8 +389,8 @@ jobs:
|
|||||||
wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
|
wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
|
||||||
tar -xvf master.tar.gz
|
tar -xvf master.tar.gz
|
||||||
emsdk-master/emsdk update
|
emsdk-master/emsdk update
|
||||||
emsdk-master/emsdk install latest-fastcomp
|
emsdk-master/emsdk install latest
|
||||||
emsdk-master/emsdk activate latest-fastcomp
|
emsdk-master/emsdk activate latest
|
||||||
|
|
||||||
- name: Build example_emscripten
|
- name: Build example_emscripten
|
||||||
run: |
|
run: |
|
||||||
@ -398,38 +398,3 @@ jobs:
|
|||||||
source ./emsdk_env.sh
|
source ./emsdk_env.sh
|
||||||
popd
|
popd
|
||||||
make -C examples/example_emscripten
|
make -C examples/example_emscripten
|
||||||
|
|
||||||
Static-Analysis:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
env:
|
|
||||||
PVS_STUDIO_LICENSE: ${{ secrets.PVS_STUDIO_LICENSE }}
|
|
||||||
run: |
|
|
||||||
if [[ "$PVS_STUDIO_LICENSE" != "" ]];
|
|
||||||
then
|
|
||||||
echo "$PVS_STUDIO_LICENSE" > pvs-studio.lic
|
|
||||||
wget -q https://files.viva64.com/etc/pubkey.txt
|
|
||||||
sudo apt-key add pubkey.txt
|
|
||||||
sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y pvs-studio
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: PVS-Studio static analysis
|
|
||||||
run: |
|
|
||||||
if [[ ! -f pvs-studio.lic ]];
|
|
||||||
then
|
|
||||||
echo "PVS Studio license is missing. No analysis will be performed."
|
|
||||||
echo "If you have a PVS Studio license please create a project secret named PVS_STUDIO_LICENSE with your license."
|
|
||||||
echo "You may use a free license. More information at https://www.viva64.com/en/b/0457/"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
cd examples/example_null
|
|
||||||
pvs-studio-analyzer trace -- make WITH_EXTRA_WARNINGS=1
|
|
||||||
pvs-studio-analyzer analyze -e ../../imstb_rectpack.h -e ../../imstb_textedit.h -e ../../imstb_truetype.h -l ../../pvs-studio.lic -o pvs-studio.log
|
|
||||||
plog-converter -a 'GA:1,2;OP:1' -t errorfile -w pvs-studio.log
|
|
||||||
|
43
.github/workflows/static-analysis.yml
vendored
Normal file
43
.github/workflows/static-analysis.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
name: static-analysis
|
||||||
|
|
||||||
|
on:
|
||||||
|
push: {}
|
||||||
|
pull_request: {}
|
||||||
|
schedule:
|
||||||
|
- cron: '0 9 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
PVS-Studio:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
env:
|
||||||
|
PVS_STUDIO_LICENSE: ${{ secrets.PVS_STUDIO_LICENSE }}
|
||||||
|
run: |
|
||||||
|
if [[ "$PVS_STUDIO_LICENSE" != "" ]];
|
||||||
|
then
|
||||||
|
echo "$PVS_STUDIO_LICENSE" > pvs-studio.lic
|
||||||
|
wget -q https://files.viva64.com/etc/pubkey.txt
|
||||||
|
sudo apt-key add pubkey.txt
|
||||||
|
sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y pvs-studio
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: PVS-Studio static analysis
|
||||||
|
run: |
|
||||||
|
if [[ ! -f pvs-studio.lic ]];
|
||||||
|
then
|
||||||
|
echo "PVS Studio license is missing. No analysis will be performed."
|
||||||
|
echo "If you have a PVS Studio license please create a project secret named PVS_STUDIO_LICENSE with your license."
|
||||||
|
echo "You may use a free license. More information at https://www.viva64.com/en/b/0457/"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
cd examples/example_null
|
||||||
|
pvs-studio-analyzer trace -- make WITH_EXTRA_WARNINGS=1
|
||||||
|
pvs-studio-analyzer analyze -e ../../imstb_rectpack.h -e ../../imstb_textedit.h -e ../../imstb_truetype.h -l ../../pvs-studio.lic -o pvs-studio.log
|
||||||
|
plog-converter -a 'GA:1,2;OP:1' -t errorfile -w pvs-studio.log
|
@ -104,6 +104,34 @@ Other changes:
|
|||||||
VERSION 1.78 WIP (In Progress)
|
VERSION 1.78 WIP (In Progress)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Breaking Changes:
|
||||||
|
|
||||||
|
- Obsoleted use of the trailing 'float power=1.0f' parameter for those functions: [@Shironekoben, @ocornut]
|
||||||
|
- DragFloat(), DragFloat2(), DragFloat3(), DragFloat4(), DragFloatRange2(), DragScalar(), DragScalarN()
|
||||||
|
- SliderFloat(), SliderFloat2(), SliderFloat3(), SliderFloat4(), SliderScalar(), SliderScalarN()
|
||||||
|
- VSliderFloat(), VSliderScalar()
|
||||||
|
Replaced the 'float power=1.0f' argument with integer-based flags defaulting to 0 (as with all our flags).
|
||||||
|
The type of those flags are ImGuiDragFlags and ImGuiSliderFlags (underlying int storage).
|
||||||
|
Worked out a backward-compatibility scheme so hopefully most C++ codebase should not be affected.
|
||||||
|
In short, when calling those functions:
|
||||||
|
- If you omitted the 'power' parameter (likely!), you are not affected.
|
||||||
|
- If you set the 'power' parameter to 1.0f (same as previous default value):
|
||||||
|
- Your compiler may warn on float>int conversion.
|
||||||
|
- Everything else will work.
|
||||||
|
- You can replace the 1.0f value with 0 to fix the warning, and be technically correct.
|
||||||
|
- If you set the 'power' parameter to >1.0f (to enable non-linear editing):
|
||||||
|
- Your compiler may warn on float>int conversion.
|
||||||
|
- Code will assert at runtime for IM_ASSERT(power == 1.0f) with the following assert description:
|
||||||
|
"Call Drag function with ImGuiDragFlags_Logarithmic instead of using the old 'float power' function!".
|
||||||
|
- In case asserts are disabled, the code will not crash and enable the _Logarithmic flag.
|
||||||
|
- You can replace the >1.0f value with ImGuiDragFlags_Logarithmic or ImGuiSliderFlags_Logarithmic
|
||||||
|
to fix the warning/assert and get a _similar_ effect as previous uses of power >1.0f.
|
||||||
|
See https://github.com/ocornut/imgui/issues/3361 for all details.
|
||||||
|
Kept inline redirection functions (will obsolete) apart for: DragFloatRange2(), VSliderFloat(), VSliderScalar().
|
||||||
|
For those three the 'float power=1.0f' version was removed directly as they were most unlikely ever used.
|
||||||
|
- DragInt, DragFloat, DragScalar: Obsoleted use of v_min > v_max to lock edits (introduced in 1.73, this was not
|
||||||
|
demoed nor documented much, will be replaced a more generic ReadOnly feature).
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
- Nav: Fixed clicking on void (behind any windows) from not clearing the focused window.
|
- Nav: Fixed clicking on void (behind any windows) from not clearing the focused window.
|
||||||
@ -111,6 +139,20 @@ Other Changes:
|
|||||||
flag being cleared accordingly. (bug introduced in 1.77 WIP on 2020/06/16) (#3344, #2880)
|
flag being cleared accordingly. (bug introduced in 1.77 WIP on 2020/06/16) (#3344, #2880)
|
||||||
- Window: Fixed clicking over an item which hovering has been disabled (e.g inhibited by a popup)
|
- Window: Fixed clicking over an item which hovering has been disabled (e.g inhibited by a popup)
|
||||||
from marking the window as moved.
|
from marking the window as moved.
|
||||||
|
- Drag, Slider: Added ImGuiDragFlags and ImGuiSliderFlags parameters.
|
||||||
|
For float functions they replace the old trailing 'float power=1.0' parameter.
|
||||||
|
(See #3361 and the "Breaking Changes" block above for all details).
|
||||||
|
- Drag, Slider: Added ImGuiDragFlags_Logarithmic/ImGuiSliderFlags_Logarithmic flags to
|
||||||
|
enable logarithmic editing (generally more precision around zero), as a replacement to the old
|
||||||
|
'float power' parameter which was obsoleted. (#1823, #1316, #642) [@Shironekoben, @AndrewBelt]
|
||||||
|
- Drag, Slider: Added ImGuiDragFlags_ClampOnInput/ImGuiSliderFlags_ClampOnInput flags to force
|
||||||
|
clamping value when using CTRL+Click to type in a value manually. (#1829, #3209, #946, #413).
|
||||||
|
- Drag, Slider: Added ImGuiDragFlags_NoRoundToFormat/ImGuiSliderFlags_NoRoundToFormat flags
|
||||||
|
to disable rounding underlying value to match precision of the display format string. (#642)
|
||||||
|
- Drag, Slider: Added ImGuiDragFlags_NoInput/ImGuiSliderFlags_NoInput to disable turning
|
||||||
|
widget into a text input with CTRL+Click or Nav Enter.
|
||||||
|
- Nav, Slider: Fix using keyboard/gamepad controls with certain logarithmic sliders where
|
||||||
|
pushing a direction near zero values would be cancelled out. [@Shironekoben]
|
||||||
- DragFloatRange2, DragIntRange2: Fixed an issue allowing to drag out of bounds when both
|
- DragFloatRange2, DragIntRange2: Fixed an issue allowing to drag out of bounds when both
|
||||||
min and max value are on the same value. (#1441)
|
min and max value are on the same value. (#1441)
|
||||||
- InputText, ImDrawList: Fixed assert triggering when drawing single line of text with more
|
- InputText, ImDrawList: Fixed assert triggering when drawing single line of text with more
|
||||||
@ -124,6 +166,7 @@ Other Changes:
|
|||||||
limits when close-enough by (WindowPadding - ItemPadding), which was a tweak with too many
|
limits when close-enough by (WindowPadding - ItemPadding), which was a tweak with too many
|
||||||
side-effects. The behavior is still present in SetScrollHere functions as they are more explicitly
|
side-effects. The behavior is still present in SetScrollHere functions as they are more explicitly
|
||||||
aiming at making widgets visible. May later be moved to a flag.
|
aiming at making widgets visible. May later be moved to a flag.
|
||||||
|
- Tab Bar: Allow calling SetTabItemClosed() after a tab has been submitted (will process next frame).
|
||||||
- InvisibleButton: Made public a small selection of ImGuiButtonFlags (previously in imgui_internal.h)
|
- InvisibleButton: Made public a small selection of ImGuiButtonFlags (previously in imgui_internal.h)
|
||||||
and allowed to pass them to InvisibleButton(): ImGuiButtonFlags_MouseButtonLeft/Right/Middle.
|
and allowed to pass them to InvisibleButton(): ImGuiButtonFlags_MouseButtonLeft/Right/Middle.
|
||||||
This is a small but rather important change because lots of multi-button behaviors could previously
|
This is a small but rather important change because lots of multi-button behaviors could previously
|
||||||
@ -149,7 +192,10 @@ Other Changes:
|
|||||||
- Demo: Improved "Layout & Scrolling" -> "Child Windows" section.
|
- Demo: Improved "Layout & Scrolling" -> "Child Windows" section.
|
||||||
- Style Editor: Added preview of circle auto-tessellation when editing the corresponding value.
|
- Style Editor: Added preview of circle auto-tessellation when editing the corresponding value.
|
||||||
- Backends: OpenGL3: Added support for glad2 loader. (#3330) [@moritz-h]
|
- Backends: OpenGL3: Added support for glad2 loader. (#3330) [@moritz-h]
|
||||||
|
- Backends: Allegro 5: Fixed horizontal scrolling direction with mouse wheel / touch pads (it seems
|
||||||
|
like Allegro 5 reports it differently from GLFW and SDL). (#3394, #2424, #1463) [@nobody-special666]
|
||||||
- Examples: Vulkan: Fixed GLFW+Vulkan and SDL+Vulkan clear color not being set. (#3390) [@RoryO]
|
- Examples: Vulkan: Fixed GLFW+Vulkan and SDL+Vulkan clear color not being set. (#3390) [@RoryO]
|
||||||
|
- CI: Emscripten has stopped their support for their fastcomp backend, switching to latest sdk [@Xipiryon]
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
Dear ImGui
|
Dear ImGui
|
||||||
=====
|
=====
|
||||||
[![Build Status](https://github.com/ocornut/imgui/workflows/build/badge.svg)](https://github.com/ocornut/imgui/actions?workflow=build)
|
[![Build Status](https://github.com/ocornut/imgui/workflows/build/badge.svg)](https://github.com/ocornut/imgui/actions?workflow=build) [![Static Analysis Status](https://github.com/ocornut/imgui/workflows/static-analysis/badge.svg)](https://github.com/ocornut/imgui/actions?workflow=static-analysis)
|
||||||
|
|
||||||
|
|
||||||
<sub>(This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using Dear ImGui, please consider reaching out.)</sub>
|
<sub>(This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using Dear ImGui, please consider reaching out.)</sub>
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ Calling the `ImGui::ShowDemoWindow()` function will create a demo window showcas
|
|||||||
![screenshot demo](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v167/v167-misc.png)
|
![screenshot demo](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v167/v167-misc.png)
|
||||||
|
|
||||||
You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let us know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here:
|
You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let us know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here:
|
||||||
- [imgui-demo-binaries-20190715.zip](http://www.dearimgui.org/binaries/imgui-demo-binaries-20200412.zip) (Windows binaries, 1.76, built 2020/04/12, master branch) or [older demo binaries](http://www.dearimgui.org/binaries).
|
- [imgui-demo-binaries-20200412.zip](http://www.dearimgui.org/binaries/imgui-demo-binaries-20200412.zip) (Windows, 1.76, built 2020/04/12, master branch) or [older demo binaries](http://www.dearimgui.org/binaries).
|
||||||
|
|
||||||
The demo applications are not DPI aware so expect some blurriness on a 4K screen. For DPI awareness in your application, you can load/reload your font at different scale, and scale your style with `style.ScaleAllSizes()` (see [FAQ](https://www.dearimgui.org/faq)).
|
The demo applications are not DPI aware so expect some blurriness on a 4K screen. For DPI awareness in your application, you can load/reload your font at different scale, and scale your style with `style.ScaleAllSizes()` (see [FAQ](https://www.dearimgui.org/faq)).
|
||||||
|
|
||||||
@ -125,7 +126,7 @@ Some of the goals for 2020 are:
|
|||||||
- Work on docking. (see [#2109](https://github.com/ocornut/imgui/issues/2109), in public [docking](https://github.com/ocornut/imgui/tree/docking) branch)
|
- Work on docking. (see [#2109](https://github.com/ocornut/imgui/issues/2109), in public [docking](https://github.com/ocornut/imgui/tree/docking) branch)
|
||||||
- Work on multiple viewports / multiple OS windows. (see [#1542](https://github.com/ocornut/imgui/issues/1542), in public [docking](https://github.com/ocornut/imgui/tree/docking) branch looking for feedback)
|
- Work on multiple viewports / multiple OS windows. (see [#1542](https://github.com/ocornut/imgui/issues/1542), in public [docking](https://github.com/ocornut/imgui/tree/docking) branch looking for feedback)
|
||||||
- Work on gamepad/keyboard controls. (see [#787](https://github.com/ocornut/imgui/issues/787))
|
- Work on gamepad/keyboard controls. (see [#787](https://github.com/ocornut/imgui/issues/787))
|
||||||
- Work on new Tables API (to replace Columns). (see [#2957](https://github.com/ocornut/imgui/issues/2957))
|
- Work on new Tables API (to replace Columns). (see [#2957](https://github.com/ocornut/imgui/issues/2957), in public [tables](https://github.com/ocornut/imgui/tree/tables) branch looking for feedback)
|
||||||
- Work on automation and testing system, both to test the library and end-user apps. (see [#435](https://github.com/ocornut/imgui/issues/435))
|
- Work on automation and testing system, both to test the library and end-user apps. (see [#435](https://github.com/ocornut/imgui/issues/435))
|
||||||
- Make the examples look better, improve styles, improve font support, make the examples hi-DPI and multi-DPI aware.
|
- Make the examples look better, improve styles, improve font support, make the examples hi-DPI and multi-DPI aware.
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ Custom engine
|
|||||||
|
|
||||||
### Support, Frequently Asked Questions (FAQ)
|
### Support, Frequently Asked Questions (FAQ)
|
||||||
|
|
||||||
Most common questions will be answered by the [Frequently Asked Questions (FAQ)](https://github.com/ocornut/imgui/blob/master/docs/FAQ.md) page.
|
See: [Frequently Asked Questions (FAQ)](https://github.com/ocornut/imgui/blob/master/docs/FAQ.md) where common questions are answered.
|
||||||
|
|
||||||
See: [Wiki](https://github.com/ocornut/imgui/wiki) for many links, references, articles.
|
See: [Wiki](https://github.com/ocornut/imgui/wiki) for many links, references, articles.
|
||||||
|
|
||||||
@ -160,7 +161,7 @@ Private support is available for paying business customers (E-mail: _contact @ d
|
|||||||
|
|
||||||
We occasionally tag [Releases](https://github.com/ocornut/imgui/releases) but it is generally safe and recommended to sync to master/latest. The library is fairly stable and regressions tend to be fixed fast when reported.
|
We occasionally tag [Releases](https://github.com/ocornut/imgui/releases) but it is generally safe and recommended to sync to master/latest. The library is fairly stable and regressions tend to be fixed fast when reported.
|
||||||
|
|
||||||
You may also peak at the [Multi-Viewport](https://github.com/ocornut/imgui/issues/1542) and [Docking](https://github.com/ocornut/imgui/issues/2109) features in the `docking` branch. Many projects are using this branch and it is kept in sync with master regularly.
|
Advanced users may want to use the `docking` branch with [Multi-Viewport](https://github.com/ocornut/imgui/issues/1542) and [Docking](https://github.com/ocornut/imgui/issues/2109) features. This branch is kept in sync with master regularly.
|
||||||
|
|
||||||
**Who uses Dear ImGui?**
|
**Who uses Dear ImGui?**
|
||||||
|
|
||||||
@ -219,7 +220,7 @@ Embeds [ProggyClean.ttf](http://upperbounds.net) font by Tristan Grimmer (MIT li
|
|||||||
|
|
||||||
Embeds [stb_textedit.h, stb_truetype.h, stb_rect_pack.h](https://github.com/nothings/stb/) by Sean Barrett (public domain).
|
Embeds [stb_textedit.h, stb_truetype.h, stb_rect_pack.h](https://github.com/nothings/stb/) by Sean Barrett (public domain).
|
||||||
|
|
||||||
Inspiration, feedback, and testing for early versions: Casey Muratori, Atman Binstock, Mikko Mononen, Emmanuel Briney, Stefan Kamoda, Anton Mikhailov, Matt Willis. And everybody posting feedback, questions and patches on the GitHub.
|
Inspiration, feedback, and testing for early versions: Casey Muratori, Atman Binstock, Mikko Mononen, Emmanuel Briney, Stefan Kamoda, Anton Mikhailov, Matt Willis. Also thank you to everyone posting feedback, questions and patches on GitHub.
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
@ -189,6 +189,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- docking: C- nav: CTRL+TAB highlighting tabs shows the mismatch between focus-stack and tab-order (not visible in VS because it doesn't highlight the tabs)
|
- docking: C- nav: CTRL+TAB highlighting tabs shows the mismatch between focus-stack and tab-order (not visible in VS because it doesn't highlight the tabs)
|
||||||
- docking: C- after a dock/undock, the Scrollbar Status update in Begin() should use an updated e.g. size_y_for_scrollbars to avoid a 1 frame scrollbar flicker.
|
- docking: C- after a dock/undock, the Scrollbar Status update in Begin() should use an updated e.g. size_y_for_scrollbars to avoid a 1 frame scrollbar flicker.
|
||||||
|
|
||||||
|
- tabs: while dragging/reordering a tab, close button decoration shouldn't appear on other tabs
|
||||||
- tabs: make EndTabBar fail if users doesn't respect BeginTabBar return value, for consistency/future-proofing.
|
- tabs: make EndTabBar fail if users doesn't respect BeginTabBar return value, for consistency/future-proofing.
|
||||||
- tabs: persistent order/focus in BeginTabBar() api (#261, #351)
|
- tabs: persistent order/focus in BeginTabBar() api (#261, #351)
|
||||||
- tabs: TabItem could honor SetNextItemWidth()?
|
- tabs: TabItem could honor SetNextItemWidth()?
|
||||||
@ -208,7 +209,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- slider: step option (#1183)
|
- slider: step option (#1183)
|
||||||
- slider style: fill % of the bar instead of positioning a drag.
|
- slider style: fill % of the bar instead of positioning a drag.
|
||||||
- knob: rotating knob widget (#942)
|
- knob: rotating knob widget (#942)
|
||||||
- drag float: power/logarithmic slider and drags are weird. (#1316)
|
- drag float: support for reversed drags (min > max) (removed is_locked, also see fdc526e)
|
||||||
- drag float: up/down axis
|
- drag float: up/down axis
|
||||||
- drag float: power != 0.0f with current value being outside the range keeps the value stuck.
|
- drag float: power != 0.0f with current value being outside the range keeps the value stuck.
|
||||||
- drag float: added leeway on edge (e.g. a few invisible steps past the clamp limits)
|
- drag float: added leeway on edge (e.g. a few invisible steps past the clamp limits)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{2AE17FDE-F7F3-4CAC-ADAB-0710EDA4F741}</ProjectGuid>
|
<ProjectGuid>{73F235B5-7D31-4FC6-8682-DDC5A097B9C1}</ProjectGuid>
|
||||||
<RootNamespace>example_allegro5</RootNamespace>
|
<RootNamespace>example_allegro5</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2020-08-10: Inputs: Fixed horizontal mouse wheel direction.
|
||||||
// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
|
// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
|
||||||
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
||||||
// 2019-05-11: Inputs: Don't filter character value from ALLEGRO_EVENT_KEY_CHAR before calling AddInputCharacter().
|
// 2019-05-11: Inputs: Don't filter character value from ALLEGRO_EVENT_KEY_CHAR before calling AddInputCharacter().
|
||||||
@ -332,7 +333,7 @@ bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* ev)
|
|||||||
if (ev->mouse.display == g_Display)
|
if (ev->mouse.display == g_Display)
|
||||||
{
|
{
|
||||||
io.MouseWheel += ev->mouse.dz;
|
io.MouseWheel += ev->mouse.dz;
|
||||||
io.MouseWheelH += ev->mouse.dw;
|
io.MouseWheelH -= ev->mouse.dw;
|
||||||
io.MousePos = ImVec2(ev->mouse.x, ev->mouse.y);
|
io.MousePos = ImVec2(ev->mouse.x, ev->mouse.y);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
35
imgui.cpp
35
imgui.cpp
@ -383,6 +383,15 @@ CODE
|
|||||||
- 2020/XX/XX (1.XX) - Moved IME support functions from io.ImeSetInputScreenPosFn, io.ImeWindowHandle to the PlatformIO api.
|
- 2020/XX/XX (1.XX) - Moved IME support functions from io.ImeSetInputScreenPosFn, io.ImeWindowHandle to the PlatformIO api.
|
||||||
|
|
||||||
|
|
||||||
|
- 2020/08/17 (1.78) - obsoleted use of the trailing 'float power=1.0f' parameter for DragFloat(), DragFloat2(), DragFloat3(), DragFloat4(), DragFloatRange2(), DragScalar(), DragScalarN(), SliderFloat(), SliderFloat2(), SliderFloat3(), SliderFloat4(), SliderScalar(), SliderScalarN(), VSliderFloat() and VSliderScalar().
|
||||||
|
replaced the 'float power=1.0f' argument with integer-based flags defaulting to 0 (as with all our flags).
|
||||||
|
worked out a backward-compatibility scheme so hopefully most C++ codebase should not be affected. in short, when calling those functions:
|
||||||
|
- if you omitted the 'power' parameter (likely!), you are not affected.
|
||||||
|
- if you set the 'power' parameter to 1.0f (same as previous default value): 1/ your compiler may warn on float>int conversion, 2/ everything else will work. 3/ you can replace the 1.0f value with 0 to fix the warning, and be technically correct.
|
||||||
|
- if you set the 'power' parameter to >1.0f (to enable non-linear editing): 1/ your compiler may warn on float>int conversion, 2/ code will assert at runtime, 3/ in case asserts are disabled, the code will not crash and enable the _Logarithmic flag. 4/ you can replace the >1.0f value with ImGuiDragFlags_Logarithmic or ImGuiSliderFlags_Logarithmic flag to fix the warning/assert and get a _similar_ effect as previous uses of power >1.0f.
|
||||||
|
see https://github.com/ocornut/imgui/issues/3361 for all details.
|
||||||
|
kept inline redirection functions (will obsolete) apart for: DragFloatRange2(), VSliderFloat(), VSliderScalar(). For those three the 'float power=1.0f' version were removed directly as they were most unlikely ever used.
|
||||||
|
- obsoleted use of v_min > v_max in DragInt, DragFloat, DragScalar to lock edits (introduced in 1.73, was not demoed nor documented very), will be replaced by a more generic ReadOnly feature. You may use the ImGuiDragFlags_ReadOnly internal flag in the meantime.
|
||||||
- 2020/06/23 (1.77) - removed BeginPopupContextWindow(const char*, int mouse_button, bool also_over_items) in favor of BeginPopupContextWindow(const char*, ImGuiPopupFlags flags) with ImGuiPopupFlags_NoOverItems.
|
- 2020/06/23 (1.77) - removed BeginPopupContextWindow(const char*, int mouse_button, bool also_over_items) in favor of BeginPopupContextWindow(const char*, ImGuiPopupFlags flags) with ImGuiPopupFlags_NoOverItems.
|
||||||
- 2020/06/15 (1.77) - renamed OpenPopupOnItemClick() to OpenPopupContextItem(). Kept inline redirection function (will obsolete).
|
- 2020/06/15 (1.77) - renamed OpenPopupOnItemClick() to OpenPopupContextItem(). Kept inline redirection function (will obsolete).
|
||||||
- 2020/06/15 (1.77) - removed CalcItemRectClosestPoint() entry point which was made obsolete and asserting in December 2017.
|
- 2020/06/15 (1.77) - removed CalcItemRectClosestPoint() entry point which was made obsolete and asserting in December 2017.
|
||||||
@ -952,6 +961,7 @@ ImGuiStyle::ImGuiStyle()
|
|||||||
ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar
|
ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar
|
||||||
GrabMinSize = 10.0f; // Minimum width/height of a grab box for slider/scrollbar
|
GrabMinSize = 10.0f; // Minimum width/height of a grab box for slider/scrollbar
|
||||||
GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
|
GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
|
||||||
|
LogSliderDeadzone = 4.0f; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
|
||||||
TabRounding = 4.0f; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
|
TabRounding = 4.0f; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
|
||||||
TabBorderSize = 0.0f; // Thickness of border around tabs.
|
TabBorderSize = 0.0f; // Thickness of border around tabs.
|
||||||
TabMinWidthForUnselectedCloseButton = 0.0f; // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
TabMinWidthForUnselectedCloseButton = 0.0f; // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
||||||
@ -991,6 +1001,7 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
|||||||
ScrollbarRounding = ImFloor(ScrollbarRounding * scale_factor);
|
ScrollbarRounding = ImFloor(ScrollbarRounding * scale_factor);
|
||||||
GrabMinSize = ImFloor(GrabMinSize * scale_factor);
|
GrabMinSize = ImFloor(GrabMinSize * scale_factor);
|
||||||
GrabRounding = ImFloor(GrabRounding * scale_factor);
|
GrabRounding = ImFloor(GrabRounding * scale_factor);
|
||||||
|
LogSliderDeadzone = ImFloor(LogSliderDeadzone * scale_factor);
|
||||||
TabRounding = ImFloor(TabRounding * scale_factor);
|
TabRounding = ImFloor(TabRounding * scale_factor);
|
||||||
if (TabMinWidthForUnselectedCloseButton != FLT_MAX)
|
if (TabMinWidthForUnselectedCloseButton != FLT_MAX)
|
||||||
TabMinWidthForUnselectedCloseButton = ImFloor(TabMinWidthForUnselectedCloseButton * scale_factor);
|
TabMinWidthForUnselectedCloseButton = ImFloor(TabMinWidthForUnselectedCloseButton * scale_factor);
|
||||||
@ -6720,7 +6731,7 @@ void ImGui::BringWindowToDisplayFront(ImGuiWindow* window)
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* current_front_window = g.Windows.back();
|
ImGuiWindow* current_front_window = g.Windows.back();
|
||||||
if (current_front_window == window || current_front_window->RootWindow == window)
|
if (current_front_window == window || current_front_window->RootWindow == window) // Cheap early out (could be better)
|
||||||
return;
|
return;
|
||||||
for (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the top-most window
|
for (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the top-most window
|
||||||
if (g.Windows[i] == window)
|
if (g.Windows[i] == window)
|
||||||
@ -8421,13 +8432,14 @@ void ImGui::OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When popups are stacked, clicking on a lower level popups puts focus back to it and close popups above it.
|
||||||
|
// This function closes any popups that are over 'ref_window'.
|
||||||
void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup)
|
void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.OpenPopupStack.Size == 0)
|
if (g.OpenPopupStack.Size == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// When popups are stacked, clicking on a lower level popups puts focus back to it and close popups above it.
|
|
||||||
// Don't close our own child popup windows.
|
// Don't close our own child popup windows.
|
||||||
int popup_count_to_keep = 0;
|
int popup_count_to_keep = 0;
|
||||||
if (ref_window)
|
if (ref_window)
|
||||||
@ -8442,13 +8454,20 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to
|
|||||||
if (popup.Window->Flags & ImGuiWindowFlags_ChildWindow)
|
if (popup.Window->Flags & ImGuiWindowFlags_ChildWindow)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Trim the stack when popups are not direct descendant of the reference window (the reference window is often the NavWindow)
|
// Trim the stack unless the popup is a direct parent of the reference window (the reference window is often the NavWindow)
|
||||||
bool popup_or_descendent_is_ref_window = false;
|
// - With this stack of window, clicking/focusing Popup1 will close Popup2 and Popup3:
|
||||||
for (int m = popup_count_to_keep; m < g.OpenPopupStack.Size && !popup_or_descendent_is_ref_window; m++)
|
// Window -> Popup1 -> Popup2 -> Popup3
|
||||||
if (ImGuiWindow* popup_window = g.OpenPopupStack[m].Window)
|
// - Each popups may contain child windows, which is why we compare ->RootWindow!
|
||||||
|
// Window -> Popup1 -> Popup1_Child -> Popup2 -> Popup2_Child
|
||||||
|
bool ref_window_is_descendent_of_popup = false;
|
||||||
|
for (int n = popup_count_to_keep; n < g.OpenPopupStack.Size; n++)
|
||||||
|
if (ImGuiWindow* popup_window = g.OpenPopupStack[n].Window)
|
||||||
if (popup_window->RootWindow == ref_window->RootWindow)
|
if (popup_window->RootWindow == ref_window->RootWindow)
|
||||||
popup_or_descendent_is_ref_window = true;
|
{
|
||||||
if (!popup_or_descendent_is_ref_window)
|
ref_window_is_descendent_of_popup = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!ref_window_is_descendent_of_popup)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
99
imgui.h
99
imgui.h
@ -61,7 +61,7 @@ Index of this file:
|
|||||||
// Version
|
// Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||||
#define IMGUI_VERSION "1.78 WIP"
|
#define IMGUI_VERSION "1.78 WIP"
|
||||||
#define IMGUI_VERSION_NUM 17703
|
#define IMGUI_VERSION_NUM 17704
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
#define IMGUI_HAS_VIEWPORT 1 // Viewport WIP branch
|
#define IMGUI_HAS_VIEWPORT 1 // Viewport WIP branch
|
||||||
#define IMGUI_HAS_DOCK 1 // Docking WIP branch
|
#define IMGUI_HAS_DOCK 1 // Docking WIP branch
|
||||||
@ -165,6 +165,7 @@ typedef int ImGuiColorEditFlags; // -> enum ImGuiColorEditFlags_ // Flags: f
|
|||||||
typedef int ImGuiConfigFlags; // -> enum ImGuiConfigFlags_ // Flags: for io.ConfigFlags
|
typedef int ImGuiConfigFlags; // -> enum ImGuiConfigFlags_ // Flags: for io.ConfigFlags
|
||||||
typedef int ImGuiComboFlags; // -> enum ImGuiComboFlags_ // Flags: for BeginCombo()
|
typedef int ImGuiComboFlags; // -> enum ImGuiComboFlags_ // Flags: for BeginCombo()
|
||||||
typedef int ImGuiDockNodeFlags; // -> enum ImGuiDockNodeFlags_ // Flags: for DockSpace()
|
typedef int ImGuiDockNodeFlags; // -> enum ImGuiDockNodeFlags_ // Flags: for DockSpace()
|
||||||
|
typedef int ImGuiDragFlags; // -> enum ImGuiDragFlags_ // Flags: for DragFloat(), DragInt() etc.
|
||||||
typedef int ImGuiDragDropFlags; // -> enum ImGuiDragDropFlags_ // Flags: for BeginDragDropSource(), AcceptDragDropPayload()
|
typedef int ImGuiDragDropFlags; // -> enum ImGuiDragDropFlags_ // Flags: for BeginDragDropSource(), AcceptDragDropPayload()
|
||||||
typedef int ImGuiFocusedFlags; // -> enum ImGuiFocusedFlags_ // Flags: for IsWindowFocused()
|
typedef int ImGuiFocusedFlags; // -> enum ImGuiFocusedFlags_ // Flags: for IsWindowFocused()
|
||||||
typedef int ImGuiHoveredFlags; // -> enum ImGuiHoveredFlags_ // Flags: for IsItemHovered(), IsWindowHovered() etc.
|
typedef int ImGuiHoveredFlags; // -> enum ImGuiHoveredFlags_ // Flags: for IsItemHovered(), IsWindowHovered() etc.
|
||||||
@ -172,6 +173,7 @@ typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: f
|
|||||||
typedef int ImGuiKeyModFlags; // -> enum ImGuiKeyModFlags_ // Flags: for io.KeyMods (Ctrl/Shift/Alt/Super)
|
typedef int ImGuiKeyModFlags; // -> enum ImGuiKeyModFlags_ // Flags: for io.KeyMods (Ctrl/Shift/Alt/Super)
|
||||||
typedef int ImGuiPopupFlags; // -> enum ImGuiPopupFlags_ // Flags: for OpenPopup*(), BeginPopupContext*(), IsPopupOpen()
|
typedef int ImGuiPopupFlags; // -> enum ImGuiPopupFlags_ // Flags: for OpenPopup*(), BeginPopupContext*(), IsPopupOpen()
|
||||||
typedef int ImGuiSelectableFlags; // -> enum ImGuiSelectableFlags_ // Flags: for Selectable()
|
typedef int ImGuiSelectableFlags; // -> enum ImGuiSelectableFlags_ // Flags: for Selectable()
|
||||||
|
typedef int ImGuiSliderFlags; // -> enum ImGuiSliderFlags_ // Flags: for SliderFloat(), SliderInt() etc.
|
||||||
typedef int ImGuiTabBarFlags; // -> enum ImGuiTabBarFlags_ // Flags: for BeginTabBar()
|
typedef int ImGuiTabBarFlags; // -> enum ImGuiTabBarFlags_ // Flags: for BeginTabBar()
|
||||||
typedef int ImGuiTabItemFlags; // -> enum ImGuiTabItemFlags_ // Flags: for BeginTabItem()
|
typedef int ImGuiTabItemFlags; // -> enum ImGuiTabItemFlags_ // Flags: for BeginTabItem()
|
||||||
typedef int ImGuiTreeNodeFlags; // -> enum ImGuiTreeNodeFlags_ // Flags: for TreeNode(), TreeNodeEx(), CollapsingHeader()
|
typedef int ImGuiTreeNodeFlags; // -> enum ImGuiTreeNodeFlags_ // Flags: for TreeNode(), TreeNodeEx(), CollapsingHeader()
|
||||||
@ -474,39 +476,45 @@ namespace ImGui
|
|||||||
// - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
|
// - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
|
||||||
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
||||||
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
||||||
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
||||||
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits.
|
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits.
|
||||||
// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
|
// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
|
||||||
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f); // If v_min >= v_max we have no bound
|
// - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiDragFlags flags=0' argument.
|
||||||
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f);
|
// If you get a warning converting a float to ImGuiDragFlags, read https://github.com/ocornut/imgui/issues/3361
|
||||||
IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f);
|
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiDragFlags flags = 0); // If v_min >= v_max we have no bound
|
||||||
IMGUI_API bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f);
|
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiDragFlags flags = 0);
|
||||||
IMGUI_API bool DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", const char* format_max = NULL, float power = 1.0f);
|
IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiDragFlags flags = 0);
|
||||||
IMGUI_API bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d"); // If v_min >= v_max we have no bound
|
IMGUI_API bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiDragFlags flags = 0);
|
||||||
IMGUI_API bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d");
|
IMGUI_API bool DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", const char* format_max = NULL, ImGuiDragFlags flags = 0);
|
||||||
IMGUI_API bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d");
|
IMGUI_API bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", ImGuiDragFlags flags = 0); // If v_min >= v_max we have no bound
|
||||||
IMGUI_API bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d");
|
IMGUI_API bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", ImGuiDragFlags flags = 0);
|
||||||
IMGUI_API bool DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", const char* format_max = NULL);
|
IMGUI_API bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", ImGuiDragFlags flags = 0);
|
||||||
IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, float power = 1.0f);
|
IMGUI_API bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", ImGuiDragFlags flags = 0);
|
||||||
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, float power = 1.0f);
|
IMGUI_API bool DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", const char* format_max = NULL, ImGuiDragFlags flags = 0);
|
||||||
|
IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiDragFlags flags = 0);
|
||||||
|
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiDragFlags flags = 0);
|
||||||
|
|
||||||
// Widgets: Sliders
|
// Widgets: Sliders
|
||||||
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
|
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
|
||||||
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
||||||
IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f); // adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display. Use power!=1.0 for power curve sliders
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
// If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361
|
||||||
IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0); // adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display.
|
||||||
IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f, const char* format = "%.0f deg");
|
IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* format = "%d");
|
IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format = "%d");
|
IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format = "%d");
|
IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f, const char* format = "%.0f deg", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* format = "%d");
|
IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format = NULL, float power = 1.0f);
|
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, const char* format = NULL, float power = 1.0f);
|
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* format = "%d");
|
IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format = NULL, float power = 1.0f);
|
IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
||||||
|
IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
|
IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
|
IMGUI_API bool VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
||||||
|
|
||||||
// Widgets: Input with Keyboard
|
// Widgets: Input with Keyboard
|
||||||
// - If you want to use InputText() with std::string or any custom dynamic string type, see misc/cpp/imgui_stdlib.h and comments in imgui_demo.cpp.
|
// - If you want to use InputText() with std::string or any custom dynamic string type, see misc/cpp/imgui_stdlib.h and comments in imgui_demo.cpp.
|
||||||
@ -1357,6 +1365,28 @@ enum ImGuiColorEditFlags_
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Flags for DragFloat(), DragInt() etc.
|
||||||
|
enum ImGuiDragFlags_
|
||||||
|
{
|
||||||
|
ImGuiDragFlags_None = 0,
|
||||||
|
ImGuiDragFlags_InvalidMask_ = 0x7000000F, // [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed.
|
||||||
|
ImGuiDragFlags_ClampOnInput = 1 << 4, // Clamp value to min/max bounds (if any) when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds.
|
||||||
|
ImGuiDragFlags_Logarithmic = 1 << 5, // Make the widget logarithmic (linear otherwise). Consider using ImGuiDragFlags_NoRoundToFormat with this if using a format-string with small amount of digits.
|
||||||
|
ImGuiDragFlags_NoRoundToFormat = 1 << 6, // Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits)
|
||||||
|
ImGuiDragFlags_NoInput = 1 << 7 // Disable CTRL+Click or Enter key allowing to input text directly into the widget
|
||||||
|
};
|
||||||
|
|
||||||
|
// Flags for SliderFloat(), SliderInt() etc.
|
||||||
|
enum ImGuiSliderFlags_
|
||||||
|
{
|
||||||
|
ImGuiSliderFlags_None = 0,
|
||||||
|
ImGuiSliderFlags_InvalidMask_ = 0x7000000F, // [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed.
|
||||||
|
ImGuiSliderFlags_ClampOnInput = 1 << 4, // Clamp value to min/max bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds.
|
||||||
|
ImGuiSliderFlags_Logarithmic = 1 << 5, // Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits.
|
||||||
|
ImGuiSliderFlags_NoRoundToFormat = 1 << 6, // Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits)
|
||||||
|
ImGuiSliderFlags_NoInput = 1 << 7 // Disable CTRL+Click or Enter key allowing to input text directly into the widget
|
||||||
|
};
|
||||||
|
|
||||||
// Identify a mouse button.
|
// Identify a mouse button.
|
||||||
// Those values are guaranteed to be stable and we frequently use 0/1 directly. Named enums provided for convenience.
|
// Those values are guaranteed to be stable and we frequently use 0/1 directly. Named enums provided for convenience.
|
||||||
enum ImGuiMouseButton_
|
enum ImGuiMouseButton_
|
||||||
@ -1518,6 +1548,7 @@ struct ImGuiStyle
|
|||||||
float ScrollbarRounding; // Radius of grab corners for scrollbar.
|
float ScrollbarRounding; // Radius of grab corners for scrollbar.
|
||||||
float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar.
|
float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar.
|
||||||
float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
|
float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
|
||||||
|
float LogSliderDeadzone; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
|
||||||
float TabRounding; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
|
float TabRounding; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
|
||||||
float TabBorderSize; // Thickness of border around tabs.
|
float TabBorderSize; // Thickness of border around tabs.
|
||||||
float TabMinWidthForUnselectedCloseButton; // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
float TabMinWidthForUnselectedCloseButton; // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
|
||||||
@ -1789,6 +1820,20 @@ struct ImGuiPayload
|
|||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
|
// OBSOLETED in 1.78 (from August 2020)
|
||||||
|
// Old drag/sliders functions that took a 'float power = 1.0' argument instead of flags
|
||||||
|
IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, float power);
|
||||||
|
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, float power);
|
||||||
|
static inline bool DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, power); }
|
||||||
|
static inline bool DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, power); }
|
||||||
|
static inline bool DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, power); }
|
||||||
|
static inline bool DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, power); }
|
||||||
|
IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float power);
|
||||||
|
IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, const char* format, float power);
|
||||||
|
static inline bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format, float power) { return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, power); }
|
||||||
|
static inline bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, float power) { return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); }
|
||||||
|
static inline bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, float power) { return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); }
|
||||||
|
static inline bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, float power) { return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); }
|
||||||
// OBSOLETED in 1.77 (from June 2020)
|
// OBSOLETED in 1.77 (from June 2020)
|
||||||
static inline bool OpenPopupOnItemClick(const char* str_id = NULL, ImGuiMouseButton mb = 1) { return OpenPopupContextItem(str_id, mb); } // Passing a mouse button to ImGuiPopupFlags is legal
|
static inline bool OpenPopupOnItemClick(const char* str_id = NULL, ImGuiMouseButton mb = 1) { return OpenPopupContextItem(str_id, mb); } // Passing a mouse button to ImGuiPopupFlags is legal
|
||||||
static inline bool BeginPopupContextWindow(const char* str_id, ImGuiMouseButton mb, bool over_items) { return BeginPopupContextWindow(str_id, mb | (over_items ? 0 : ImGuiPopupFlags_NoOpenOverItems)); }
|
static inline bool BeginPopupContextWindow(const char* str_id, ImGuiMouseButton mb, bool over_items) { return BeginPopupContextWindow(str_id, mb | (over_items ? 0 : ImGuiPopupFlags_NoOpenOverItems)); }
|
||||||
|
106
imgui_demo.cpp
106
imgui_demo.cpp
@ -684,7 +684,7 @@ static void ShowDemoWindowWidgets()
|
|||||||
|
|
||||||
static float f1 = 0.123f, f2 = 0.0f;
|
static float f1 = 0.123f, f2 = 0.0f;
|
||||||
ImGui::SliderFloat("slider float", &f1, 0.0f, 1.0f, "ratio = %.3f");
|
ImGui::SliderFloat("slider float", &f1, 0.0f, 1.0f, "ratio = %.3f");
|
||||||
ImGui::SliderFloat("slider float (curve)", &f2, -10.0f, 10.0f, "%.4f", 2.0f);
|
ImGui::SliderFloat("slider float (log)", &f2, -10.0f, 10.0f, "%.4f", ImGuiSliderFlags_Logarithmic);
|
||||||
|
|
||||||
static float angle = 0.0f;
|
static float angle = 0.0f;
|
||||||
ImGui::SliderAngle("slider angle", &angle);
|
ImGui::SliderAngle("slider angle", &angle);
|
||||||
@ -1543,11 +1543,53 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::TreeNode("Drag/Slider Flags"))
|
||||||
|
{
|
||||||
|
// Demonstrate using advanced flags for DragXXX functions
|
||||||
|
static ImGuiDragFlags drag_flags = ImGuiDragFlags_None;
|
||||||
|
ImGui::CheckboxFlags("ImGuiDragFlags_ClampOnInput", (unsigned int*)&drag_flags, ImGuiDragFlags_ClampOnInput);
|
||||||
|
ImGui::SameLine(); HelpMarker("Always clamp value to min/max bounds (if any) when input manually with CTRL+Click.");
|
||||||
|
ImGui::CheckboxFlags("ImGuiDragFlags_Logarithmic", (unsigned int*)&drag_flags, ImGuiDragFlags_Logarithmic);
|
||||||
|
ImGui::SameLine(); HelpMarker("Enable logarithmic editing (more precision for small values).");
|
||||||
|
ImGui::CheckboxFlags("ImGuiDragFlags_NoRoundToFormat", (unsigned int*)&drag_flags, ImGuiDragFlags_NoRoundToFormat);
|
||||||
|
ImGui::SameLine(); HelpMarker("Disable rounding underlying value to match precision of the format string (e.g. %.3f values are rounded to those 3 digits).");
|
||||||
|
ImGui::CheckboxFlags("ImGuiDragFlags_NoInput", (unsigned int*)&drag_flags, ImGuiDragFlags_NoInput);
|
||||||
|
ImGui::SameLine(); HelpMarker("Disable CTRL+Click or Enter key allowing to input text directly into the widget.");
|
||||||
|
|
||||||
|
static float drag_f = 0.5f;
|
||||||
|
static int drag_i = 50;
|
||||||
|
ImGui::Text("Underlying float value: %f", drag_f);
|
||||||
|
ImGui::DragFloat("DragFloat (0 -> 1)", &drag_f, 0.005f, 0.0f, 1.0f, "%.3f", drag_flags);
|
||||||
|
ImGui::DragFloat("DragFloat (0 -> +inf)", &drag_f, 0.005f, 0.0f, FLT_MAX, "%.3f", drag_flags);
|
||||||
|
ImGui::DragFloat("DragFloat (-inf -> 1)", &drag_f, 0.005f, -FLT_MAX, 1.0f, "%.3f", drag_flags);
|
||||||
|
ImGui::DragFloat("DragFloat (-inf -> +inf)", &drag_f, 0.005f, -FLT_MAX, +FLT_MAX, "%.3f", drag_flags);
|
||||||
|
ImGui::DragInt("DragInt (0 -> 100)", &drag_i, 0.5f, 0, 100, "%d", drag_flags);
|
||||||
|
|
||||||
|
// Demonstrate using advanced flags for SliderXXX functions
|
||||||
|
static ImGuiSliderFlags slider_flags = ImGuiSliderFlags_None;
|
||||||
|
ImGui::CheckboxFlags("ImGuiSliderFlags_ClampOnInput", (unsigned int*)&slider_flags, ImGuiSliderFlags_ClampOnInput);
|
||||||
|
ImGui::SameLine(); HelpMarker("Always clamp value to min/max bounds (if any) when input manually with CTRL+Click.");
|
||||||
|
ImGui::CheckboxFlags("ImGuiSliderFlags_Logarithmic", (unsigned int*)&slider_flags, ImGuiSliderFlags_Logarithmic);
|
||||||
|
ImGui::SameLine(); HelpMarker("Enable logarithmic editing (more precision for small values).");
|
||||||
|
ImGui::CheckboxFlags("ImGuiSliderFlags_NoRoundToFormat", (unsigned int*)&slider_flags, ImGuiSliderFlags_NoRoundToFormat);
|
||||||
|
ImGui::SameLine(); HelpMarker("Disable rounding underlying value to match precision of the format string (e.g. %.3f values are rounded to those 3 digits).");
|
||||||
|
ImGui::CheckboxFlags("ImGuiSliderFlags_NoInput", (unsigned int*)&slider_flags, ImGuiSliderFlags_NoInput);
|
||||||
|
ImGui::SameLine(); HelpMarker("Disable CTRL+Click or Enter key allowing to input text directly into the widget.");
|
||||||
|
|
||||||
|
static float slider_f = 0.5f;
|
||||||
|
static int slider_i = 50;
|
||||||
|
ImGui::Text("Underlying float value: %f", slider_f);
|
||||||
|
ImGui::SliderFloat("SliderFloat (0 -> 1)", &slider_f, 0.0f, 1.0f, "%.3f", slider_flags);
|
||||||
|
ImGui::SliderInt("SliderInt (0 -> 100)", &slider_i, 0, 100, "%.3f", slider_flags);
|
||||||
|
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::TreeNode("Range Widgets"))
|
if (ImGui::TreeNode("Range Widgets"))
|
||||||
{
|
{
|
||||||
static float begin = 10, end = 90;
|
static float begin = 10, end = 90;
|
||||||
static int begin_i = 100, end_i = 1000;
|
static int begin_i = 100, end_i = 1000;
|
||||||
ImGui::DragFloatRange2("range float", &begin, &end, 0.25f, 0.0f, 100.0f, "Min: %.1f %%", "Max: %.1f %%");
|
ImGui::DragFloatRange2("range float", &begin, &end, 0.25f, 0.0f, 100.0f, "Min: %.1f %%", "Max: %.1f %%", ImGuiDragFlags_ClampOnInput);
|
||||||
ImGui::DragIntRange2("range int", &begin_i, &end_i, 5, 0, 1000, "Min: %d units", "Max: %d units");
|
ImGui::DragIntRange2("range int", &begin_i, &end_i, 5, 0, 1000, "Min: %d units", "Max: %d units");
|
||||||
ImGui::DragIntRange2("range int (no bounds)", &begin_i, &end_i, 5, 0, 0, "Min: %d units", "Max: %d units");
|
ImGui::DragIntRange2("range int (no bounds)", &begin_i, &end_i, 5, 0, 0, "Min: %d units", "Max: %d units");
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
@ -1612,34 +1654,34 @@ static void ShowDemoWindowWidgets()
|
|||||||
ImGui::DragScalar("drag u32", ImGuiDataType_U32, &u32_v, drag_speed, drag_clamp ? &u32_zero : NULL, drag_clamp ? &u32_fifty : NULL, "%u ms");
|
ImGui::DragScalar("drag u32", ImGuiDataType_U32, &u32_v, drag_speed, drag_clamp ? &u32_zero : NULL, drag_clamp ? &u32_fifty : NULL, "%u ms");
|
||||||
ImGui::DragScalar("drag s64", ImGuiDataType_S64, &s64_v, drag_speed, drag_clamp ? &s64_zero : NULL, drag_clamp ? &s64_fifty : NULL);
|
ImGui::DragScalar("drag s64", ImGuiDataType_S64, &s64_v, drag_speed, drag_clamp ? &s64_zero : NULL, drag_clamp ? &s64_fifty : NULL);
|
||||||
ImGui::DragScalar("drag u64", ImGuiDataType_U64, &u64_v, drag_speed, drag_clamp ? &u64_zero : NULL, drag_clamp ? &u64_fifty : NULL);
|
ImGui::DragScalar("drag u64", ImGuiDataType_U64, &u64_v, drag_speed, drag_clamp ? &u64_zero : NULL, drag_clamp ? &u64_fifty : NULL);
|
||||||
ImGui::DragScalar("drag float", ImGuiDataType_Float, &f32_v, 0.005f, &f32_zero, &f32_one, "%f", 1.0f);
|
ImGui::DragScalar("drag float", ImGuiDataType_Float, &f32_v, 0.005f, &f32_zero, &f32_one, "%f");
|
||||||
ImGui::DragScalar("drag float ^2", ImGuiDataType_Float, &f32_v, 0.005f, &f32_zero, &f32_one, "%f", 2.0f); ImGui::SameLine(); HelpMarker("You can use the 'power' parameter to increase tweaking precision on one side of the range.");
|
ImGui::DragScalar("drag float log", ImGuiDataType_Float, &f32_v, 0.005f, &f32_zero, &f32_one, "%f", ImGuiDragFlags_Logarithmic);
|
||||||
ImGui::DragScalar("drag double", ImGuiDataType_Double, &f64_v, 0.0005f, &f64_zero, NULL, "%.10f grams", 1.0f);
|
ImGui::DragScalar("drag double", ImGuiDataType_Double, &f64_v, 0.0005f, &f64_zero, NULL, "%.10f grams");
|
||||||
ImGui::DragScalar("drag double ^2", ImGuiDataType_Double, &f64_v, 0.0005f, &f64_zero, &f64_one, "0 < %.10f < 1", 2.0f);
|
ImGui::DragScalar("drag double log",ImGuiDataType_Double, &f64_v, 0.0005f, &f64_zero, &f64_one, "0 < %.10f < 1", ImGuiDragFlags_Logarithmic);
|
||||||
|
|
||||||
ImGui::Text("Sliders");
|
ImGui::Text("Sliders");
|
||||||
ImGui::SliderScalar("slider s8 full", ImGuiDataType_S8, &s8_v, &s8_min, &s8_max, "%d");
|
ImGui::SliderScalar("slider s8 full", ImGuiDataType_S8, &s8_v, &s8_min, &s8_max, "%d");
|
||||||
ImGui::SliderScalar("slider u8 full", ImGuiDataType_U8, &u8_v, &u8_min, &u8_max, "%u");
|
ImGui::SliderScalar("slider u8 full", ImGuiDataType_U8, &u8_v, &u8_min, &u8_max, "%u");
|
||||||
ImGui::SliderScalar("slider s16 full", ImGuiDataType_S16, &s16_v, &s16_min, &s16_max, "%d");
|
ImGui::SliderScalar("slider s16 full", ImGuiDataType_S16, &s16_v, &s16_min, &s16_max, "%d");
|
||||||
ImGui::SliderScalar("slider u16 full", ImGuiDataType_U16, &u16_v, &u16_min, &u16_max, "%u");
|
ImGui::SliderScalar("slider u16 full", ImGuiDataType_U16, &u16_v, &u16_min, &u16_max, "%u");
|
||||||
ImGui::SliderScalar("slider s32 low", ImGuiDataType_S32, &s32_v, &s32_zero, &s32_fifty,"%d");
|
ImGui::SliderScalar("slider s32 low", ImGuiDataType_S32, &s32_v, &s32_zero, &s32_fifty,"%d");
|
||||||
ImGui::SliderScalar("slider s32 high", ImGuiDataType_S32, &s32_v, &s32_hi_a, &s32_hi_b, "%d");
|
ImGui::SliderScalar("slider s32 high", ImGuiDataType_S32, &s32_v, &s32_hi_a, &s32_hi_b, "%d");
|
||||||
ImGui::SliderScalar("slider s32 full", ImGuiDataType_S32, &s32_v, &s32_min, &s32_max, "%d");
|
ImGui::SliderScalar("slider s32 full", ImGuiDataType_S32, &s32_v, &s32_min, &s32_max, "%d");
|
||||||
ImGui::SliderScalar("slider u32 low", ImGuiDataType_U32, &u32_v, &u32_zero, &u32_fifty,"%u");
|
ImGui::SliderScalar("slider u32 low", ImGuiDataType_U32, &u32_v, &u32_zero, &u32_fifty,"%u");
|
||||||
ImGui::SliderScalar("slider u32 high", ImGuiDataType_U32, &u32_v, &u32_hi_a, &u32_hi_b, "%u");
|
ImGui::SliderScalar("slider u32 high", ImGuiDataType_U32, &u32_v, &u32_hi_a, &u32_hi_b, "%u");
|
||||||
ImGui::SliderScalar("slider u32 full", ImGuiDataType_U32, &u32_v, &u32_min, &u32_max, "%u");
|
ImGui::SliderScalar("slider u32 full", ImGuiDataType_U32, &u32_v, &u32_min, &u32_max, "%u");
|
||||||
ImGui::SliderScalar("slider s64 low", ImGuiDataType_S64, &s64_v, &s64_zero, &s64_fifty,"%I64d");
|
ImGui::SliderScalar("slider s64 low", ImGuiDataType_S64, &s64_v, &s64_zero, &s64_fifty,"%I64d");
|
||||||
ImGui::SliderScalar("slider s64 high", ImGuiDataType_S64, &s64_v, &s64_hi_a, &s64_hi_b, "%I64d");
|
ImGui::SliderScalar("slider s64 high", ImGuiDataType_S64, &s64_v, &s64_hi_a, &s64_hi_b, "%I64d");
|
||||||
ImGui::SliderScalar("slider s64 full", ImGuiDataType_S64, &s64_v, &s64_min, &s64_max, "%I64d");
|
ImGui::SliderScalar("slider s64 full", ImGuiDataType_S64, &s64_v, &s64_min, &s64_max, "%I64d");
|
||||||
ImGui::SliderScalar("slider u64 low", ImGuiDataType_U64, &u64_v, &u64_zero, &u64_fifty,"%I64u ms");
|
ImGui::SliderScalar("slider u64 low", ImGuiDataType_U64, &u64_v, &u64_zero, &u64_fifty,"%I64u ms");
|
||||||
ImGui::SliderScalar("slider u64 high", ImGuiDataType_U64, &u64_v, &u64_hi_a, &u64_hi_b, "%I64u ms");
|
ImGui::SliderScalar("slider u64 high", ImGuiDataType_U64, &u64_v, &u64_hi_a, &u64_hi_b, "%I64u ms");
|
||||||
ImGui::SliderScalar("slider u64 full", ImGuiDataType_U64, &u64_v, &u64_min, &u64_max, "%I64u ms");
|
ImGui::SliderScalar("slider u64 full", ImGuiDataType_U64, &u64_v, &u64_min, &u64_max, "%I64u ms");
|
||||||
ImGui::SliderScalar("slider float low", ImGuiDataType_Float, &f32_v, &f32_zero, &f32_one);
|
ImGui::SliderScalar("slider float low", ImGuiDataType_Float, &f32_v, &f32_zero, &f32_one);
|
||||||
ImGui::SliderScalar("slider float low^2", ImGuiDataType_Float, &f32_v, &f32_zero, &f32_one, "%.10f", 2.0f);
|
ImGui::SliderScalar("slider float low log", ImGuiDataType_Float, &f32_v, &f32_zero, &f32_one, "%.10f", ImGuiDragFlags_Logarithmic);
|
||||||
ImGui::SliderScalar("slider float high", ImGuiDataType_Float, &f32_v, &f32_lo_a, &f32_hi_a, "%e");
|
ImGui::SliderScalar("slider float high", ImGuiDataType_Float, &f32_v, &f32_lo_a, &f32_hi_a, "%e");
|
||||||
ImGui::SliderScalar("slider double low", ImGuiDataType_Double, &f64_v, &f64_zero, &f64_one, "%.10f grams", 1.0f);
|
ImGui::SliderScalar("slider double low", ImGuiDataType_Double, &f64_v, &f64_zero, &f64_one, "%.10f grams");
|
||||||
ImGui::SliderScalar("slider double low^2",ImGuiDataType_Double, &f64_v, &f64_zero, &f64_one, "%.10f", 2.0f);
|
ImGui::SliderScalar("slider double low log",ImGuiDataType_Double, &f64_v, &f64_zero, &f64_one, "%.10f", ImGuiDragFlags_Logarithmic);
|
||||||
ImGui::SliderScalar("slider double high", ImGuiDataType_Double, &f64_v, &f64_lo_a, &f64_hi_a, "%e grams", 1.0f);
|
ImGui::SliderScalar("slider double high", ImGuiDataType_Double, &f64_v, &f64_lo_a, &f64_hi_a, "%e grams");
|
||||||
|
|
||||||
static bool inputs_step = true;
|
static bool inputs_step = true;
|
||||||
ImGui::Text("Inputs");
|
ImGui::Text("Inputs");
|
||||||
@ -3824,6 +3866,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::SliderFloat("PopupRounding", &style.PopupRounding, 0.0f, 12.0f, "%.0f");
|
ImGui::SliderFloat("PopupRounding", &style.PopupRounding, 0.0f, 12.0f, "%.0f");
|
||||||
ImGui::SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f");
|
ImGui::SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f");
|
||||||
ImGui::SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 12.0f, "%.0f");
|
ImGui::SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 12.0f, "%.0f");
|
||||||
|
ImGui::SliderFloat("LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f, 12.0f, "%.0f");
|
||||||
ImGui::SliderFloat("TabRounding", &style.TabRounding, 0.0f, 12.0f, "%.0f");
|
ImGui::SliderFloat("TabRounding", &style.TabRounding, 0.0f, 12.0f, "%.0f");
|
||||||
ImGui::Text("Alignment");
|
ImGui::Text("Alignment");
|
||||||
ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
|
ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
|
||||||
@ -3935,10 +3978,9 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
"rebuild the font atlas, and call style.ScaleAllSizes() on a reference ImGuiStyle structure.\n"
|
"rebuild the font atlas, and call style.ScaleAllSizes() on a reference ImGuiStyle structure.\n"
|
||||||
"Using those settings here will give you poor quality results.");
|
"Using those settings here will give you poor quality results.");
|
||||||
static float window_scale = 1.0f;
|
static float window_scale = 1.0f;
|
||||||
if (ImGui::DragFloat("window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f")) // Scale only this window
|
if (ImGui::DragFloat("window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f", ImGuiDragFlags_ClampOnInput)) // Scale only this window
|
||||||
ImGui::SetWindowFontScale(IM_MAX(window_scale, MIN_SCALE));
|
ImGui::SetWindowFontScale(window_scale);
|
||||||
if (ImGui::DragFloat("global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f")) // Scale everything
|
ImGui::DragFloat("global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f", ImGuiDragFlags_ClampOnInput); // Scale everything
|
||||||
io.FontGlobalScale = IM_MAX(io.FontGlobalScale, MIN_SCALE);
|
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
|
@ -119,7 +119,6 @@ typedef int ImGuiDataAuthority; // -> enum ImGuiDataAuthority_ // E
|
|||||||
typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
|
typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
|
||||||
typedef int ImGuiButtonFlags; // -> enum ImGuiButtonFlags_ // Flags: for ButtonEx(), ButtonBehavior()
|
typedef int ImGuiButtonFlags; // -> enum ImGuiButtonFlags_ // Flags: for ButtonEx(), ButtonBehavior()
|
||||||
typedef int ImGuiColumnsFlags; // -> enum ImGuiColumnsFlags_ // Flags: BeginColumns()
|
typedef int ImGuiColumnsFlags; // -> enum ImGuiColumnsFlags_ // Flags: BeginColumns()
|
||||||
typedef int ImGuiDragFlags; // -> enum ImGuiDragFlags_ // Flags: for DragBehavior()
|
|
||||||
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag()
|
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag()
|
||||||
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags
|
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags
|
||||||
typedef int ImGuiNavHighlightFlags; // -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight()
|
typedef int ImGuiNavHighlightFlags; // -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight()
|
||||||
@ -128,7 +127,6 @@ typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // F
|
|||||||
typedef int ImGuiNextItemDataFlags; // -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
|
typedef int ImGuiNextItemDataFlags; // -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
|
||||||
typedef int ImGuiNextWindowDataFlags; // -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
|
typedef int ImGuiNextWindowDataFlags; // -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
|
||||||
typedef int ImGuiSeparatorFlags; // -> enum ImGuiSeparatorFlags_ // Flags: for SeparatorEx()
|
typedef int ImGuiSeparatorFlags; // -> enum ImGuiSeparatorFlags_ // Flags: for SeparatorEx()
|
||||||
typedef int ImGuiSliderFlags; // -> enum ImGuiSliderFlags_ // Flags: for SliderBehavior()
|
|
||||||
typedef int ImGuiTextFlags; // -> enum ImGuiTextFlags_ // Flags: for TextEx()
|
typedef int ImGuiTextFlags; // -> enum ImGuiTextFlags_ // Flags: for TextEx()
|
||||||
typedef int ImGuiTooltipFlags; // -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
|
typedef int ImGuiTooltipFlags; // -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
|
||||||
|
|
||||||
@ -360,6 +358,12 @@ IMGUI_API void* ImFileLoadToMemory(const char* filename, const char*
|
|||||||
#define ImCeil(X) ceilf(X)
|
#define ImCeil(X) ceilf(X)
|
||||||
static inline float ImPow(float x, float y) { return powf(x, y); } // DragBehaviorT/SliderBehaviorT uses ImPow with either float/double and need the precision
|
static inline float ImPow(float x, float y) { return powf(x, y); } // DragBehaviorT/SliderBehaviorT uses ImPow with either float/double and need the precision
|
||||||
static inline double ImPow(double x, double y) { return pow(x, y); }
|
static inline double ImPow(double x, double y) { return pow(x, y); }
|
||||||
|
static inline float ImLog(float x) { return logf(x); } // DragBehaviorT/SliderBehaviorT uses ImLog with either float/double and need the precision
|
||||||
|
static inline double ImLog(double x) { return log(x); }
|
||||||
|
static inline float ImAbs(float x) { return fabsf(x); }
|
||||||
|
static inline double ImAbs(double x) { return fabs(x); }
|
||||||
|
static inline float ImSign(float x) { return (x < 0.0f) ? -1.0f : ((x > 0.0f) ? 1.0f : 0.0f); } // Sign operator - returns -1, 0 or 1 based on sign of argument
|
||||||
|
static inline double ImSign(double x) { return (x < 0.0) ? -1.0 : ((x > 0.0) ? 1.0 : 0.0); }
|
||||||
#endif
|
#endif
|
||||||
// - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support variety of types: signed/unsigned int/long long float/double
|
// - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support variety of types: signed/unsigned int/long long float/double
|
||||||
// (Exceptionally using templates here but we could also redefine them for those types)
|
// (Exceptionally using templates here but we could also redefine them for those types)
|
||||||
@ -639,16 +643,18 @@ enum ImGuiButtonFlagsPrivate_
|
|||||||
ImGuiButtonFlags_PressedOnDefault_ = ImGuiButtonFlags_PressedOnClickRelease
|
ImGuiButtonFlags_PressedOnDefault_ = ImGuiButtonFlags_PressedOnClickRelease
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiSliderFlags_
|
// Extend ImGuiDragFlags_
|
||||||
|
enum ImGuiDragFlagsPrivate_
|
||||||
{
|
{
|
||||||
ImGuiSliderFlags_None = 0,
|
ImGuiDragFlags_Vertical = 1 << 20, // Should this widget be orientated vertically?
|
||||||
ImGuiSliderFlags_Vertical = 1 << 0
|
ImGuiDragFlags_ReadOnly = 1 << 21
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiDragFlags_
|
// Extend ImGuiSliderFlags_
|
||||||
|
enum ImGuiSliderFlagsPrivate_
|
||||||
{
|
{
|
||||||
ImGuiDragFlags_None = 0,
|
ImGuiSliderFlags_Vertical = 1 << 20, // Should this slider be orientated vertically?
|
||||||
ImGuiDragFlags_Vertical = 1 << 0
|
ImGuiSliderFlags_ReadOnly = 1 << 21
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extend ImGuiSelectableFlags_
|
// Extend ImGuiSelectableFlags_
|
||||||
@ -1293,11 +1299,11 @@ struct ImGuiContext
|
|||||||
ImGuiStorage WindowsById; // Map window's ImGuiID to ImGuiWindow*
|
ImGuiStorage WindowsById; // Map window's ImGuiID to ImGuiWindow*
|
||||||
int WindowsActiveCount; // Number of unique windows submitted by frame
|
int WindowsActiveCount; // Number of unique windows submitted by frame
|
||||||
ImGuiWindow* CurrentWindow; // Window being drawn into
|
ImGuiWindow* CurrentWindow; // Window being drawn into
|
||||||
ImGuiWindow* HoveredWindow; // Will catch mouse inputs
|
ImGuiWindow* HoveredWindow; // Window the mouse is hovering. Will typically catch mouse inputs.
|
||||||
ImGuiWindow* HoveredRootWindow; // Will catch mouse inputs (for focus/move only)
|
ImGuiWindow* HoveredRootWindow; // == HoveredWindow ? HoveredWindow->RootWindow : NULL, merely a shortcut to avoid null test in some situation.
|
||||||
ImGuiWindow* HoveredWindowUnderMovingWindow; // Hovered window ignoring MovingWindow. Only set if MovingWindow is set.
|
ImGuiWindow* HoveredWindowUnderMovingWindow; // Hovered window ignoring MovingWindow. Only set if MovingWindow is set.
|
||||||
ImGuiDockNode* HoveredDockNode;
|
ImGuiDockNode* HoveredDockNode;
|
||||||
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
|
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actual window that is moved is generally MovingWindow->RootWindow.
|
||||||
ImGuiWindow* WheelingWindow; // Track the window we started mouse-wheeling on. Until a timer elapse or mouse has moved, generally keep scrolling the same window even if during the course of scrolling the mouse ends up hovering a child window.
|
ImGuiWindow* WheelingWindow; // Track the window we started mouse-wheeling on. Until a timer elapse or mouse has moved, generally keep scrolling the same window even if during the course of scrolling the mouse ends up hovering a child window.
|
||||||
ImVec2 WheelingWindowRefMousePos;
|
ImVec2 WheelingWindowRefMousePos;
|
||||||
float WheelingWindowTimer;
|
float WheelingWindowTimer;
|
||||||
@ -1448,6 +1454,8 @@ struct ImGuiContext
|
|||||||
float ColorEditLastSat; // Backup of last Saturation associated to LastColor[3], so we can restore Saturation in lossy RGB<>HSV round trips
|
float ColorEditLastSat; // Backup of last Saturation associated to LastColor[3], so we can restore Saturation in lossy RGB<>HSV round trips
|
||||||
float ColorEditLastColor[3];
|
float ColorEditLastColor[3];
|
||||||
ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker.
|
ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker.
|
||||||
|
float SliderCurrentAccum; // Accumulated slider delta when using navigation controls.
|
||||||
|
bool SliderCurrentAccumDirty; // Has the accumulated slider delta changed since last time we tried to apply it?
|
||||||
bool DragCurrentAccumDirty;
|
bool DragCurrentAccumDirty;
|
||||||
float DragCurrentAccum; // Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings
|
float DragCurrentAccum; // Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings
|
||||||
float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
|
float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
|
||||||
@ -1531,6 +1539,7 @@ struct ImGuiContext
|
|||||||
ActiveIdTimer = 0.0f;
|
ActiveIdTimer = 0.0f;
|
||||||
ActiveIdIsJustActivated = false;
|
ActiveIdIsJustActivated = false;
|
||||||
ActiveIdAllowOverlap = false;
|
ActiveIdAllowOverlap = false;
|
||||||
|
ActiveIdNoClearOnFocusLoss = false;
|
||||||
ActiveIdHasBeenPressedBefore = false;
|
ActiveIdHasBeenPressedBefore = false;
|
||||||
ActiveIdHasBeenEditedBefore = false;
|
ActiveIdHasBeenEditedBefore = false;
|
||||||
ActiveIdHasBeenEditedThisFrame = false;
|
ActiveIdHasBeenEditedThisFrame = false;
|
||||||
@ -1611,6 +1620,8 @@ struct ImGuiContext
|
|||||||
ColorEditOptions = ImGuiColorEditFlags__OptionsDefault;
|
ColorEditOptions = ImGuiColorEditFlags__OptionsDefault;
|
||||||
ColorEditLastHue = ColorEditLastSat = 0.0f;
|
ColorEditLastHue = ColorEditLastSat = 0.0f;
|
||||||
ColorEditLastColor[0] = ColorEditLastColor[1] = ColorEditLastColor[2] = FLT_MAX;
|
ColorEditLastColor[0] = ColorEditLastColor[1] = ColorEditLastColor[2] = FLT_MAX;
|
||||||
|
SliderCurrentAccum = 0.0f;
|
||||||
|
SliderCurrentAccumDirty = false;
|
||||||
DragCurrentAccumDirty = false;
|
DragCurrentAccumDirty = false;
|
||||||
DragCurrentAccum = 0.0f;
|
DragCurrentAccum = 0.0f;
|
||||||
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
||||||
@ -1824,7 +1835,7 @@ struct IMGUI_API ImGuiWindow
|
|||||||
ImDrawList* DrawList; // == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
|
ImDrawList* DrawList; // == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
|
||||||
ImDrawList DrawListInst;
|
ImDrawList DrawListInst;
|
||||||
ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
|
ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
|
||||||
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window.
|
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window == Top-level window.
|
||||||
ImGuiWindow* RootWindowDockStop; // Point to ourself or first ancestor that is not a child window. Doesn't cross through dock nodes. We use this so IsWindowFocused() can behave consistently regardless of docking state.
|
ImGuiWindow* RootWindowDockStop; // Point to ourself or first ancestor that is not a child window. Doesn't cross through dock nodes. We use this so IsWindowFocused() can behave consistently regardless of docking state.
|
||||||
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
||||||
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
||||||
@ -1910,12 +1921,13 @@ struct ImGuiTabItem
|
|||||||
ImGuiWindow* Window; // When TabItem is part of a DockNode's TabBar, we hold on to a window.
|
ImGuiWindow* Window; // When TabItem is part of a DockNode's TabBar, we hold on to a window.
|
||||||
int LastFrameVisible;
|
int LastFrameVisible;
|
||||||
int LastFrameSelected; // This allows us to infer an ordered list of the last activated tabs with little maintenance
|
int LastFrameSelected; // This allows us to infer an ordered list of the last activated tabs with little maintenance
|
||||||
int NameOffset; // When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames
|
|
||||||
float Offset; // Position relative to beginning of tab
|
float Offset; // Position relative to beginning of tab
|
||||||
float Width; // Width currently displayed
|
float Width; // Width currently displayed
|
||||||
float ContentWidth; // Width of actual contents, stored during BeginTabItem() call
|
float ContentWidth; // Width of actual contents, stored during BeginTabItem() call
|
||||||
|
ImS16 NameOffset; // When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames
|
||||||
|
bool WantClose; // Marked as closed by SetTabItemClosed()
|
||||||
|
|
||||||
ImGuiTabItem() { ID = 0; Flags = ImGuiTabItemFlags_None; Window = NULL; LastFrameVisible = LastFrameSelected = -1; NameOffset = -1; Offset = Width = ContentWidth = 0.0f; }
|
ImGuiTabItem() { ID = 0; Flags = ImGuiTabItemFlags_None; Window = NULL; LastFrameVisible = LastFrameSelected = -1; NameOffset = -1; Offset = Width = ContentWidth = 0.0f; WantClose = false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for a tab bar (sizeof() 92~96 bytes)
|
// Storage for a tab bar (sizeof() 92~96 bytes)
|
||||||
@ -1952,7 +1964,7 @@ struct ImGuiTabBar
|
|||||||
{
|
{
|
||||||
if (tab->Window)
|
if (tab->Window)
|
||||||
return tab->Window->Name;
|
return tab->Window->Name;
|
||||||
IM_ASSERT(tab->NameOffset != -1 && tab->NameOffset < TabsNames.Buf.Size);
|
IM_ASSERT(tab->NameOffset != -1 && (int)tab->NameOffset < TabsNames.Buf.Size);
|
||||||
return TabsNames.Buf.Data + tab->NameOffset;
|
return TabsNames.Buf.Data + tab->NameOffset;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -2239,8 +2251,8 @@ namespace ImGui
|
|||||||
|
|
||||||
// Widgets low-level behaviors
|
// Widgets low-level behaviors
|
||||||
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v_speed, const void* p_min, const void* p_max, const char* format, float power, ImGuiDragFlags flags);
|
IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiDragFlags flags);
|
||||||
IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* p_v, const void* p_min, const void* p_max, const char* format, float power, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* p_v, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
||||||
IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f);
|
IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f);
|
||||||
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);
|
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);
|
||||||
IMGUI_API bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0); // Consume previous SetNextItemOpen() data, if any. May return true when logging
|
IMGUI_API bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0); // Consume previous SetNextItemOpen() data, if any. May return true when logging
|
||||||
@ -2249,9 +2261,10 @@ namespace ImGui
|
|||||||
// Template functions are instantiated in imgui_widgets.cpp for a finite number of types.
|
// Template functions are instantiated in imgui_widgets.cpp for a finite number of types.
|
||||||
// To use them externally (for custom widget) you may need an "extern template" statement in your code in order to link to existing instances and silence Clang warnings (see #2036).
|
// To use them externally (for custom widget) you may need an "extern template" statement in your code in order to link to existing instances and silence Clang warnings (see #2036).
|
||||||
// e.g. " extern template IMGUI_API float RoundScalarWithFormatT<float, float>(const char* format, ImGuiDataType data_type, float v); "
|
// e.g. " extern template IMGUI_API float RoundScalarWithFormatT<float, float>(const char* format, ImGuiDataType data_type, float v); "
|
||||||
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API bool DragBehaviorT(ImGuiDataType data_type, T* v, float v_speed, T v_min, T v_max, const char* format, float power, ImGuiDragFlags flags);
|
template<typename T, typename FLOAT_T> IMGUI_API float ScaleRatioFromValueT(ImGuiDataType data_type, T v, T v_min, T v_max, bool is_logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_size);
|
||||||
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API bool SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, T* v, T v_min, T v_max, const char* format, float power, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
template<typename T, typename FLOAT_T> IMGUI_API T ScaleValueFromRatioT(ImGuiDataType data_type, float t, T v_min, T v_max, bool is_logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_size);
|
||||||
template<typename T, typename FLOAT_T> IMGUI_API float SliderCalcRatioFromValueT(ImGuiDataType data_type, T v, T v_min, T v_max, float power, float linear_zero_pos);
|
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API bool DragBehaviorT(ImGuiDataType data_type, T* v, float v_speed, T v_min, T v_max, const char* format, ImGuiDragFlags flags);
|
||||||
|
template<typename T, typename SIGNED_T, typename FLOAT_T> IMGUI_API bool SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, T* v, T v_min, T v_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb);
|
||||||
template<typename T, typename SIGNED_T> IMGUI_API T RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, T v);
|
template<typename T, typename SIGNED_T> IMGUI_API T RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, T v);
|
||||||
|
|
||||||
// Data type helpers
|
// Data type helpers
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user