mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-01 11:39:15 +08:00
Merge branch 'viewport' into docking
# Conflicts: # docs/CHANGELOG.txt # imgui.cpp # imgui_draw.cpp
This commit is contained in:
commit
f94af2f5c5
@ -11,7 +11,10 @@ indent_size = 4
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# Makefile
|
||||
[imstb_*]
|
||||
indent_size = 3
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
@ -94,10 +94,12 @@ Other Changes:
|
||||
- Added .editorconfig file for text editors to standardize using spaces. (#2038) [@kudaba]
|
||||
- ImDrawList: Fixed AddCircle(), AddCircleFilled() angle step being off, which was visible when drawing a "circle"
|
||||
with a small number of segments (e.g. an hexagon). (#2287) [@baktery]
|
||||
- Fonts: imgui_freetype: Added support for imgui allocators + custom FreeType only SetAllocatorFunctions. (#2285) [@Vuhdo]
|
||||
- ImFontAtlas: Added 0x2000-0x206F general punctuation range to default ChineseFull/ChineseSimplifiedCommon ranges. (#2093)
|
||||
- ImFontAtlas: FreeType: Added support for imgui allocators + custom FreeType only SetAllocatorFunctions. (#2285) [@Vuhdo]
|
||||
- Examples: Win32: Using GetForegroundWindow()+IsChild() instead of GetActiveWindow() to be compatible with windows created
|
||||
in a different thread or parent. (#1951, #2087, #2156, #2232) [many people]
|
||||
- Examples: Win32: Added support for XInput games (if ImGuiConfigFlags_NavEnableGamepad is enabled).
|
||||
- Examples: Win32: Added support for mouse buttons 4 and 5 via WM_XBUTTON* messages. (#2264)
|
||||
- Examples: DirectX9: Explicitly disable fog (D3DRS_FOGENABLE) before drawing in case user state has it set. (#2288, #2230)
|
||||
|
||||
|
||||
|
@ -149,7 +149,7 @@ Frameworks:
|
||||
- LÖVE+Lua: [love-imgui](https://github.com/slages/love-imgui)
|
||||
- Magnum: [ImGuiIntegration](https://doc.magnum.graphics/magnum/namespaceMagnum_1_1ImGuiIntegration.html) ([example](https://doc.magnum.graphics/magnum/examples-imgui.html))
|
||||
- NanoRT: [syoyo/imgui](https://github.com/syoyo/imgui/tree/nanort)
|
||||
- Qt3d: [imgui-qt3d](https://github.com/alpqr/imgui-qt3d), QOpenGLWindow [qtimgui](https://github.com/ocornut/imgui/issues/1910)
|
||||
- Qt: [imgui-qt3d](https://github.com/alpqr/imgui-qt3d) / [QOpenGLWindow (qtimgui)](https://github.com/ocornut/imgui/issues/1910) / [QtDirect3D](https://github.com/giladreich/QtDirect3D) / [qt6](https://github.com/alpqr/qvk6/tree/imgui/examples/rhi/imguidemo)
|
||||
- SFML: [imgui-sfml](https://github.com/EliasD/imgui-sfml)
|
||||
- Software renderer: [imgui_software_renderer](https://github.com/emilk/imgui_software_renderer)
|
||||
- Unreal Engine 4: [segross/UnrealImGui](https://github.com/segross/UnrealImGui) or [sronsse/UnrealEngine_ImGui](https://github.com/sronsse/UnrealEngine_ImGui)
|
||||
@ -175,8 +175,8 @@ User screenshots:
|
||||
<br>[Gallery Part 4](https://github.com/ocornut/imgui/issues/973) (Jan 2017 to Aug 2017)
|
||||
<br>[Gallery Part 5](https://github.com/ocornut/imgui/issues/1269) (Aug 2017 to Feb 2018)
|
||||
<br>[Gallery Part 6](https://github.com/ocornut/imgui/issues/1607) (Feb 2018 to June 2018)
|
||||
<br>[Gallery Part 7](https://github.com/ocornut/imgui/issues/1902) (June 2018 to January 2018)
|
||||
<br>[Gallery Part 8](https://github.com/ocornut/imgui/issues/2265) (January 2018 onward)
|
||||
<br>[Gallery Part 7](https://github.com/ocornut/imgui/issues/1902) (June 2018 to January 2019)
|
||||
<br>[Gallery Part 8](https://github.com/ocornut/imgui/issues/2265) (January 2019 onward)
|
||||
<br>Also see the [Mega screenshots](https://github.com/ocornut/imgui/issues/1273) for an idea of the available features.
|
||||
|
||||
Custom engine
|
||||
|
@ -168,61 +168,61 @@ example_win32_directx11/
|
||||
|
||||
example_win32_directx12/
|
||||
DirectX12 example, Windows only.
|
||||
This is quite long and tedious, because: DirectX12.
|
||||
= main.cpp + imgui_impl_win32.cpp + imgui_impl_dx12.cpp
|
||||
This is quite long and tedious, because: DirectX12.
|
||||
|
||||
example_apple_metal/
|
||||
OSX & iOS + Metal.
|
||||
= main.m + imgui_impl_osx.mm + imgui_impl_metal.mm
|
||||
It is based on the "cross-platform" game template provided with Xcode as of Xcode 9.
|
||||
(NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.)
|
||||
= game template + imgui_impl_osx.mm + imgui_impl_metal.mm
|
||||
|
||||
example_apple_opengl2/
|
||||
OSX + OpenGL2.
|
||||
(NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.)
|
||||
= main.mm + imgui_impl_osx.mm + imgui_impl_opengl2.cpp
|
||||
(NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.)
|
||||
|
||||
example_glfw_opengl2/
|
||||
GLFW + OpenGL2 example (legacy, fixed pipeline).
|
||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
|
||||
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||
**Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)**
|
||||
GLFW + OpenGL2 example (legacy, fixed pipeline).
|
||||
This code is mostly provided as a reference to learn about Dear ImGui integration, because it is shorter.
|
||||
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
|
||||
make things more complicated, will require your code to reset many OpenGL attributes to their initial
|
||||
state, and might confuse your GPU driver. One star, not recommended.
|
||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl2.cpp
|
||||
|
||||
example_glfw_opengl3/
|
||||
GLFW (Win32, Mac, Linux) + OpenGL3+/ES2/ES3 example (programmable pipeline, binding modern functions with GL3W).
|
||||
GLFW (Win32, Mac, Linux) + OpenGL3+/ES2/ES3 example (programmable pipeline).
|
||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
|
||||
This uses more modern OpenGL calls and custom shaders.
|
||||
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
|
||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
|
||||
|
||||
example_glfw_vulkan/
|
||||
GLFW (Win32, Mac, Linux) + Vulkan example.
|
||||
This is quite long and tedious, because: Vulkan.
|
||||
= main.cpp + imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp
|
||||
This is quite long and tedious, because: Vulkan.
|
||||
|
||||
example_sdl_opengl2/
|
||||
SDL2 (Win32, Mac, Linux etc.) + OpenGL example (legacy, fixed pipeline).
|
||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
|
||||
**DO NOT USE OPENGL2 CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||
**Prefer using OPENGL3 code (with gl3w/glew/glad, you can replace the OpenGL function loader)**
|
||||
SDL2 (Win32, Mac, Linux etc.) + OpenGL example (legacy, fixed pipeline).
|
||||
This code is mostly provided as a reference to learn about Dear ImGui integration, because it is shorter.
|
||||
If your code is using GL3+ context or any semi modern OpenGL calls, using this renderer is likely to
|
||||
make things more complicated, will require your code to reset many OpenGL attributes to their initial
|
||||
state, and might confuse your GPU driver. One star, not recommended.
|
||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
|
||||
|
||||
example_sdl_opengl3/
|
||||
SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+/ES2/ES3 example.
|
||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
|
||||
This uses more modern OpenGL calls and custom shaders.
|
||||
Prefer using that if you are using modern OpenGL in your application (anything with shaders).
|
||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
|
||||
|
||||
example_sdl_vulkan/
|
||||
SDL2 (Win32, Mac, Linux, etc.) + Vulkan example.
|
||||
This is quite long and tedious, because: Vulkan.
|
||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_vulkan.cpp
|
||||
This is quite long and tedious, because: Vulkan.
|
||||
|
||||
example_allegro5/
|
||||
Allegro 5 example.
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import <MetalKit/MetalKit.h>
|
||||
|
||||
@interface Renderer : NSObject <MTKViewDelegate>
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import "Renderer.h"
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
#import <MetalKit/MetalKit.h>
|
||||
#import "Renderer.h"
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import "ViewController.h"
|
||||
#import "Renderer.h"
|
||||
#include "imgui.h"
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
|
@ -141,8 +141,14 @@ int main(int, char**)
|
||||
glViewport(0, 0, display_w, display_h);
|
||||
glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
//glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound, but prefer using the GL3+ code.
|
||||
|
||||
// If you are using this code with non-legacy OpenGL header/contexts (which you should not, prefer using imgui_impl_opengl3.cpp!!),
|
||||
// you may need to backup/reset/restore current shader using the commented lines below.
|
||||
//GLint last_program;
|
||||
//glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
|
||||
//glUseProgram(0);
|
||||
ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData());
|
||||
//glUseProgram(last_program);
|
||||
|
||||
// Update and Render additional Platform Windows
|
||||
// (Platform functions may change the current OpenGL context, so we save/restore it to make it easier to paste this code elsewhere.
|
||||
|
@ -98,13 +98,13 @@ int main(int, char**)
|
||||
// Create application window
|
||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||
RegisterClassEx(&wc);
|
||||
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("Dear ImGui DirectX10 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
||||
HWND hwnd = CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX10 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
||||
|
||||
// Initialize Direct3D
|
||||
if (CreateDeviceD3D(hwnd) < 0)
|
||||
{
|
||||
CleanupDeviceD3D();
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ int main(int, char**)
|
||||
|
||||
CleanupDeviceD3D();
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -114,13 +114,13 @@ int main(int, char**)
|
||||
// Create application window
|
||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||
RegisterClassEx(&wc);
|
||||
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("Dear ImGui DirectX11 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
||||
HWND hwnd = CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX11 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
||||
|
||||
// Initialize Direct3D
|
||||
if (CreateDeviceD3D(hwnd) < 0)
|
||||
{
|
||||
CleanupDeviceD3D();
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ int main(int, char**)
|
||||
|
||||
CleanupDeviceD3D();
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -272,13 +272,13 @@ int main(int, char**)
|
||||
// Create application window
|
||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||
RegisterClassEx(&wc);
|
||||
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("Dear ImGui DirectX12 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
||||
HWND hwnd = CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX12 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
||||
|
||||
// Initialize Direct3D
|
||||
if (CreateDeviceD3D(hwnd) < 0)
|
||||
{
|
||||
CleanupDeviceD3D();
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ int main(int, char**)
|
||||
|
||||
CleanupDeviceD3D();
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -49,13 +49,13 @@ int main(int, char**)
|
||||
// Create application window
|
||||
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
|
||||
RegisterClassEx(&wc);
|
||||
HWND hwnd = CreateWindow(_T("ImGui Example"), _T("Dear ImGui DirectX9 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
||||
HWND hwnd = CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX9 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
|
||||
|
||||
// Initialize Direct3D
|
||||
LPDIRECT3D9 pD3D;
|
||||
if ((pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL)
|
||||
{
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||
return 0;
|
||||
}
|
||||
ZeroMemory(&g_d3dpp, sizeof(g_d3dpp));
|
||||
@ -71,7 +71,7 @@ int main(int, char**)
|
||||
if (pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice) < 0)
|
||||
{
|
||||
pD3D->Release();
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ int main(int, char**)
|
||||
if (g_pd3dDevice) g_pd3dDevice->Release();
|
||||
if (pD3D) pD3D->Release();
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
UnregisterClass(wc.lpszClassName, wc.hInstance);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -113,7 +113,14 @@ void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data)
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
//glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound
|
||||
|
||||
// If you are using this code with non-legacy OpenGL header/contexts (which you should not, prefer using imgui_impl_opengl3.cpp!!),
|
||||
// you may need to backup/reset/restore current shader using the lines below. DO NOT MODIFY THIS FILE! Add the code in your calling function:
|
||||
// GLint last_program;
|
||||
// glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
|
||||
// glUseProgram(0);
|
||||
// ImGui_ImplOpenGL2_RenderDrawData(...);
|
||||
// glUseProgram(last_program)
|
||||
|
||||
// Setup viewport, orthographic projection matrix
|
||||
// Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is (0,0) for single viewport apps.
|
||||
|
@ -295,7 +295,7 @@ static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
|
||||
}
|
||||
}
|
||||
|
||||
// SDL_CaptureMouse() will let the OS know that our drag outside the SDL window boundaries shouldn't trigger the OS window resize cursor.
|
||||
// SDL_CaptureMouse() let the OS know e.g. that our imgui drag outside the SDL window boundaries shouldn't e.g. trigger the OS window resize cursor.
|
||||
// The function is only supported from SDL 2.0.4 (released Jan 2016)
|
||||
bool any_mouse_button_down = ImGui::IsAnyMouseDown();
|
||||
SDL_CaptureMouse(any_mouse_button_down ? SDL_TRUE : SDL_FALSE);
|
||||
|
@ -20,7 +20,8 @@
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||
// 2019-01-17: Inputs: Using GetForegroundWindow()+IsChild() instead of GetActiveWindow() to be compatible with windows created in a different thread or parent.
|
||||
// 2019-01-17: Misc: Using GetForegroundWindow()+IsChild() instead of GetActiveWindow() to be compatible with windows created in a different thread or parent.
|
||||
// 2019-01-17: Inputs: Added support for mouse buttons 4 and 5 via WM_XBUTTON* messages.
|
||||
// 2019-01-15: Inputs: Added support for XInput gamepads (if ImGuiConfigFlags_NavEnableGamepad is set by user application).
|
||||
// 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
|
||||
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||
@ -323,11 +324,13 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
|
||||
case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:
|
||||
case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK:
|
||||
case WM_XBUTTONDOWN: case WM_XBUTTONDBLCLK:
|
||||
{
|
||||
int button = 0;
|
||||
if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) button = 0;
|
||||
if (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) button = 1;
|
||||
if (msg == WM_MBUTTONDOWN || msg == WM_MBUTTONDBLCLK) button = 2;
|
||||
if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) { button = 0; }
|
||||
if (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) { button = 1; }
|
||||
if (msg == WM_MBUTTONDOWN || msg == WM_MBUTTONDBLCLK) { button = 2; }
|
||||
if (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONDBLCLK) { button = (GET_XBUTTON_WPARAM(wParam) == XBUTTON1) ? 3 : 4; }
|
||||
if (!ImGui::IsAnyMouseDown() && ::GetCapture() == NULL)
|
||||
::SetCapture(hwnd);
|
||||
io.MouseDown[button] = true;
|
||||
@ -336,11 +339,13 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
|
||||
case WM_LBUTTONUP:
|
||||
case WM_RBUTTONUP:
|
||||
case WM_MBUTTONUP:
|
||||
case WM_XBUTTONUP:
|
||||
{
|
||||
int button = 0;
|
||||
if (msg == WM_LBUTTONUP) button = 0;
|
||||
if (msg == WM_RBUTTONUP) button = 1;
|
||||
if (msg == WM_MBUTTONUP) button = 2;
|
||||
if (msg == WM_LBUTTONUP) { button = 0; }
|
||||
if (msg == WM_RBUTTONUP) { button = 1; }
|
||||
if (msg == WM_MBUTTONUP) { button = 2; }
|
||||
if (msg == WM_XBUTTONUP) { button = (GET_XBUTTON_WPARAM(wParam) == XBUTTON1) ? 3 : 4; }
|
||||
io.MouseDown[button] = false;
|
||||
if (!ImGui::IsAnyMouseDown() && ::GetCapture() == hwnd)
|
||||
::ReleaseCapture();
|
||||
@ -411,6 +416,8 @@ typedef enum { MDT_EFFECTIVE_DPI = 0, MDT_ANGULAR_DPI = 1, MDT_RAW_DPI = 2, MDT_
|
||||
#ifndef _DPI_AWARENESS_CONTEXTS_
|
||||
DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
|
||||
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE (DPI_AWARENESS_CONTEXT)-3
|
||||
#endif
|
||||
#ifndef DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
|
||||
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 (DPI_AWARENESS_CONTEXT)-4
|
||||
#endif
|
||||
typedef HRESULT(WINAPI * PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS); // Shcore.lib+dll, Windows 8.1
|
||||
|
20
imgui.cpp
20
imgui.cpp
@ -970,7 +970,9 @@ CODE
|
||||
#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness //
|
||||
#pragma clang diagnostic ignored "-Wformat-pedantic" // warning : format specifies type 'void *' but the argument has type 'xxxx *' // unreasonable, would lead to casting every %p arg to void*. probably enabled by -pedantic.
|
||||
#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int'
|
||||
#if __has_warning("-Wzero-as-null-pointer-constant")
|
||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning : zero as null pointer constant // some standard header variations use #define NULL 0
|
||||
#endif
|
||||
#if __has_warning("-Wdouble-promotion")
|
||||
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
|
||||
#endif
|
||||
@ -1065,11 +1067,19 @@ static int FindPlatformMonitorForRect(const ImRect& r);
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Current context pointer. Implicitly used by all Dear ImGui functions. Always assumed to be != NULL.
|
||||
// CreateContext() will automatically set this pointer if it is NULL. Change to a different context by calling ImGui::SetCurrentContext().
|
||||
// If you use DLL hotreloading you might need to call SetCurrentContext() after reloading code from this file.
|
||||
// ImGui functions are not thread-safe because of this pointer. If you want thread-safety to allow N threads to access N different contexts, you can:
|
||||
// - Change this variable to use thread local storage. You may #define GImGui in imconfig.h for that purpose. Future development aim to make this context pointer explicit to all calls. Also read https://github.com/ocornut/imgui/issues/586
|
||||
// - Having multiple instances of the ImGui code compiled inside different namespace (easiest/safest, if you have a finite number of contexts)
|
||||
// ImGui::CreateContext() will automatically set this pointer if it is NULL. Change to a different context by calling ImGui::SetCurrentContext().
|
||||
// 1) Important: globals are not shared across DLL boundaries! If you use DLLs or any form of hot-reloading: you will need to call
|
||||
// SetCurrentContext() (with the pointer you got from CreateContext) from each unique static/DLL boundary, and after each hot-reloading.
|
||||
// In your debugger, add GImGui to your watch window and notice how its value changes depending on which location you are currently stepping into.
|
||||
// 2) Important: Dear ImGui functions are not thread-safe because of this pointer.
|
||||
// If you want thread-safety to allow N threads to access N different contexts, you can:
|
||||
// - Change this variable to use thread local storage so each thread can refer to a different context, in imconfig.h:
|
||||
// struct ImGuiContext;
|
||||
// extern thread_local ImGuiContext* MyImGuiTLS;
|
||||
// #define GImGui MyImGuiTLS
|
||||
// And then define MyImGuiTLS in one of your cpp file. Note that thread_local is a C++11 keyword, earlier C++ uses compiler-specific keyword.
|
||||
// - Future development aim to make this context pointer explicit to all calls. Also read https://github.com/ocornut/imgui/issues/586
|
||||
// - If you need a finite number of contexts, you may compile and use multiple instances of the ImGui code from different namespace.
|
||||
#ifndef GImGui
|
||||
ImGuiContext* GImGui = NULL;
|
||||
#endif
|
||||
|
2
imgui.h
2
imgui.h
@ -80,7 +80,9 @@ Index of this file:
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wold-style-cast"
|
||||
#if __has_warning("-Wzero-as-null-pointer-constant")
|
||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#endif
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 8
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
|
@ -71,7 +71,9 @@ Index of this file:
|
||||
#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int'
|
||||
#pragma clang diagnostic ignored "-Wformat-security" // warning : warning: format string is not a string literal
|
||||
#pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.
|
||||
#if __has_warning("-Wzero-as-null-pointer-constant")
|
||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning : zero as null pointer constant // some standard header variations use #define NULL 0
|
||||
#endif
|
||||
#if __has_warning("-Wdouble-promotion")
|
||||
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
|
||||
#endif
|
||||
|
@ -57,7 +57,9 @@ Index of this file:
|
||||
#pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants ok.
|
||||
#pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
|
||||
#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness //
|
||||
#if __has_warning("-Wzero-as-null-pointer-constant")
|
||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning : zero as null pointer constant // some standard header variations use #define NULL 0
|
||||
#endif
|
||||
#if __has_warning("-Wcomma")
|
||||
#pragma clang diagnostic ignored "-Wcomma" // warning : possible misuse of comma operator here //
|
||||
#endif
|
||||
@ -2173,7 +2175,8 @@ const ImWchar* ImFontAtlas::GetGlyphRangesChineseFull()
|
||||
static const ImWchar ranges[] =
|
||||
{
|
||||
0x0020, 0x00FF, // Basic Latin + Latin Supplement
|
||||
0x3000, 0x30FF, // Punctuations, Hiragana, Katakana
|
||||
0x2000, 0x206F, // General Punctuation
|
||||
0x3000, 0x30FF, // CJK Symbols and Punctuations, Hiragana, Katakana
|
||||
0x31F0, 0x31FF, // Katakana Phonetic Extensions
|
||||
0xFF00, 0xFFEF, // Half-width characters
|
||||
0x4e00, 0x9FAF, // CJK Ideograms
|
||||
@ -2249,9 +2252,10 @@ const ImWchar* ImFontAtlas::GetGlyphRangesChineseSimplifiedCommon()
|
||||
static ImWchar base_ranges[] = // not zero-terminated
|
||||
{
|
||||
0x0020, 0x00FF, // Basic Latin + Latin Supplement
|
||||
0x3000, 0x30FF, // Punctuations, Hiragana, Katakana
|
||||
0x2000, 0x206F, // General Punctuation
|
||||
0x3000, 0x30FF, // CJK Symbols and Punctuations, Hiragana, Katakana
|
||||
0x31F0, 0x31FF, // Katakana Phonetic Extensions
|
||||
0xFF00, 0xFFEF, // Half-width characters
|
||||
0xFF00, 0xFFEF // Half-width characters
|
||||
};
|
||||
static ImWchar full_ranges[IM_ARRAYSIZE(base_ranges) + IM_ARRAYSIZE(accumulative_offsets_from_0x4E00) * 2 + 1] = { 0 };
|
||||
if (!full_ranges[0])
|
||||
@ -2307,9 +2311,9 @@ const ImWchar* ImFontAtlas::GetGlyphRangesJapanese()
|
||||
static ImWchar base_ranges[] = // not zero-terminated
|
||||
{
|
||||
0x0020, 0x00FF, // Basic Latin + Latin Supplement
|
||||
0x3000, 0x30FF, // Punctuations, Hiragana, Katakana
|
||||
0x3000, 0x30FF, // CJK Symbols and Punctuations, Hiragana, Katakana
|
||||
0x31F0, 0x31FF, // Katakana Phonetic Extensions
|
||||
0xFF00, 0xFFEF, // Half-width characters
|
||||
0xFF00, 0xFFEF // Half-width characters
|
||||
};
|
||||
static ImWchar full_ranges[IM_ARRAYSIZE(base_ranges) + IM_ARRAYSIZE(accumulative_offsets_from_0x4E00)*2 + 1] = { 0 };
|
||||
if (!full_ranges[0])
|
||||
|
@ -46,7 +46,9 @@ Index of this file:
|
||||
#pragma clang diagnostic ignored "-Wunused-function" // for stb_textedit.h
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes" // for stb_textedit.h
|
||||
#pragma clang diagnostic ignored "-Wold-style-cast"
|
||||
#if __has_warning("-Wzero-as-null-pointer-constant")
|
||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||
#endif
|
||||
#if __has_warning("-Wdouble-promotion")
|
||||
#pragma clang diagnostic ignored "-Wdouble-promotion"
|
||||
#endif
|
||||
|
@ -56,7 +56,9 @@ Index of this file:
|
||||
#pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants (typically 0.0f) is ok.
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral" // warning : format string is not a string literal // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code.
|
||||
#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness //
|
||||
#if __has_warning("-Wzero-as-null-pointer-constant")
|
||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning : zero as null pointer constant // some standard header variations use #define NULL 0
|
||||
#endif
|
||||
#if __has_warning("-Wdouble-promotion")
|
||||
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user