Merge branch 'master' into docking
# Conflicts: # docs/CHANGELOG.txt # examples/imgui_impl_opengl3.cpp # imgui.cpp
This commit is contained in:
commit
b8e2b2bd6b
@ -1,4 +1,6 @@
|
||||
# editorconfig.org
|
||||
# See http://editorconfig.org to read about the EditorConfig format.
|
||||
# - Automatically supported by VS2017+ and most common IDE or text editors.
|
||||
# - For older VS2010 to VS2015, install https://marketplace.visualstudio.com/items?itemName=EditorConfigTeam.EditorConfig
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
49
.gitignore
vendored
Normal file
49
.gitignore
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
## OSX artifacts
|
||||
.DS_Store
|
||||
|
||||
## Dear ImGui artifacts
|
||||
imgui.ini
|
||||
|
||||
## General build artifacts
|
||||
*.o
|
||||
*.obj
|
||||
*.exe
|
||||
examples/build/*
|
||||
examples/*/Debug/*
|
||||
examples/*/Release/*
|
||||
examples/*/x64/*
|
||||
|
||||
## Visual Studio artifacts
|
||||
.vs
|
||||
ipch
|
||||
*.opensdf
|
||||
*.log
|
||||
*.pdb
|
||||
*.ilk
|
||||
*.user
|
||||
*.sdf
|
||||
*.suo
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
## Xcode artifacts
|
||||
project.xcworkspace
|
||||
xcuserdata
|
||||
|
||||
## Emscripten artifacts
|
||||
examples/*.o.tmp
|
||||
examples/*.out.js
|
||||
examples/*.out.wasm
|
||||
examples/example_emscripten/example_emscripten.*
|
||||
|
||||
## JetBrains IDE artifacts
|
||||
.idea
|
||||
cmake-build-*
|
||||
|
||||
## Unix executables from our example Makefiles
|
||||
examples/example_glfw_opengl2/example_glfw_opengl2
|
||||
examples/example_glfw_opengl3/example_glfw_opengl3
|
||||
examples/example_glut_opengl2/example_glut_opengl2
|
||||
examples/example_null/example_null
|
||||
examples/example_sdl_opengl2/example_sdl_opengl2
|
||||
examples/example_sdl_opengl3/example_sdl_opengl3
|
@ -100,15 +100,13 @@ Other changes:
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.76 WIP (In Progress)
|
||||
VERSION 1.76 (Released 2020-04-12)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Other Changes:
|
||||
|
||||
- Drag and Drop, Nav: Disabling navigation arrow keys when drag and drop is active. In the docking
|
||||
branch pressing arrow keys while dragging a window from a tab could trigger an assert. (#3025)
|
||||
- ColorButton: Added ImGuiColorEditFlags_NoBorder flag to remove the border normally enforced
|
||||
by default for standalone ColorButton.
|
||||
- BeginMenu: Using same ID multiple times appends content to a menu. (#1207) [@rokups]
|
||||
- BeginMenu: Fixed a bug where SetNextWindowXXX data before a BeginMenu() would not be cleared
|
||||
when the menu is not open. (#3030)
|
||||
@ -118,6 +116,8 @@ Other Changes:
|
||||
- Selectable: Allow using ImGuiSelectableFlags_SpanAllColumns in other columns than first. (#125)
|
||||
- TreeNode: Made clicking on arrow with _OpenOnArrow toggle the open state on the Mouse Down
|
||||
event rather than the Mouse Down+Up sequence (this is rather standard behavior).
|
||||
- ColorButton: Added ImGuiColorEditFlags_NoBorder flag to remove the border normally enforced
|
||||
by default for standalone ColorButton.
|
||||
- Nav: Fixed interactions with ImGuiListClipper, so e.g. Home/End result would not clip the
|
||||
landing item on the landing frame. (#787)
|
||||
- Nav: Fixed currently focused item from ever being clipped by ItemAdd(). (#787)
|
||||
@ -126,8 +126,7 @@ Other Changes:
|
||||
ImGuiListClipper as the first thing after Begin() could largely break size calculations. (#3073)
|
||||
- Added optional support for Unicode plane 1-16 (#2538, #2541, #2815) [@cloudwu, @samhocevar]
|
||||
- Compile-time enable with '#define IMGUI_USE_WCHAR32' in imconfig.h.
|
||||
- Generally more consistent support for unsupported codepoints (0xFFFD), in particular when
|
||||
using the default, non-fitting characters will be turned into 0xFFFD instead of being ignored.
|
||||
- More onsistent handling of unsupported code points (0xFFFD).
|
||||
- Surrogate pairs are supported when submitting UTF-16 data via io.AddInputCharacterUTF16(),
|
||||
allowing for more complete CJK input.
|
||||
- sizeof(ImWchar) goes from 2 to 4. IM_UNICODE_CODEPOINT_MAX goes from 0xFFFF to 0x10FFFF.
|
||||
@ -137,11 +136,13 @@ Other Changes:
|
||||
to 64 columns with an assert. (#3037, #125)
|
||||
- Window: Fixed a bug with child window inheriting ItemFlags from their parent when the child
|
||||
window also manipulate the ItemFlags stack. (#3024) [@Stanbroek]
|
||||
- Font: Fixed non-ASCII space occasionally creating unnecessary empty polygons.
|
||||
- Font: Fixed non-ASCII space occasionally creating unnecessary empty looking polygons.
|
||||
- Misc: Added an explicit compile-time test for non-scoped IM_ASSERT() macros to redirect users
|
||||
to a solution rather than encourage people to add braces in the codebase.
|
||||
- Misc: Added additional checks in EndFrame() to verify that io.KeyXXX values have not been
|
||||
tampered with between NewFrame() and EndFrame().
|
||||
- Misc: Made default clipboard handlers for Win32 and OSX use a buffer inside the main context
|
||||
instead of a static buffer, so it can be freed properly on Shutdown. (#3110)
|
||||
- Misc, Freetype: Fixed support for IMGUI_STB_RECT_PACK_FILENAME compile time directive
|
||||
in imgui_freetype.cpp (matching support in the regular code path). (#3062) [@DonKult]
|
||||
- Metrics: Made Tools section more prominent. Showing wire-frame mesh directly hovering the ImDrawCmd
|
||||
@ -151,6 +152,8 @@ Other Changes:
|
||||
- CI: Added more tests on the continuous-integration server: extra warnings for Clang/GCC, building
|
||||
SDL+Metal example, building imgui_freetype.cpp, more compile-time imconfig.h settings: disabling
|
||||
obsolete functions, enabling 32-bit ImDrawIdx, enabling 32-bit ImWchar, disabling demo. [@rokups]
|
||||
- Backends: OpenGL3: Fixed version check mistakenly testing for GL 4.0+ instead of 3.2+ to enable
|
||||
ImGuiBackendFlags_RendererHasVtxOffset, leaving 3.2 contexts without it. (#3119, #2866) [@wolfpld]
|
||||
- Backends: OpenGL3: Added include support for older glbinding 2.x loader. (#3061) [@DonKult]
|
||||
- Backends: Win32: Added ImGui_ImplWin32_EnableDpiAwareness(), ImGui_ImplWin32_GetDpiScaleForHwnd(),
|
||||
ImGui_ImplWin32_GetDpiScaleForMonitor() helpers functions (backported from the docking branch).
|
||||
@ -161,6 +164,7 @@ Other Changes:
|
||||
- Backends: SDL: Added ImGui_ImplSDL2_InitForMetal() for API consistency (even though the function
|
||||
currently does nothing).
|
||||
- Backends: SDL: Fixed mapping for ImGuiKey_KeyPadEnter. (#3031) [@Davido71]
|
||||
- Examples: Win32+DX12: Fixed resizing main window, enabled debug layer. (#3087, #3115) [@sergeyn]
|
||||
- Examples: SDL+DX11: Fixed resizing main window. (#3057) [@joeslay]
|
||||
- Examples: Added SDL+Metal example application. (#3017) [@coding-jackalope]
|
||||
|
||||
|
@ -97,7 +97,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)
|
||||
|
||||
You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let me 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-20190715.zip) (Windows binaries, 1.72 WIP, built 2019/07/15, master branch, 5 executables)
|
||||
- [imgui-demo-binaries-20190715.zip](http://www.dearimgui.org/binaries/imgui-demo-binaries-20200412.zip) (Windows binaries, 1.76 WIP, built 2020/04/12, master branch, 5 executables) 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()`.
|
||||
|
||||
@ -140,7 +140,7 @@ Custom engine
|
||||
[![screenshot tool](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/editor_white_preview.jpg)](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/editor_white.png)
|
||||
|
||||
[Tracy Profiler](https://bitbucket.org/wolfpld/tracy)
|
||||
![tracy profiler](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v173/tracy_profiler.jpg)
|
||||
![tracy profiler](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v176/tracy_profiler.png)
|
||||
|
||||
### Support, Frequently Asked Questions (FAQ)
|
||||
|
||||
@ -196,7 +196,7 @@ Ongoing Dear ImGui development is financially supported by users and private spo
|
||||
*Double-chocolate and Salty caramel sponsors*
|
||||
- [Activision](https://careers.activision.com/c/programmingsoftware-engineering-jobs), [DotEmu](http://www.dotemu.com), [Framefield](http://framefield.com), [Hexagon](https://hexagonxalt.com/the-technology/xalt-visualization), [Kylotonn](https://www.kylotonn.com), [Media Molecule](http://www.mediamolecule.com), [Mesh Consultants](https://www.meshconsultants.ca), [Mobigame](http://www.mobigame.net), [Nadeo](https://www.nadeo.com), [Supercell](http://www.supercell.com), [Remedy Entertainment](https://www.remedygames.com/), [Unit 2 Games](https://unit2games.com/)
|
||||
|
||||
From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations. Please see [detailed list of Dear ImGui supporters](https://github.com/ocornut/imgui/wiki/Sponsors).
|
||||
From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations. Please see [detailed list of Dear ImGui supporters](https://github.com/ocornut/imgui/wiki/Sponsors).
|
||||
|
||||
**THANK YOU to all past and present supporters for helping to keep this project alive and thriving!**
|
||||
|
||||
@ -208,7 +208,7 @@ Dear ImGui is using software and services provided free of charge for open sourc
|
||||
Credits
|
||||
-------
|
||||
|
||||
Developed by [Omar Cornut](http://www.miracleworld.net) and every direct or indirect contributors to the GitHub. The early version of this library was developed with the support of [Media Molecule](http://www.mediamolecule.com) and first used internally on the game [Tearaway](http://tearaway.mediamolecule.com) (Vita).
|
||||
Developed by [Omar Cornut](http://www.miracleworld.net) and every direct or indirect contributors to the GitHub. The early version of this library was developed with the support of [Media Molecule](http://www.mediamolecule.com) and first used internally on the game [Tearaway](http://tearaway.mediamolecule.com) (PS Vita).
|
||||
|
||||
I first discovered the IMGUI paradigm at [Q-Games](http://www.q-games.com) where Atman Binstock had dropped his own simple implementation in the codebase, which I spent quite some time improving and thinking about. It turned out that Atman was exposed to the concept directly by working with Casey. When I moved to Media Molecule I rewrote a new library trying to overcome the flaws and limitations of the first one I've worked with. It became this library and since then I have spent an unreasonable amount of time iterating and improving it.
|
||||
|
||||
|
46
examples/.gitignore
vendored
46
examples/.gitignore
vendored
@ -1,46 +0,0 @@
|
||||
build/*
|
||||
*/Debug/*
|
||||
*/Release/*
|
||||
*/x64/*
|
||||
*.o
|
||||
*.obj
|
||||
*.exe
|
||||
|
||||
## Visual Studio cruft
|
||||
.vs/*
|
||||
*/ipch/*
|
||||
*.opensdf
|
||||
*.log
|
||||
*.pdb
|
||||
*.ilk
|
||||
*.user
|
||||
*.sdf
|
||||
*.suo
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
## Xcode cruft
|
||||
.DS_Store
|
||||
project.xcworkspace
|
||||
xcuserdata
|
||||
|
||||
## Emscripten output
|
||||
*.o.tmp
|
||||
*.out.js
|
||||
*.out.wasm
|
||||
example_emscripten/example_emscripten.*
|
||||
|
||||
## Unix executables
|
||||
example_glfw_opengl2/example_glfw_opengl2
|
||||
example_glfw_opengl3/example_glfw_opengl3
|
||||
example_glut_opengl2/example_glut_opengl2
|
||||
example_null/example_null
|
||||
example_sdl_opengl2/example_sdl_opengl2
|
||||
example_sdl_opengl3/example_sdl_opengl3
|
||||
|
||||
## Dear ImGui Ini files
|
||||
imgui.ini
|
||||
|
||||
## JetBrains IDEs
|
||||
.idea
|
||||
cmake-build-*
|
@ -1,5 +1,5 @@
|
||||
-----------------------------------------------------------------------
|
||||
dear imgui, v1.76 WIP
|
||||
dear imgui, v1.76
|
||||
-----------------------------------------------------------------------
|
||||
examples/README.txt
|
||||
(This is the README file for the examples/ folder. See docs/ for more documentation)
|
||||
|
@ -9,7 +9,9 @@
|
||||
#include <dxgi1_4.h>
|
||||
#include <tchar.h>
|
||||
|
||||
//#define DX12_ENABLE_DEBUG_LAYER
|
||||
#ifdef _DEBUG
|
||||
#define DX12_ENABLE_DEBUG_LAYER
|
||||
#endif
|
||||
|
||||
#ifdef DX12_ENABLE_DEBUG_LAYER
|
||||
#include <dxgidebug.h>
|
||||
@ -460,6 +462,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
case WM_SIZE:
|
||||
if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
|
||||
{
|
||||
WaitForLastSubmittedFrame();
|
||||
ImGui_ImplDX12_InvalidateDeviceObjects();
|
||||
CleanupRenderTarget();
|
||||
ResizeSwapChain(hWnd, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam));
|
||||
|
@ -14,6 +14,7 @@
|
||||
// https://github.com/ocornut/imgui, Original Allegro 5 code by @birthggd
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
struct ALLEGRO_DISPLAY;
|
||||
union ALLEGRO_EVENT;
|
||||
@ -24,6 +25,6 @@ IMGUI_IMPL_API void ImGui_ImplAllegro5_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data);
|
||||
IMGUI_IMPL_API bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* event);
|
||||
|
||||
// Use if you want to reset your rendering device without losing ImGui state.
|
||||
// Use if you want to reset your rendering device without losing Dear ImGui state.
|
||||
IMGUI_IMPL_API bool ImGui_ImplAllegro5_CreateDeviceObjects();
|
||||
IMGUI_IMPL_API void ImGui_ImplAllegro5_InvalidateDeviceObjects();
|
||||
|
@ -11,6 +11,7 @@
|
||||
// https://github.com/ocornut/imgui
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
struct ID3D10Device;
|
||||
|
||||
@ -19,6 +20,6 @@ IMGUI_IMPL_API void ImGui_ImplDX10_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplDX10_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data);
|
||||
|
||||
// Use if you want to reset your rendering device without losing ImGui state.
|
||||
// Use if you want to reset your rendering device without losing Dear ImGui state.
|
||||
IMGUI_IMPL_API void ImGui_ImplDX10_InvalidateDeviceObjects();
|
||||
IMGUI_IMPL_API bool ImGui_ImplDX10_CreateDeviceObjects();
|
||||
|
@ -11,6 +11,7 @@
|
||||
// https://github.com/ocornut/imgui
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
struct ID3D11Device;
|
||||
struct ID3D11DeviceContext;
|
||||
@ -20,6 +21,6 @@ IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data);
|
||||
|
||||
// Use if you want to reset your rendering device without losing ImGui state.
|
||||
// Use if you want to reset your rendering device without losing Dear ImGui state.
|
||||
IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||
IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects();
|
||||
|
@ -13,6 +13,7 @@
|
||||
// https://github.com/ocornut/imgui
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
enum DXGI_FORMAT;
|
||||
struct ID3D12Device;
|
||||
@ -31,6 +32,6 @@ IMGUI_IMPL_API void ImGui_ImplDX12_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplDX12_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandList* graphics_command_list);
|
||||
|
||||
// Use if you want to reset your rendering device without losing ImGui state.
|
||||
// Use if you want to reset your rendering device without losing Dear ImGui state.
|
||||
IMGUI_IMPL_API void ImGui_ImplDX12_InvalidateDeviceObjects();
|
||||
IMGUI_IMPL_API bool ImGui_ImplDX12_CreateDeviceObjects();
|
||||
|
@ -11,6 +11,7 @@
|
||||
// https://github.com/ocornut/imgui
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
struct IDirect3DDevice9;
|
||||
|
||||
@ -19,6 +20,6 @@ IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplDX9_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data);
|
||||
|
||||
// Use if you want to reset your rendering device without losing ImGui state.
|
||||
// Use if you want to reset your rendering device without losing Dear ImGui state.
|
||||
IMGUI_IMPL_API bool ImGui_ImplDX9_CreateDeviceObjects();
|
||||
IMGUI_IMPL_API void ImGui_ImplDX9_InvalidateDeviceObjects();
|
||||
|
@ -18,6 +18,7 @@
|
||||
// Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure!
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
struct GLFWwindow;
|
||||
struct GLFWmonitor;
|
||||
|
@ -16,6 +16,7 @@
|
||||
// https://github.com/ocornut/imgui
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplGLUT_Init();
|
||||
IMGUI_IMPL_API void ImGui_ImplGLUT_InstallFuncs();
|
||||
|
@ -9,13 +9,14 @@
|
||||
// https://github.com/ocornut/imgui
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks);
|
||||
IMGUI_IMPL_API void ImGui_Marmalade_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_Marmalade_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_Marmalade_RenderDrawData(ImDrawData* draw_data);
|
||||
|
||||
// Use if you want to reset your rendering device without losing ImGui state.
|
||||
// Use if you want to reset your rendering device without losing Dear ImGui state.
|
||||
IMGUI_IMPL_API void ImGui_Marmalade_InvalidateDeviceObjects();
|
||||
IMGUI_IMPL_API bool ImGui_Marmalade_CreateDeviceObjects();
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||
// https://github.com/ocornut/imgui
|
||||
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
@class MTLRenderPassDescriptor;
|
||||
@protocol MTLDevice, MTLCommandBuffer, MTLRenderCommandEncoder;
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
// The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API.
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown();
|
||||
|
@ -15,6 +15,7 @@
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2020-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2020-04-12: OpenGL: Fixed context version check mistakenly testing for 4.0+ instead of 3.2+ to enable ImGuiBackendFlags_RendererHasVtxOffset.
|
||||
// 2020-03-24: OpenGL: Added support for glbinding 2.x OpenGL loader.
|
||||
// 2020-01-07: OpenGL: Added support for glbinding 3.x OpenGL loader.
|
||||
// 2019-10-25: OpenGL: Using a combination of GL define and runtime GL version to decide whether to use glDrawElementsBaseVertex(). Fix building with pre-3.2 GL loaders.
|
||||
@ -143,7 +144,7 @@ using namespace gl;
|
||||
#endif
|
||||
|
||||
// OpenGL Data
|
||||
static GLuint g_GlVersion = 0; // Extracted at runtime using GL_MAJOR_VERSION, GL_MINOR_VERSION queries.
|
||||
static GLuint g_GlVersion = 0; // Extracted at runtime using GL_MAJOR_VERSION, GL_MINOR_VERSION queries (e.g. 320 for GL 3.2)
|
||||
static char g_GlslVersionString[32] = ""; // Specified by user or detected based on compile time GL settings.
|
||||
static GLuint g_FontTexture = 0;
|
||||
static GLuint g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0;
|
||||
@ -158,21 +159,21 @@ static void ImGui_ImplOpenGL3_ShutdownPlatformInterface();
|
||||
// Functions
|
||||
bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
||||
{
|
||||
// Query for GL version
|
||||
// Query for GL version (e.g. 320 for GL 3.2)
|
||||
#if !defined(IMGUI_IMPL_OPENGL_ES2)
|
||||
GLint major, minor;
|
||||
glGetIntegerv(GL_MAJOR_VERSION, &major);
|
||||
glGetIntegerv(GL_MINOR_VERSION, &minor);
|
||||
g_GlVersion = major * 1000 + minor;
|
||||
g_GlVersion = major * 100 + minor * 10;
|
||||
#else
|
||||
g_GlVersion = 2000; // GLES 2
|
||||
g_GlVersion = 200; // GLES 2
|
||||
#endif
|
||||
|
||||
// Setup back-end capabilities flags
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendRendererName = "imgui_impl_opengl3";
|
||||
#if IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
|
||||
if (g_GlVersion >= 3200)
|
||||
if (g_GlVersion >= 320)
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||
#endif
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasViewports; // We can create multi-viewports on the Renderer side (optional)
|
||||
@ -389,7 +390,7 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
||||
// Bind texture, Draw
|
||||
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
|
||||
#if IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
|
||||
if (g_GlVersion >= 3200)
|
||||
if (g_GlVersion >= 320)
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)), (GLint)pcmd->VtxOffset);
|
||||
else
|
||||
#endif
|
||||
|
@ -23,6 +23,7 @@
|
||||
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
// Backend API
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
|
||||
|
@ -9,10 +9,12 @@
|
||||
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
|
||||
// [ ] Platform: Multi-viewport / platform windows.
|
||||
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
@class NSEvent;
|
||||
@class NSView;
|
||||
|
||||
IMGUI_API bool ImGui_ImplOSX_Init();
|
||||
IMGUI_API void ImGui_ImplOSX_Shutdown();
|
||||
IMGUI_API void ImGui_ImplOSX_NewFrame(NSView *_Nullable view);
|
||||
IMGUI_API bool ImGui_ImplOSX_HandleEvent(NSEvent *_Nonnull event, NSView *_Nullable view);
|
||||
IMGUI_IMPL_API bool ImGui_ImplOSX_Init();
|
||||
IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(NSView *_Nullable view);
|
||||
IMGUI_IMPL_API bool ImGui_ImplOSX_HandleEvent(NSEvent *_Nonnull event, NSView *_Nullable view);
|
||||
|
@ -17,6 +17,7 @@
|
||||
// https://github.com/ocornut/imgui
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
struct SDL_Window;
|
||||
typedef union SDL_Event SDL_Event;
|
||||
|
@ -22,7 +22,7 @@
|
||||
// Read comments in imgui_impl_vulkan.h.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
// Initialization data, for ImGui_ImplVulkan_Init()
|
||||
|
@ -9,12 +9,14 @@
|
||||
// [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd);
|
||||
IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame();
|
||||
|
||||
// Configuration: Disable gamepad support or linking with xinput.lib
|
||||
// Configuration
|
||||
// - Disable gamepad support or linking with xinput.lib
|
||||
//#define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||
//#define IMGUI_IMPL_WIN32_DISABLE_LINKING_XINPUT
|
||||
|
||||
|
38
imgui.cpp
38
imgui.cpp
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.76 WIP
|
||||
// dear imgui, v1.76
|
||||
// (main code and documentation)
|
||||
|
||||
// Help:
|
||||
@ -4198,7 +4198,7 @@ void ImGui::Shutdown(ImGuiContext* context)
|
||||
g.CurrentTabBarStack.clear();
|
||||
g.ShrinkWidthBuffer.clear();
|
||||
|
||||
g.PrivateClipboard.clear();
|
||||
g.ClipboardHandlerData.clear();
|
||||
g.MenusIdSubmittedThisFrame.clear();
|
||||
g.InputTextState.ClearFreeMemory();
|
||||
|
||||
@ -6473,7 +6473,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
|
||||
window->DC.NavLayerActiveMask = window->DC.NavLayerActiveMaskNext;
|
||||
window->DC.NavLayerActiveMaskNext = 0x00;
|
||||
window->DC.NavFocusScopeIdCurrent = parent_window ? parent_window->DC.NavFocusScopeIdCurrent : 0;
|
||||
window->DC.NavFocusScopeIdCurrent = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->DC.NavFocusScopeIdCurrent : 0; // -V595
|
||||
window->DC.NavHideHighlightOneFrame = false;
|
||||
window->DC.NavHasScroll = (window->ScrollMax.y > 0.0f);
|
||||
|
||||
@ -14908,10 +14908,11 @@ static void ImGui::DockSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettings
|
||||
#endif
|
||||
|
||||
// Win32 clipboard implementation
|
||||
// We use g.ClipboardHandlerData for temporary storage to ensure it is freed on Shutdown()
|
||||
static const char* GetClipboardTextFn_DefaultImpl(void*)
|
||||
{
|
||||
static ImVector<char> buf_local;
|
||||
buf_local.clear();
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.ClipboardHandlerData.clear();
|
||||
if (!::OpenClipboard(NULL))
|
||||
return NULL;
|
||||
HANDLE wbuf_handle = ::GetClipboardData(CF_UNICODETEXT);
|
||||
@ -14923,12 +14924,12 @@ static const char* GetClipboardTextFn_DefaultImpl(void*)
|
||||
if (const WCHAR* wbuf_global = (const WCHAR*)::GlobalLock(wbuf_handle))
|
||||
{
|
||||
int buf_len = ::WideCharToMultiByte(CP_UTF8, 0, wbuf_global, -1, NULL, 0, NULL, NULL);
|
||||
buf_local.resize(buf_len);
|
||||
::WideCharToMultiByte(CP_UTF8, 0, wbuf_global, -1, buf_local.Data, buf_len, NULL, NULL);
|
||||
g.ClipboardHandlerData.resize(buf_len);
|
||||
::WideCharToMultiByte(CP_UTF8, 0, wbuf_global, -1, g.ClipboardHandlerData.Data, buf_len, NULL, NULL);
|
||||
}
|
||||
::GlobalUnlock(wbuf_handle);
|
||||
::CloseClipboard();
|
||||
return buf_local.Data;
|
||||
return g.ClipboardHandlerData.Data;
|
||||
}
|
||||
|
||||
static void SetClipboardTextFn_DefaultImpl(void*, const char* text)
|
||||
@ -14990,13 +14991,14 @@ static const char* GetClipboardTextFn_DefaultImpl(void*)
|
||||
CFDataRef cf_data;
|
||||
if (PasteboardCopyItemFlavorData(main_clipboard, item_id, CFSTR("public.utf8-plain-text"), &cf_data) == noErr)
|
||||
{
|
||||
static ImVector<char> clipboard_text;
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.ClipboardHandlerData.clear();
|
||||
int length = (int)CFDataGetLength(cf_data);
|
||||
clipboard_text.resize(length + 1);
|
||||
CFDataGetBytes(cf_data, CFRangeMake(0, length), (UInt8*)clipboard_text.Data);
|
||||
clipboard_text[length] = 0;
|
||||
g.ClipboardHandlerData.resize(length + 1);
|
||||
CFDataGetBytes(cf_data, CFRangeMake(0, length), (UInt8*)g.ClipboardHandlerData.Data);
|
||||
g.ClipboardHandlerData[length] = 0;
|
||||
CFRelease(cf_data);
|
||||
return clipboard_text.Data;
|
||||
return g.ClipboardHandlerData.Data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -15009,17 +15011,17 @@ static const char* GetClipboardTextFn_DefaultImpl(void*)
|
||||
static const char* GetClipboardTextFn_DefaultImpl(void*)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
return g.PrivateClipboard.empty() ? NULL : g.PrivateClipboard.begin();
|
||||
return g.ClipboardHandlerData.empty() ? NULL : g.ClipboardHandlerData.begin();
|
||||
}
|
||||
|
||||
static void SetClipboardTextFn_DefaultImpl(void*, const char* text)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.PrivateClipboard.clear();
|
||||
g.ClipboardHandlerData.clear();
|
||||
const char* text_end = text + strlen(text);
|
||||
g.PrivateClipboard.resize((int)(text_end - text) + 1);
|
||||
memcpy(&g.PrivateClipboard[0], text, (size_t)(text_end - text));
|
||||
g.PrivateClipboard[(int)(text_end - text)] = 0;
|
||||
g.ClipboardHandlerData.resize((int)(text_end - text) + 1);
|
||||
memcpy(&g.ClipboardHandlerData[0], text, (size_t)(text_end - text));
|
||||
g.ClipboardHandlerData[(int)(text_end - text)] = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
8
imgui.h
8
imgui.h
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.76 WIP
|
||||
// dear imgui, v1.76
|
||||
// (headers)
|
||||
|
||||
// Help:
|
||||
@ -60,8 +60,8 @@ Index of this file:
|
||||
|
||||
// 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)
|
||||
#define IMGUI_VERSION "1.76 WIP"
|
||||
#define IMGUI_VERSION_NUM 17502
|
||||
#define IMGUI_VERSION "1.76"
|
||||
#define IMGUI_VERSION_NUM 17600
|
||||
#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_DOCK 1 // Docking WIP branch
|
||||
@ -1216,7 +1216,7 @@ enum ImGuiCol_
|
||||
};
|
||||
|
||||
// Enumeration for PushStyleVar() / PopStyleVar() to temporarily modify the ImGuiStyle structure.
|
||||
// - The enum only refers to fields of ImGuiStyle which makes sense to be pushed/popped inside UI code.
|
||||
// - The enum only refers to fields of ImGuiStyle which makes sense to be pushed/popped inside UI code.
|
||||
// During initialization or between frames, feel free to just poke into ImGuiStyle directly.
|
||||
// - Tip: Use your programming IDE navigation facilities on the names in the _second column_ below to find the actual members and their description.
|
||||
// In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.76 WIP
|
||||
// dear imgui, v1.76
|
||||
// (demo code)
|
||||
|
||||
// Help:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.76 WIP
|
||||
// dear imgui, v1.76
|
||||
// (drawing and font code)
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.76 WIP
|
||||
// dear imgui, v1.76
|
||||
// (internal structures/api)
|
||||
|
||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||
@ -1349,7 +1349,7 @@ struct ImGuiContext
|
||||
float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
|
||||
float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
|
||||
int TooltipOverrideCount;
|
||||
ImVector<char> PrivateClipboard; // If no custom clipboard handler is defined
|
||||
ImVector<char> ClipboardHandlerData; // If no custom clipboard handler is defined
|
||||
ImVector<ImGuiID> MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once
|
||||
|
||||
// Platform support
|
||||
@ -1656,7 +1656,7 @@ struct IMGUI_API ImGuiWindow
|
||||
ImVec2 ScrollMax;
|
||||
ImVec2 ScrollTarget; // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
|
||||
ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
|
||||
ImVec2 ScrollbarSizes; // Size taken by scrollbars on each axis
|
||||
ImVec2 ScrollbarSizes; // Size taken by each scrollbars on their smaller axis. Pay attention! ScrollbarSizes.x == width of the vertical scrollbar, ScrollbarSizes.y = height of the horizontal scrollbar.
|
||||
bool ScrollbarX, ScrollbarY; // Are scrollbars visible?
|
||||
bool ViewportOwned;
|
||||
bool Active; // Set to true on Begin(), unless Collapsed
|
||||
@ -2104,6 +2104,7 @@ namespace ImGui
|
||||
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
||||
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
||||
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* p_scroll_v, float avail_v, float contents_v, ImDrawCornerFlags rounding_corners);
|
||||
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);
|
||||
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
||||
IMGUI_API ImGuiID GetWindowResizeID(ImGuiWindow* window, int n); // 0..3: corners, 4..7: borders
|
||||
IMGUI_API void SeparatorEx(ImGuiSeparatorFlags flags);
|
||||
@ -2144,7 +2145,7 @@ namespace ImGui
|
||||
IMGUI_API void ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags flags);
|
||||
|
||||
// Plot
|
||||
IMGUI_API void PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size);
|
||||
IMGUI_API int PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size);
|
||||
|
||||
// Shade functions (write over already created vertices)
|
||||
IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.76 WIP
|
||||
// dear imgui, v1.76
|
||||
// (widgets code)
|
||||
|
||||
/*
|
||||
@ -391,8 +391,10 @@ void ImGui::BulletTextV(const char* fmt, va_list args)
|
||||
// - ArrowButton()
|
||||
// - CloseButton() [Internal]
|
||||
// - CollapseButton() [Internal]
|
||||
// - ScrollbarEx() [Internal]
|
||||
// - GetWindowScrollbarID() [Internal]
|
||||
// - GetWindowScrollbarRect() [Internal]
|
||||
// - Scrollbar() [Internal]
|
||||
// - ScrollbarEx() [Internal]
|
||||
// - Image()
|
||||
// - ImageButton()
|
||||
// - Checkbox()
|
||||
@ -819,6 +821,49 @@ ImGuiID ImGui::GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis)
|
||||
return window->GetIDNoKeepAlive(axis == ImGuiAxis_X ? "#SCROLLX" : "#SCROLLY");
|
||||
}
|
||||
|
||||
// Return scrollbar rectangle, must only be called for corresponding axis if window->ScrollbarX/Y is set.
|
||||
ImRect ImGui::GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis)
|
||||
{
|
||||
const ImRect outer_rect = window->Rect();
|
||||
const ImRect inner_rect = window->InnerRect;
|
||||
const float border_size = window->WindowBorderSize;
|
||||
const float scrollbar_size = window->ScrollbarSizes[axis ^ 1]; // (ScrollbarSizes.x = width of Y scrollbar; ScrollbarSizes.y = height of X scrollbar)
|
||||
IM_ASSERT(scrollbar_size > 0.0f);
|
||||
if (axis == ImGuiAxis_X)
|
||||
return ImRect(inner_rect.Min.x, ImMax(outer_rect.Min.y, outer_rect.Max.y - border_size - scrollbar_size), inner_rect.Max.x, outer_rect.Max.y);
|
||||
else
|
||||
return ImRect(ImMax(outer_rect.Min.x, outer_rect.Max.x - border_size - scrollbar_size), inner_rect.Min.y, outer_rect.Max.x, inner_rect.Max.y);
|
||||
}
|
||||
|
||||
void ImGui::Scrollbar(ImGuiAxis axis)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
|
||||
const ImGuiID id = GetWindowScrollbarID(window, axis);
|
||||
KeepAliveID(id);
|
||||
|
||||
// Calculate scrollbar bounding box
|
||||
ImRect bb = GetWindowScrollbarRect(window, axis);
|
||||
ImDrawCornerFlags rounding_corners = 0;
|
||||
if (axis == ImGuiAxis_X)
|
||||
{
|
||||
rounding_corners |= ImDrawCornerFlags_BotLeft;
|
||||
if (!window->ScrollbarY)
|
||||
rounding_corners |= ImDrawCornerFlags_BotRight;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar))
|
||||
rounding_corners |= ImDrawCornerFlags_TopRight;
|
||||
if (!window->ScrollbarX)
|
||||
rounding_corners |= ImDrawCornerFlags_BotRight;
|
||||
}
|
||||
float size_avail = window->InnerRect.Max[axis] - window->InnerRect.Min[axis];
|
||||
float size_contents = window->ContentSize[axis] + window->WindowPadding[axis] * 2.0f;
|
||||
ScrollbarEx(bb, id, axis, &window->Scroll[axis], size_avail, size_contents, rounding_corners);
|
||||
}
|
||||
|
||||
// Vertical/Horizontal scrollbar
|
||||
// The entire piece of code below is rather confusing because:
|
||||
// - We handle absolute seeking (when first clicking outside the grab) and relative manipulation (afterward or when clicking inside the grab)
|
||||
@ -837,7 +882,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa
|
||||
if (bb_frame_width <= 0.0f || bb_frame_height <= 0.0f)
|
||||
return false;
|
||||
|
||||
// When we are too small, start hiding and disabling the grab (this reduce visual noise on very small window and facilitate using the resize grab)
|
||||
// When we are too small, start hiding and disabling the grab (this reduce visual noise on very small window and facilitate using the window resize grab)
|
||||
float alpha = 1.0f;
|
||||
if ((axis == ImGuiAxis_Y) && bb_frame_height < g.FontSize + g.Style.FramePadding.y * 2.0f)
|
||||
alpha = ImSaturate((bb_frame_height - g.FontSize) / (g.Style.FramePadding.y * 2.0f));
|
||||
@ -846,13 +891,12 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa
|
||||
|
||||
const ImGuiStyle& style = g.Style;
|
||||
const bool allow_interaction = (alpha >= 1.0f);
|
||||
const bool horizontal = (axis == ImGuiAxis_X);
|
||||
|
||||
ImRect bb = bb_frame;
|
||||
bb.Expand(ImVec2(-ImClamp(IM_FLOOR((bb_frame_width - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp(IM_FLOOR((bb_frame_height - 2.0f) * 0.5f), 0.0f, 3.0f)));
|
||||
|
||||
// V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
|
||||
const float scrollbar_size_v = horizontal ? bb.GetWidth() : bb.GetHeight();
|
||||
const float scrollbar_size_v = (axis == ImGuiAxis_X) ? bb.GetWidth() : bb.GetHeight();
|
||||
|
||||
// Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount)
|
||||
// But we maintain a minimum size in pixel to allow for the user to still aim inside.
|
||||
@ -868,11 +912,11 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa
|
||||
|
||||
float scroll_max = ImMax(1.0f, size_contents_v - size_avail_v);
|
||||
float scroll_ratio = ImSaturate(*p_scroll_v / scroll_max);
|
||||
float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
|
||||
float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v; // Grab position in normalized space
|
||||
if (held && allow_interaction && grab_h_norm < 1.0f)
|
||||
{
|
||||
float scrollbar_pos_v = horizontal ? bb.Min.x : bb.Min.y;
|
||||
float mouse_pos_v = horizontal ? g.IO.MousePos.x : g.IO.MousePos.y;
|
||||
float scrollbar_pos_v = bb.Min[axis];
|
||||
float mouse_pos_v = g.IO.MousePos[axis];
|
||||
|
||||
// Click position in scrollbar normalized space (0.0f->1.0f)
|
||||
const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);
|
||||
@ -889,7 +933,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa
|
||||
g.ScrollbarClickDeltaToGrabCenter = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f;
|
||||
}
|
||||
|
||||
// Apply scroll
|
||||
// Apply scroll (p_scroll_v will generally point on one member of window->Scroll)
|
||||
// It is ok to modify Scroll here because we are being called in Begin() after the calculation of ContentSize and before setting up our starting position
|
||||
const float scroll_v_norm = ImSaturate((clicked_v_norm - g.ScrollbarClickDeltaToGrabCenter - grab_h_norm * 0.5f) / (1.0f - grab_h_norm));
|
||||
*p_scroll_v = IM_ROUND(scroll_v_norm * scroll_max);//(win_size_contents_v - win_size_v));
|
||||
@ -904,10 +948,11 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa
|
||||
}
|
||||
|
||||
// Render
|
||||
window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, GetColorU32(ImGuiCol_ScrollbarBg), window->WindowRounding, rounding_corners);
|
||||
const ImU32 bg_col = GetColorU32(ImGuiCol_ScrollbarBg);
|
||||
const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab, alpha);
|
||||
window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window->WindowRounding, rounding_corners);
|
||||
ImRect grab_rect;
|
||||
if (horizontal)
|
||||
if (axis == ImGuiAxis_X)
|
||||
grab_rect = ImRect(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y, ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, bb.Max.y);
|
||||
else
|
||||
grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels);
|
||||
@ -916,38 +961,6 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, floa
|
||||
return held;
|
||||
}
|
||||
|
||||
void ImGui::Scrollbar(ImGuiAxis axis)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
|
||||
const ImGuiID id = GetWindowScrollbarID(window, axis);
|
||||
KeepAliveID(id);
|
||||
|
||||
// Calculate scrollbar bounding box
|
||||
const ImRect outer_rect = window->Rect();
|
||||
const ImRect inner_rect = window->InnerRect;
|
||||
const float border_size = window->WindowBorderSize;
|
||||
const float scrollbar_size = window->ScrollbarSizes[axis ^ 1];
|
||||
IM_ASSERT(scrollbar_size > 0.0f);
|
||||
const float other_scrollbar_size = window->ScrollbarSizes[axis];
|
||||
ImDrawCornerFlags rounding_corners = (other_scrollbar_size <= 0.0f) ? ImDrawCornerFlags_BotRight : 0;
|
||||
ImRect bb;
|
||||
if (axis == ImGuiAxis_X)
|
||||
{
|
||||
bb.Min = ImVec2(inner_rect.Min.x, ImMax(outer_rect.Min.y, outer_rect.Max.y - border_size - scrollbar_size));
|
||||
bb.Max = ImVec2(inner_rect.Max.x, outer_rect.Max.y);
|
||||
rounding_corners |= ImDrawCornerFlags_BotLeft;
|
||||
}
|
||||
else
|
||||
{
|
||||
bb.Min = ImVec2(ImMax(outer_rect.Min.x, outer_rect.Max.x - border_size - scrollbar_size), inner_rect.Min.y);
|
||||
bb.Max = ImVec2(outer_rect.Max.x, window->InnerRect.Max.y);
|
||||
rounding_corners |= ((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImDrawCornerFlags_TopRight : 0;
|
||||
}
|
||||
ScrollbarEx(bb, id, axis, &window->Scroll[axis], inner_rect.Max[axis] - inner_rect.Min[axis], window->ContentSize[axis] + window->WindowPadding[axis] * 2.0f, rounding_corners);
|
||||
}
|
||||
|
||||
void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
@ -5354,8 +5367,8 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
||||
// - Double-click on label = Toggle on MouseDoubleClick (when _OpenOnDoubleClick=1)
|
||||
// - Double-click on arrow = Toggle on MouseDoubleClick (when _OpenOnDoubleClick=1 and _OpenOnArrow=0)
|
||||
// This makes _OpenOnArrow have a subtle effect on _OpenOnDoubleClick: arrow click reacts on Down rather than Up.
|
||||
// It is rather standard that arrow click react on Down rather than Up and we'd be tempted to make it the default
|
||||
// (by removing the _OpenOnArrow test below), however this would have a perhaps surprising effect on CollapsingHeader()?
|
||||
// It is rather standard that arrow click react on Down rather than Up and we'd be tempted to make it the default
|
||||
// (by removing the _OpenOnArrow test below), however this would have a perhaps surprising effect on CollapsingHeader()?
|
||||
// So right now we are making this optional. May evolve later.
|
||||
if (is_mouse_x_over_arrow && (flags & ImGuiTreeNodeFlags_OpenOnArrow))
|
||||
button_flags |= ImGuiButtonFlags_PressedOnClick;
|
||||
@ -5845,13 +5858,13 @@ bool ImGui::ListBox(const char* label, int* current_item, bool (*items_getter)(v
|
||||
// - PlotHistogram()
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size)
|
||||
int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
return -1;
|
||||
|
||||
ImGuiContext& g = *GImGui;
|
||||
const ImGuiStyle& style = g.Style;
|
||||
const ImGuiID id = window->GetID(label);
|
||||
|
||||
@ -5866,7 +5879,7 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
|
||||
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0));
|
||||
ItemSize(total_bb, style.FramePadding.y);
|
||||
if (!ItemAdd(total_bb, 0, &frame_bb))
|
||||
return;
|
||||
return -1;
|
||||
const bool hovered = ItemHoverable(frame_bb, id);
|
||||
|
||||
// Determine scale from values if not specified
|
||||
@ -5891,13 +5904,13 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
|
||||
RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
|
||||
|
||||
const int values_count_min = (plot_type == ImGuiPlotType_Lines) ? 2 : 1;
|
||||
int idx_hovered = -1;
|
||||
if (values_count >= values_count_min)
|
||||
{
|
||||
int res_w = ImMin((int)frame_size.x, values_count) + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0);
|
||||
int item_count = values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0);
|
||||
|
||||
// Tooltip on hover
|
||||
int v_hovered = -1;
|
||||
if (hovered && inner_bb.Contains(g.IO.MousePos))
|
||||
{
|
||||
const float t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0f, 0.9999f);
|
||||
@ -5910,7 +5923,7 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
|
||||
SetTooltip("%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx+1, v1);
|
||||
else if (plot_type == ImGuiPlotType_Histogram)
|
||||
SetTooltip("%d: %8.4g", v_idx, v0);
|
||||
v_hovered = v_idx;
|
||||
idx_hovered = v_idx;
|
||||
}
|
||||
|
||||
const float t_step = 1.0f / (float)res_w;
|
||||
@ -5937,13 +5950,13 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
|
||||
ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, (plot_type == ImGuiPlotType_Lines) ? tp1 : ImVec2(tp1.x, histogram_zero_line_t));
|
||||
if (plot_type == ImGuiPlotType_Lines)
|
||||
{
|
||||
window->DrawList->AddLine(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base);
|
||||
window->DrawList->AddLine(pos0, pos1, idx_hovered == v1_idx ? col_hovered : col_base);
|
||||
}
|
||||
else if (plot_type == ImGuiPlotType_Histogram)
|
||||
{
|
||||
if (pos1.x >= pos0.x + 2.0f)
|
||||
pos1.x -= 1.0f;
|
||||
window->DrawList->AddRectFilled(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base);
|
||||
window->DrawList->AddRectFilled(pos0, pos1, idx_hovered == v1_idx ? col_hovered : col_base);
|
||||
}
|
||||
|
||||
t0 = t1;
|
||||
@ -5957,6 +5970,10 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
|
||||
|
||||
if (label_size.x > 0.0f)
|
||||
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label);
|
||||
|
||||
// Return hovered index or -1 if none are hovered.
|
||||
// This is currently not exposed in the public API because we need a larger redesign of the whole thing, but in the short-term we are making it available in PlotEx().
|
||||
return idx_hovered;
|
||||
}
|
||||
|
||||
struct ImGuiPlotArrayGetterData
|
||||
|
@ -1,5 +1,4 @@
|
||||
// imgui_stdlib.cpp
|
||||
// Wrappers for C++ standard library (STL) types (std::string, etc.)
|
||||
// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
|
||||
// This is also an example of how you may wrap your own similar types.
|
||||
|
||||
// Compatibility:
|
||||
|
@ -1,5 +1,4 @@
|
||||
// imgui_stdlib.h
|
||||
// Wrappers for C++ standard library (STL) types (std::string, etc.)
|
||||
// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
|
||||
// This is also an example of how you may wrap your own similar types.
|
||||
|
||||
// Compatibility:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Wrapper to use FreeType (instead of stb_truetype) for Dear ImGui
|
||||
// dear imgui: wrapper to use FreeType (instead of stb_truetype)
|
||||
// Get latest version at https://github.com/ocornut/imgui/tree/master/misc/freetype
|
||||
// Original code by @vuhdo (Aleksei Skriabin). Improvements by @mikesart. Maintained and v0.60+ by @ocornut.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Wrapper to use FreeType (instead of stb_truetype) for Dear ImGui
|
||||
// dear imgui: wrapper to use FreeType (instead of stb_truetype)
|
||||
// Get latest version at https://github.com/ocornut/imgui/tree/master/misc/freetype
|
||||
// Original code by @Vuhdo (Aleksei Skriabin), maintained by @ocornut
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// imgui_single_file.h
|
||||
// dear imgui: single-file wrapper include
|
||||
// We use this to validate compiling all *.cpp files in a same compilation unit.
|
||||
// Users of that technique (also called "Unity builds") can generally provide this themselves,
|
||||
// so we don't really recommend you use this in your projects.
|
||||
|
Loading…
Reference in New Issue
Block a user