mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Merge branch 'master' into docking
# Conflicts: # imgui.cpp
This commit is contained in:
commit
8baa4ccff5
@ -125,6 +125,10 @@ Other Changes:
|
|||||||
BeginMenu()/EndMenu() or BeginPopup/EndPopup(). (#3223, #1207) [@rokups]
|
BeginMenu()/EndMenu() or BeginPopup/EndPopup(). (#3223, #1207) [@rokups]
|
||||||
- Drag and Drop: Fixed unintended fallback "..." tooltip display during drag operation when
|
- Drag and Drop: Fixed unintended fallback "..." tooltip display during drag operation when
|
||||||
drag source uses _SourceNoPreviewTooltip flags. (#3160) [@rokups]
|
drag source uses _SourceNoPreviewTooltip flags. (#3160) [@rokups]
|
||||||
|
- ImDrawList: Fixed an issue when draw command merging or cancelling while crossing the VtxOffset
|
||||||
|
boundary would lead to draw command being emitted with wrong VtxOffset value. (#3129, #3163, #3232)
|
||||||
|
[@thedmd, @Shironekoben, @sergeyn, @ocornut]
|
||||||
|
- Misc, Freetype: Fix for rare case where FT_Get_Char_Index() succeed but FT_Load_Glyph() fails.
|
||||||
- CI: Added CI test to verify we're never accidentally dragging libstdc++ (on some compiler setups,
|
- CI: Added CI test to verify we're never accidentally dragging libstdc++ (on some compiler setups,
|
||||||
static constructors for non-pod data seems to drag in libstdc++ due to thread-safety concerns).
|
static constructors for non-pod data seems to drag in libstdc++ due to thread-safety concerns).
|
||||||
Fixed a static contructor which led to this dependency on some compiler setups (unclear which).
|
Fixed a static contructor which led to this dependency on some compiler setups (unclear which).
|
||||||
@ -135,6 +139,7 @@ Other Changes:
|
|||||||
- Backends: OpenGL: Fixed handling of GL 4.5+ glClipControl(GL_UPPER_LEFT) by inverting the
|
- Backends: OpenGL: Fixed handling of GL 4.5+ glClipControl(GL_UPPER_LEFT) by inverting the
|
||||||
projection matrix top and bottom values. (#3143, #3146) [@u3shit]
|
projection matrix top and bottom values. (#3143, #3146) [@u3shit]
|
||||||
- Backends: OpenGL: On OSX, if unspecified by app, made default GLSL version 150. (#3199) [@albertvaka]
|
- Backends: OpenGL: On OSX, if unspecified by app, made default GLSL version 150. (#3199) [@albertvaka]
|
||||||
|
- Backends: OpenGL: Fixed loader auto-detection to not interfere with ES2/ES3 defines. (#3246) [@funchal]
|
||||||
- Backends: Vulkan: Fixed error in if initial frame has no vertices. (#3177)
|
- Backends: Vulkan: Fixed error in if initial frame has no vertices. (#3177)
|
||||||
- Backends: Vulkan: Fixed edge case where render callbacks wouldn't be called if the ImDrawData
|
- Backends: Vulkan: Fixed edge case where render callbacks wouldn't be called if the ImDrawData
|
||||||
structure didn't have any vertices. (#2697) [@kudaba]
|
structure didn't have any vertices. (#2697) [@kudaba]
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
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)
|
||||||
|
|
||||||
<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>
|
||||||
|
|
||||||
Businesses: support continued development via invoiced technical support, maintenance, sponsoring contracts:
|
Businesses: support continued development via invoiced technical support, maintenance, sponsoring contracts:
|
||||||
<br> _E-mail: contact @ dearimgui dot org_
|
<br> _E-mail: contact @ dearimgui dot org_
|
||||||
@ -86,7 +86,7 @@ Dear ImGui allows you to **create elaborate tools** as well as very short-lived
|
|||||||
|
|
||||||
Check out the Wiki's [About the IMGUI paradigm](https://github.com/ocornut/imgui/wiki#About-the-IMGUI-paradigm) section if you want to understand the core principles behind the IMGUI paradigm. An IMGUI tries to minimize superfluous state duplication, state synchronization and state retention from the user's point of view. It is less error prone (less code and less bugs) than traditional retained-mode interfaces, and lends itself to create dynamic user interfaces.
|
Check out the Wiki's [About the IMGUI paradigm](https://github.com/ocornut/imgui/wiki#About-the-IMGUI-paradigm) section if you want to understand the core principles behind the IMGUI paradigm. An IMGUI tries to minimize superfluous state duplication, state synchronization and state retention from the user's point of view. It is less error prone (less code and less bugs) than traditional retained-mode interfaces, and lends itself to create dynamic user interfaces.
|
||||||
|
|
||||||
Dear ImGui outputs vertex buffers and command lists that you can easily render in your application. The number of draw calls and state changes required to render them is fairly small. Because Dear ImGui doesn't know or touch graphics state directly, you can call its functions anywhere in your code (e.g. in the middle of a running algorithm, or in the middle of your own rendering process). Refer to the sample applications in the examples/ folder for instructions on how to integrate dear imgui with your existing codebase.
|
Dear ImGui outputs vertex buffers and command lists that you can easily render in your application. The number of draw calls and state changes required to render them is fairly small. Because Dear ImGui doesn't know or touch graphics state directly, you can call its functions anywhere in your code (e.g. in the middle of a running algorithm, or in the middle of your own rendering process). Refer to the sample applications in the examples/ folder for instructions on how to integrate Dear ImGui with your existing codebase.
|
||||||
|
|
||||||
_A common misunderstanding is to mistake immediate mode gui for immediate mode rendering, which usually implies hammering your driver/GPU with a bunch of inefficient draw calls and state changes as the gui functions are called. This is NOT what Dear ImGui does. Dear ImGui outputs vertex buffers and a small list of draw calls batches. It never touches your GPU directly. The draw call batches are decently optimal and you can render them later, in your app or even remotely._
|
_A common misunderstanding is to mistake immediate mode gui for immediate mode rendering, which usually implies hammering your driver/GPU with a bunch of inefficient draw calls and state changes as the gui functions are called. This is NOT what Dear ImGui does. Dear ImGui outputs vertex buffers and a small list of draw calls batches. It never touches your GPU directly. The draw call batches are decently optimal and you can render them later, in your app or even remotely._
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ How to help
|
|||||||
|
|
||||||
**How can I help financing further development of Dear ImGui?**
|
**How can I help financing further development of Dear ImGui?**
|
||||||
|
|
||||||
Your contributions are keeping this project alive. The library is available under a free and permissive license, but continued maintenance and development are a full-time endeavor and I would like to grow the team. 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 for invoiced technical support and maintenance contracts. Thank you!
|
Your contributions are keeping this project alive. The library is available under a free and permissive license, but continued maintenance and development are a full-time endeavor and I would like to grow the team. 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 for invoiced technical support and maintenance contracts. Thank you!
|
||||||
|
|
||||||
Businesses: support continued development via invoiced technical support, maintenance, sponsoring contracts:
|
Businesses: support continued development via invoiced technical support, maintenance, sponsoring contracts:
|
||||||
<br> _E-mail: contact @ dearimgui dot org_
|
<br> _E-mail: contact @ dearimgui dot org_
|
||||||
|
@ -35,7 +35,8 @@ CXXFLAGS += -I../libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W
|
|||||||
|
|
||||||
## Using OpenGL loader: glew
|
## Using OpenGL loader: glew
|
||||||
## (This assumes a system-wide installation)
|
## (This assumes a system-wide installation)
|
||||||
# CXXFLAGS += -lGLEW -DIMGUI_IMPL_OPENGL_LOADER_GLEW
|
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLEW
|
||||||
|
# LIBS += -lGLEW
|
||||||
|
|
||||||
## Using OpenGL loader: glad
|
## Using OpenGL loader: glad
|
||||||
# SOURCES += ../libs/glad/src/glad.c
|
# SOURCES += ../libs/glad/src/glad.c
|
||||||
@ -44,9 +45,11 @@ CXXFLAGS += -I../libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W
|
|||||||
## Using OpenGL loader: glbinding
|
## Using OpenGL loader: glbinding
|
||||||
## This assumes a system-wide installation
|
## This assumes a system-wide installation
|
||||||
## of either version 3.0.0 (or newer)
|
## of either version 3.0.0 (or newer)
|
||||||
# CXXFLAGS += -lglbinding -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING3
|
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING3
|
||||||
|
# LIBS += -lglbinding
|
||||||
## or the older version 2.x
|
## or the older version 2.x
|
||||||
# CXXFLAGS += -lglbinding -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING2
|
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING2
|
||||||
|
# LIBS += -lglbinding
|
||||||
|
|
||||||
##---------------------------------------------------------------------
|
##---------------------------------------------------------------------
|
||||||
## BUILD FLAGS PER PLATFORM
|
## BUILD FLAGS PER PLATFORM
|
||||||
|
@ -40,7 +40,10 @@ endif
|
|||||||
ifeq ($(UNAME_S), Linux) #LINUX
|
ifeq ($(UNAME_S), Linux) #LINUX
|
||||||
ECHO_MESSAGE = "Linux"
|
ECHO_MESSAGE = "Linux"
|
||||||
ifneq ($(WITH_EXTRA_WARNINGS), 0)
|
ifneq ($(WITH_EXTRA_WARNINGS), 0)
|
||||||
CXXFLAGS += -Wextra -pedantic
|
CXXFLAGS += -Wextra -Wpedantic
|
||||||
|
ifeq ($(shell $(CXX) -v 2>&1 | grep -c "clang version"), 1)
|
||||||
|
CXXFLAGS += -Wshadow -Wsign-conversion
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
CFLAGS = $(CXXFLAGS)
|
CFLAGS = $(CXXFLAGS)
|
||||||
endif
|
endif
|
||||||
@ -56,7 +59,7 @@ endif
|
|||||||
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
|
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
|
||||||
ECHO_MESSAGE = "MinGW"
|
ECHO_MESSAGE = "MinGW"
|
||||||
ifneq ($(WITH_EXTRA_WARNINGS), 0)
|
ifneq ($(WITH_EXTRA_WARNINGS), 0)
|
||||||
CXXFLAGS += -Wextra -pedantic
|
CXXFLAGS += -Wextra -Wpedantic
|
||||||
endif
|
endif
|
||||||
CFLAGS = $(CXXFLAGS)
|
CFLAGS = $(CXXFLAGS)
|
||||||
endif
|
endif
|
||||||
|
@ -35,7 +35,8 @@ CXXFLAGS += -I../libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W
|
|||||||
|
|
||||||
## Using OpenGL loader: glew
|
## Using OpenGL loader: glew
|
||||||
## (This assumes a system-wide installation)
|
## (This assumes a system-wide installation)
|
||||||
# CXXFLAGS += -lGLEW -DIMGUI_IMPL_OPENGL_LOADER_GLEW
|
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLEW
|
||||||
|
# LIBS += -lGLEW
|
||||||
|
|
||||||
## Using OpenGL loader: glad
|
## Using OpenGL loader: glad
|
||||||
# SOURCES += ../libs/glad/src/glad.c
|
# SOURCES += ../libs/glad/src/glad.c
|
||||||
@ -44,9 +45,11 @@ CXXFLAGS += -I../libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W
|
|||||||
## Using OpenGL loader: glbinding
|
## Using OpenGL loader: glbinding
|
||||||
## This assumes a system-wide installation
|
## This assumes a system-wide installation
|
||||||
## of either version 3.0.0 (or newer)
|
## of either version 3.0.0 (or newer)
|
||||||
# CXXFLAGS += -lglbinding -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING3
|
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING3
|
||||||
|
# LIBS += -lglbinding
|
||||||
## or the older version 2.x
|
## or the older version 2.x
|
||||||
# CXXFLAGS += -lglbinding -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING2
|
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING2
|
||||||
|
# LIBS += -lglbinding
|
||||||
|
|
||||||
##---------------------------------------------------------------------
|
##---------------------------------------------------------------------
|
||||||
## BUILD FLAGS PER PLATFORM
|
## BUILD FLAGS PER PLATFORM
|
||||||
|
@ -81,27 +81,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <stdint.h> // intptr_t
|
#include <stdint.h> // intptr_t
|
||||||
#endif
|
#endif
|
||||||
#if defined(__APPLE__)
|
|
||||||
#include "TargetConditionals.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Auto-enable GLES on matching platforms
|
|
||||||
#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3)
|
|
||||||
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__))
|
|
||||||
#define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es"
|
|
||||||
#elif defined(__EMSCRIPTEN__)
|
|
||||||
#define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(IMGUI_IMPL_OPENGL_ES2) || defined(IMGUI_IMPL_OPENGL_ES3)
|
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_GL3W
|
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_GLEW
|
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_GLAD
|
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_GLBINDING2
|
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_GLBINDING3
|
|
||||||
#undef IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// GL includes
|
// GL includes
|
||||||
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||||
@ -154,8 +134,8 @@ static GLuint g_GlVersion = 0; // Extracted at runtime usin
|
|||||||
static char g_GlslVersionString[32] = ""; // Specified by user or detected based on compile time GL settings.
|
static char g_GlslVersionString[32] = ""; // Specified by user or detected based on compile time GL settings.
|
||||||
static GLuint g_FontTexture = 0;
|
static GLuint g_FontTexture = 0;
|
||||||
static GLuint g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0;
|
static GLuint g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0;
|
||||||
static int g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0; // Uniforms location
|
static GLint g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0; // Uniforms location
|
||||||
static int g_AttribLocationVtxPos = 0, g_AttribLocationVtxUV = 0, g_AttribLocationVtxColor = 0; // Vertex attributes location
|
static GLuint g_AttribLocationVtxPos = 0, g_AttribLocationVtxUV = 0, g_AttribLocationVtxColor = 0; // Vertex attributes location
|
||||||
static unsigned int g_VboHandle = 0, g_ElementsHandle = 0;
|
static unsigned int g_VboHandle = 0, g_ElementsHandle = 0;
|
||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
@ -170,7 +150,7 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
|||||||
GLint major, minor;
|
GLint major, minor;
|
||||||
glGetIntegerv(GL_MAJOR_VERSION, &major);
|
glGetIntegerv(GL_MAJOR_VERSION, &major);
|
||||||
glGetIntegerv(GL_MINOR_VERSION, &minor);
|
glGetIntegerv(GL_MINOR_VERSION, &minor);
|
||||||
g_GlVersion = major * 100 + minor * 10;
|
g_GlVersion = (GLuint)(major * 100 + minor * 10);
|
||||||
#else
|
#else
|
||||||
g_GlVersion = 200; // GLES 2
|
g_GlVersion = 200; // GLES 2
|
||||||
#endif
|
#endif
|
||||||
@ -323,14 +303,14 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
// Backup GL state
|
// Backup GL state
|
||||||
GLenum last_active_texture; glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture);
|
GLenum last_active_texture; glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
GLint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
|
GLuint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&last_program);
|
||||||
GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
GLuint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&last_texture);
|
||||||
#ifdef GL_SAMPLER_BINDING
|
#ifdef GL_SAMPLER_BINDING
|
||||||
GLint last_sampler; glGetIntegerv(GL_SAMPLER_BINDING, &last_sampler);
|
GLuint last_sampler; glGetIntegerv(GL_SAMPLER_BINDING, (GLint*)&last_sampler);
|
||||||
#endif
|
#endif
|
||||||
GLint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
|
GLuint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint*)&last_array_buffer);
|
||||||
#ifndef IMGUI_IMPL_OPENGL_ES2
|
#ifndef IMGUI_IMPL_OPENGL_ES2
|
||||||
GLint last_vertex_array_object; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array_object);
|
GLuint last_vertex_array_object; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, (GLint*)&last_vertex_array_object);
|
||||||
#endif
|
#endif
|
||||||
#ifdef GL_POLYGON_MODE
|
#ifdef GL_POLYGON_MODE
|
||||||
GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
|
GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
|
||||||
@ -367,8 +347,8 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
|
|
||||||
// Upload vertex/index buffers
|
// Upload vertex/index buffers
|
||||||
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);
|
||||||
|
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
@ -674,9 +654,9 @@ bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
|||||||
|
|
||||||
g_AttribLocationTex = glGetUniformLocation(g_ShaderHandle, "Texture");
|
g_AttribLocationTex = glGetUniformLocation(g_ShaderHandle, "Texture");
|
||||||
g_AttribLocationProjMtx = glGetUniformLocation(g_ShaderHandle, "ProjMtx");
|
g_AttribLocationProjMtx = glGetUniformLocation(g_ShaderHandle, "ProjMtx");
|
||||||
g_AttribLocationVtxPos = glGetAttribLocation(g_ShaderHandle, "Position");
|
g_AttribLocationVtxPos = (GLuint)glGetAttribLocation(g_ShaderHandle, "Position");
|
||||||
g_AttribLocationVtxUV = glGetAttribLocation(g_ShaderHandle, "UV");
|
g_AttribLocationVtxUV = (GLuint)glGetAttribLocation(g_ShaderHandle, "UV");
|
||||||
g_AttribLocationVtxColor = glGetAttribLocation(g_ShaderHandle, "Color");
|
g_AttribLocationVtxColor = (GLuint)glGetAttribLocation(g_ShaderHandle, "Color");
|
||||||
|
|
||||||
// Create buffers
|
// Create buffers
|
||||||
glGenBuffers(1, &g_VboHandle);
|
glGenBuffers(1, &g_VboHandle);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
// https://github.com/ocornut/imgui
|
// https://github.com/ocornut/imgui
|
||||||
|
|
||||||
// About Desktop OpenGL function loaders:
|
// About Desktop OpenGL function loaders:
|
||||||
// Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers.
|
// Modern Desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers.
|
||||||
// Helper libraries are often used for this purpose! Here we are supporting a few common ones (gl3w, glew, glad).
|
// Helper libraries are often used for this purpose! Here we are supporting a few common ones (gl3w, glew, glad).
|
||||||
// You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own.
|
// You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own.
|
||||||
|
|
||||||
@ -37,36 +37,49 @@ IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture();
|
|||||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects();
|
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects();
|
||||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
||||||
|
|
||||||
// Specific OpenGL versions
|
// Specific OpenGL ES versions
|
||||||
//#define IMGUI_IMPL_OPENGL_ES2 // Auto-detected on Emscripten
|
//#define IMGUI_IMPL_OPENGL_ES2 // Auto-detected on Emscripten
|
||||||
//#define IMGUI_IMPL_OPENGL_ES3 // Auto-detected on iOS/Android
|
//#define IMGUI_IMPL_OPENGL_ES3 // Auto-detected on iOS/Android
|
||||||
|
|
||||||
// Desktop OpenGL: attempt to detect default GL loader based on available header files.
|
// Attempt to auto-detect the default Desktop GL loader based on available header files.
|
||||||
// If auto-detection fails or doesn't select the same GL loader file as used by your application,
|
// If auto-detection fails or doesn't select the same GL loader file as used by your application,
|
||||||
// you are likely to get a crash in ImGui_ImplOpenGL3_Init().
|
// you are likely to get a crash in ImGui_ImplOpenGL3_Init().
|
||||||
// You can explicitly select a loader by using '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line.
|
// You can explicitly select a loader by using one of the '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line.
|
||||||
#if !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \
|
#if !defined(IMGUI_IMPL_OPENGL_ES2) \
|
||||||
|
&& !defined(IMGUI_IMPL_OPENGL_ES3) \
|
||||||
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \
|
||||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \
|
||||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \
|
||||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2) \
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2) \
|
||||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3) \
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3) \
|
||||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
|
&& !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
|
||||||
#if defined(__has_include)
|
|
||||||
#if __has_include(<GL/glew.h>)
|
// Try to detect GLES on matching platforms
|
||||||
#define IMGUI_IMPL_OPENGL_LOADER_GLEW
|
#if defined(__APPLE__)
|
||||||
#elif __has_include(<glad/glad.h>)
|
#include "TargetConditionals.h"
|
||||||
#define IMGUI_IMPL_OPENGL_LOADER_GLAD
|
#endif
|
||||||
#elif __has_include(<GL/gl3w.h>)
|
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__))
|
||||||
#define IMGUI_IMPL_OPENGL_LOADER_GL3W
|
#define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es"
|
||||||
#elif __has_include(<glbinding/glbinding.h>)
|
#elif defined(__EMSCRIPTEN__)
|
||||||
#define IMGUI_IMPL_OPENGL_LOADER_GLBINDING3
|
#define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100"
|
||||||
#elif __has_include(<glbinding/Binding.h>)
|
|
||||||
#define IMGUI_IMPL_OPENGL_LOADER_GLBINDING2
|
// Otherwise try to detect supported Desktop OpenGL loaders..
|
||||||
#else
|
#elif defined(__has_include)
|
||||||
#error "Cannot detect OpenGL loader!"
|
#if __has_include(<GL/glew.h>)
|
||||||
#endif
|
#define IMGUI_IMPL_OPENGL_LOADER_GLEW
|
||||||
#else
|
#elif __has_include(<glad/glad.h>)
|
||||||
#define IMGUI_IMPL_OPENGL_LOADER_GL3W // Default to GL3W
|
#define IMGUI_IMPL_OPENGL_LOADER_GLAD
|
||||||
#endif
|
#elif __has_include(<GL/gl3w.h>)
|
||||||
|
#define IMGUI_IMPL_OPENGL_LOADER_GL3W
|
||||||
|
#elif __has_include(<glbinding/glbinding.h>)
|
||||||
|
#define IMGUI_IMPL_OPENGL_LOADER_GLBINDING3
|
||||||
|
#elif __has_include(<glbinding/Binding.h>)
|
||||||
|
#define IMGUI_IMPL_OPENGL_LOADER_GLBINDING2
|
||||||
|
#else
|
||||||
|
#error "Cannot detect OpenGL loader!"
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define IMGUI_IMPL_OPENGL_LOADER_GL3W // Default to GL3W embedded in our repository
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -506,7 +506,8 @@ void ImGui_ImplWin32_EnableDpiAwareness()
|
|||||||
float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor)
|
float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor)
|
||||||
{
|
{
|
||||||
UINT xdpi = 96, ydpi = 96;
|
UINT xdpi = 96, ydpi = 96;
|
||||||
if (IsWindows8Point1OrGreater())
|
static BOOL bIsWindows8Point1OrGreater = IsWindows8Point1OrGreater();
|
||||||
|
if (bIsWindows8Point1OrGreater)
|
||||||
{
|
{
|
||||||
static HINSTANCE shcore_dll = ::LoadLibraryA("shcore.dll"); // Reference counted per-process
|
static HINSTANCE shcore_dll = ::LoadLibraryA("shcore.dll"); // Reference counted per-process
|
||||||
if (PFN_GetDpiForMonitor GetDpiForMonitorFn = (PFN_GetDpiForMonitor)::GetProcAddress(shcore_dll, "GetDpiForMonitor"))
|
if (PFN_GetDpiForMonitor GetDpiForMonitorFn = (PFN_GetDpiForMonitor)::GetProcAddress(shcore_dll, "GetDpiForMonitor"))
|
||||||
|
26
imgui.cpp
26
imgui.cpp
@ -516,7 +516,7 @@ CODE
|
|||||||
- 2017/08/09 (1.51) - removed ValueColor() helpers, they are equivalent to calling Text(label) + SameLine() + ColorButton().
|
- 2017/08/09 (1.51) - removed ValueColor() helpers, they are equivalent to calling Text(label) + SameLine() + ColorButton().
|
||||||
- 2017/08/08 (1.51) - removed ColorEditMode() and ImGuiColorEditMode in favor of ImGuiColorEditFlags and parameters to the various Color*() functions. The SetColorEditOptions() allows to initialize default but the user can still change them with right-click context menu.
|
- 2017/08/08 (1.51) - removed ColorEditMode() and ImGuiColorEditMode in favor of ImGuiColorEditFlags and parameters to the various Color*() functions. The SetColorEditOptions() allows to initialize default but the user can still change them with right-click context menu.
|
||||||
- changed prototype of 'ColorEdit4(const char* label, float col[4], bool show_alpha = true)' to 'ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0)', where passing flags = 0x01 is a safe no-op (hello dodgy backward compatibility!). - check and run the demo window, under "Color/Picker Widgets", to understand the various new options.
|
- changed prototype of 'ColorEdit4(const char* label, float col[4], bool show_alpha = true)' to 'ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0)', where passing flags = 0x01 is a safe no-op (hello dodgy backward compatibility!). - check and run the demo window, under "Color/Picker Widgets", to understand the various new options.
|
||||||
- changed prototype of rarely used 'ColorButton(ImVec4 col, bool small_height = false, bool outline_border = true)' to 'ColorButton(const char* desc_id, ImVec4 col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0,0))'
|
- changed prototype of rarely used 'ColorButton(ImVec4 col, bool small_height = false, bool outline_border = true)' to 'ColorButton(const char* desc_id, ImVec4 col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0, 0))'
|
||||||
- 2017/07/20 (1.51) - removed IsPosHoveringAnyWindow(ImVec2), which was partly broken and misleading. ASSERT + redirect user to io.WantCaptureMouse
|
- 2017/07/20 (1.51) - removed IsPosHoveringAnyWindow(ImVec2), which was partly broken and misleading. ASSERT + redirect user to io.WantCaptureMouse
|
||||||
- 2017/05/26 (1.50) - removed ImFontConfig::MergeGlyphCenterV in favor of a more multipurpose ImFontConfig::GlyphOffset.
|
- 2017/05/26 (1.50) - removed ImFontConfig::MergeGlyphCenterV in favor of a more multipurpose ImFontConfig::GlyphOffset.
|
||||||
- 2017/05/01 (1.50) - renamed ImDrawList::PathFill() (rarely used directly) to ImDrawList::PathFillConvex() for clarity.
|
- 2017/05/01 (1.50) - renamed ImDrawList::PathFill() (rarely used directly) to ImDrawList::PathFillConvex() for clarity.
|
||||||
@ -3432,7 +3432,7 @@ static ImDrawList* GetViewportDrawList(ImGuiViewportP* viewport, size_t drawlist
|
|||||||
// Our ImDrawList system requires that there is always a command
|
// Our ImDrawList system requires that there is always a command
|
||||||
if (viewport->LastFrameDrawLists[drawlist_no] != g.FrameCount)
|
if (viewport->LastFrameDrawLists[drawlist_no] != g.FrameCount)
|
||||||
{
|
{
|
||||||
draw_list->Clear();
|
draw_list->ResetForNewFrame();
|
||||||
draw_list->PushTextureID(g.IO.Fonts->TexID);
|
draw_list->PushTextureID(g.IO.Fonts->TexID);
|
||||||
draw_list->PushClipRect(viewport->Pos, viewport->Pos + viewport->Size, false);
|
draw_list->PushClipRect(viewport->Pos, viewport->Pos + viewport->Size, false);
|
||||||
viewport->LastFrameDrawLists[drawlist_no] = g.FrameCount;
|
viewport->LastFrameDrawLists[drawlist_no] = g.FrameCount;
|
||||||
@ -3690,7 +3690,7 @@ static void ImGui::UpdateMouseInputs()
|
|||||||
ImVec2 delta_from_click_pos = IsMousePosValid(&g.IO.MousePos) ? (g.IO.MousePos - g.IO.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f);
|
ImVec2 delta_from_click_pos = IsMousePosValid(&g.IO.MousePos) ? (g.IO.MousePos - g.IO.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f);
|
||||||
if (ImLengthSqr(delta_from_click_pos) < g.IO.MouseDoubleClickMaxDist * g.IO.MouseDoubleClickMaxDist)
|
if (ImLengthSqr(delta_from_click_pos) < g.IO.MouseDoubleClickMaxDist * g.IO.MouseDoubleClickMaxDist)
|
||||||
g.IO.MouseDoubleClicked[i] = true;
|
g.IO.MouseDoubleClicked[i] = true;
|
||||||
g.IO.MouseClickedTime[i] = -DBL_MAX; // so the third click isn't turned into a double-click
|
g.IO.MouseClickedTime[i] = -g.IO.MouseDoubleClickTime * 2.0f; // Mark as "old enough" so the third click isn't turned into a double-click
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4287,15 +4287,15 @@ static void AddWindowToSortBuffer(ImVector<ImGuiWindow*>* out_sorted_windows, Im
|
|||||||
|
|
||||||
static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list)
|
static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list)
|
||||||
{
|
{
|
||||||
if (draw_list->CmdBuffer.empty())
|
if (draw_list->CmdBuffer.Size == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Remove trailing command if unused
|
// Remove trailing command if unused
|
||||||
ImDrawCmd& last_cmd = draw_list->CmdBuffer.back();
|
ImDrawCmd* curr_cmd = &draw_list->CmdBuffer.back();
|
||||||
if (last_cmd.ElemCount == 0 && last_cmd.UserCallback == NULL)
|
if (curr_cmd->ElemCount == 0 && curr_cmd->UserCallback == NULL)
|
||||||
{
|
{
|
||||||
draw_list->CmdBuffer.pop_back();
|
draw_list->CmdBuffer.pop_back();
|
||||||
if (draw_list->CmdBuffer.empty())
|
if (draw_list->CmdBuffer.Size == 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5442,10 +5442,10 @@ static ImRect GetResizeBorderRect(ImGuiWindow* window, int border_n, float perp_
|
|||||||
{
|
{
|
||||||
ImRect rect = window->Rect();
|
ImRect rect = window->Rect();
|
||||||
if (thickness == 0.0f) rect.Max -= ImVec2(1,1);
|
if (thickness == 0.0f) rect.Max -= ImVec2(1,1);
|
||||||
if (border_n == 0) return ImRect(rect.Min.x + perp_padding, rect.Min.y - thickness, rect.Max.x - perp_padding, rect.Min.y + thickness); // Top
|
if (border_n == 0) { return ImRect(rect.Min.x + perp_padding, rect.Min.y - thickness, rect.Max.x - perp_padding, rect.Min.y + thickness); } // Top
|
||||||
if (border_n == 1) return ImRect(rect.Max.x - thickness, rect.Min.y + perp_padding, rect.Max.x + thickness, rect.Max.y - perp_padding); // Right
|
if (border_n == 1) { return ImRect(rect.Max.x - thickness, rect.Min.y + perp_padding, rect.Max.x + thickness, rect.Max.y - perp_padding); } // Right
|
||||||
if (border_n == 2) return ImRect(rect.Min.x + perp_padding, rect.Max.y - thickness, rect.Max.x - perp_padding, rect.Max.y + thickness); // Bottom
|
if (border_n == 2) { return ImRect(rect.Min.x + perp_padding, rect.Max.y - thickness, rect.Max.x - perp_padding, rect.Max.y + thickness); } // Bottom
|
||||||
if (border_n == 3) return ImRect(rect.Min.x - thickness, rect.Min.y + perp_padding, rect.Min.x + thickness, rect.Max.y - perp_padding); // Left
|
if (border_n == 3) { return ImRect(rect.Min.x - thickness, rect.Min.y + perp_padding, rect.Min.x + thickness, rect.Max.y - perp_padding); } // Left
|
||||||
IM_ASSERT(0);
|
IM_ASSERT(0);
|
||||||
return ImRect();
|
return ImRect();
|
||||||
}
|
}
|
||||||
@ -6435,7 +6435,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
// DRAWING
|
// DRAWING
|
||||||
|
|
||||||
// Setup draw list and outer clipping rectangle
|
// Setup draw list and outer clipping rectangle
|
||||||
window->DrawList->Clear();
|
window->DrawList->ResetForNewFrame();
|
||||||
window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);
|
window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);
|
||||||
PushClipRect(host_rect.Min, host_rect.Max, false);
|
PushClipRect(host_rect.Min, host_rect.Max, false);
|
||||||
|
|
||||||
@ -15420,7 +15420,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
|
|
||||||
ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;
|
ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;
|
||||||
char buf[300];
|
char buf[300];
|
||||||
ImFormatString(buf, IM_ARRAYSIZE(buf), "DrawCmd: %4d triangles, Tex 0x%p, ClipRect (%4.0f,%4.0f)-(%4.0f,%4.0f)",
|
ImFormatString(buf, IM_ARRAYSIZE(buf), "DrawCmd:%5d triangles, Tex 0x%p, ClipRect (%4.0f,%4.0f)-(%4.0f,%4.0f)",
|
||||||
pcmd->ElemCount/3, (void*)(intptr_t)pcmd->TextureId,
|
pcmd->ElemCount/3, (void*)(intptr_t)pcmd->TextureId,
|
||||||
pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
|
pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
|
||||||
bool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "%s", buf);
|
bool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "%s", buf);
|
||||||
|
60
imgui.h
60
imgui.h
@ -277,9 +277,10 @@ namespace ImGui
|
|||||||
|
|
||||||
// Windows
|
// Windows
|
||||||
// - Begin() = push window to the stack and start appending to it. End() = pop window from the stack.
|
// - Begin() = push window to the stack and start appending to it. End() = pop window from the stack.
|
||||||
// - You may append multiple times to the same window during the same frame.
|
|
||||||
// - Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window,
|
// - Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window,
|
||||||
// which clicking will set the boolean to false when clicked.
|
// which clicking will set the boolean to false when clicked.
|
||||||
|
// - You may append multiple times to the same window during the same frame by calling Begin()/End() pairs multiple times.
|
||||||
|
// Some information such as 'flags' or 'p_open' will only be considered by the first call to Begin().
|
||||||
// - Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting
|
// - Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting
|
||||||
// anything to the window. Always call a matching End() for each Begin() call, regardless of its return value!
|
// anything to the window. Always call a matching End() for each Begin() call, regardless of its return value!
|
||||||
// [Important: due to legacy reason, this is inconsistent with most other functions such as BeginMenu/EndMenu,
|
// [Important: due to legacy reason, this is inconsistent with most other functions such as BeginMenu/EndMenu,
|
||||||
@ -294,8 +295,8 @@ namespace ImGui
|
|||||||
// - For each independent axis of 'size': ==0.0f: use remaining host window size / >0.0f: fixed size / <0.0f: use remaining window size minus abs(size) / Each axis can use a different mode, e.g. ImVec2(0,400).
|
// - For each independent axis of 'size': ==0.0f: use remaining host window size / >0.0f: fixed size / <0.0f: use remaining window size minus abs(size) / Each axis can use a different mode, e.g. ImVec2(0,400).
|
||||||
// - BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window.
|
// - BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window.
|
||||||
// Always call a matching EndChild() for each BeginChild() call, regardless of its return value [as with Begin: this is due to legacy reason and inconsistent with most BeginXXX functions apart from the regular Begin() which behaves like BeginChild().]
|
// Always call a matching EndChild() for each BeginChild() call, regardless of its return value [as with Begin: this is due to legacy reason and inconsistent with most BeginXXX functions apart from the regular Begin() which behaves like BeginChild().]
|
||||||
IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0);
|
IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags flags = 0);
|
||||||
IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0);
|
IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags flags = 0);
|
||||||
IMGUI_API void EndChild();
|
IMGUI_API void EndChild();
|
||||||
|
|
||||||
// Windows Utilities
|
// Windows Utilities
|
||||||
@ -313,7 +314,7 @@ namespace ImGui
|
|||||||
IMGUI_API float GetWindowHeight(); // get current window height (shortcut for GetWindowSize().y)
|
IMGUI_API float GetWindowHeight(); // get current window height (shortcut for GetWindowSize().y)
|
||||||
|
|
||||||
// Prefer using SetNextXXX functions (before Begin) rather that SetXXX functions (after Begin).
|
// Prefer using SetNextXXX functions (before Begin) rather that SetXXX functions (after Begin).
|
||||||
IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiCond cond = 0, const ImVec2& pivot = ImVec2(0,0)); // set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc.
|
IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiCond cond = 0, const ImVec2& pivot = ImVec2(0, 0)); // set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc.
|
||||||
IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiCond cond = 0); // set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()
|
IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiCond cond = 0); // set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()
|
||||||
IMGUI_API void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback = NULL, void* custom_callback_data = NULL); // set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints.
|
IMGUI_API void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback = NULL, void* custom_callback_data = NULL); // set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints.
|
||||||
IMGUI_API void SetNextWindowContentSize(const ImVec2& size); // set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. set an axis to 0.0f to leave it automatic. call before Begin()
|
IMGUI_API void SetNextWindowContentSize(const ImVec2& size); // set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. set an axis to 0.0f to leave it automatic. call before Begin()
|
||||||
@ -322,7 +323,7 @@ namespace ImGui
|
|||||||
IMGUI_API void SetNextWindowBgAlpha(float alpha); // set next window background color alpha. helper to easily override the Alpha component of ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground.
|
IMGUI_API void SetNextWindowBgAlpha(float alpha); // set next window background color alpha. helper to easily override the Alpha component of ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground.
|
||||||
IMGUI_API void SetNextWindowViewport(ImGuiID viewport_id); // set next window viewport
|
IMGUI_API void SetNextWindowViewport(ImGuiID viewport_id); // set next window viewport
|
||||||
IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.
|
IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.
|
||||||
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0,0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.
|
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0, 0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.
|
||||||
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().
|
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().
|
||||||
IMGUI_API void SetWindowFocus(); // (not recommended) set current window to be focused / top-most. prefer using SetNextWindowFocus().
|
IMGUI_API void SetWindowFocus(); // (not recommended) set current window to be focused / top-most. prefer using SetNextWindowFocus().
|
||||||
IMGUI_API void SetWindowFontScale(float scale); // set font scale. Adjust IO.FontGlobalScale if you want to scale all windows. This is an old API! For correct scaling, prefer to reload font + rebuild ImFontAtlas + call style.ScaleAllSizes().
|
IMGUI_API void SetWindowFontScale(float scale); // set font scale. Adjust IO.FontGlobalScale if you want to scale all windows. This is an old API! For correct scaling, prefer to reload font + rebuild ImFontAtlas + call style.ScaleAllSizes().
|
||||||
@ -445,17 +446,17 @@ namespace ImGui
|
|||||||
// Widgets: Main
|
// Widgets: Main
|
||||||
// - Most widgets return true when the value has been changed or when pressed/selected
|
// - Most widgets return true when the value has been changed or when pressed/selected
|
||||||
// - You may also use one of the many IsItemXXX functions (e.g. IsItemActive, IsItemHovered, etc.) to query widget state.
|
// - You may also use one of the many IsItemXXX functions (e.g. IsItemActive, IsItemHovered, etc.) to query widget state.
|
||||||
IMGUI_API bool Button(const char* label, const ImVec2& size = ImVec2(0,0)); // button
|
IMGUI_API bool Button(const char* label, const ImVec2& size = ImVec2(0, 0)); // button
|
||||||
IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text
|
IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text
|
||||||
IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size); // button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)
|
IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size); // button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)
|
||||||
IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // square button with an arrow shape
|
IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // square button with an arrow shape
|
||||||
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));
|
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));
|
||||||
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,0), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding
|
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,0), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding
|
||||||
IMGUI_API bool Checkbox(const char* label, bool* v);
|
IMGUI_API bool Checkbox(const char* label, bool* v);
|
||||||
IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
||||||
IMGUI_API bool RadioButton(const char* label, bool active); // use with e.g. if (RadioButton("one", my_value==1)) { my_value = 1; }
|
IMGUI_API bool RadioButton(const char* label, bool active); // use with e.g. if (RadioButton("one", my_value==1)) { my_value = 1; }
|
||||||
IMGUI_API bool RadioButton(const char* label, int* v, int v_button); // shortcut to handle the above pattern when value is an integer
|
IMGUI_API bool RadioButton(const char* label, int* v, int v_button); // shortcut to handle the above pattern when value is an integer
|
||||||
IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-1,0), const char* overlay = NULL);
|
IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-1, 0), const char* overlay = NULL);
|
||||||
IMGUI_API void Bullet(); // draw a small circle and keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses
|
IMGUI_API void Bullet(); // draw a small circle and keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses
|
||||||
|
|
||||||
// Widgets: Combo Box
|
// Widgets: Combo Box
|
||||||
@ -510,7 +511,7 @@ namespace ImGui
|
|||||||
// - 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.
|
||||||
// - Most of the ImGuiInputTextFlags flags are only useful for InputText() and not for InputFloatX, InputIntX, InputDouble etc.
|
// - Most of the ImGuiInputTextFlags flags are only useful for InputText() and not for InputFloatX, InputIntX, InputDouble etc.
|
||||||
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
IMGUI_API bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0,0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
IMGUI_API bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
IMGUI_API bool InputTextWithHint(const char* label, const char* hint, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
IMGUI_API bool InputTextWithHint(const char* label, const char* hint, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
|
||||||
IMGUI_API bool InputFloat2(const char* label, float v[2], const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputFloat2(const char* label, float v[2], const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
|
||||||
@ -531,7 +532,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0);
|
IMGUI_API bool ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0);
|
||||||
IMGUI_API bool ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags = 0);
|
IMGUI_API bool ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags = 0);
|
||||||
IMGUI_API bool ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags = 0, const float* ref_col = NULL);
|
IMGUI_API bool ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags = 0, const float* ref_col = NULL);
|
||||||
IMGUI_API bool ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0,0)); // display a colored square/button, hover for details, return true when pressed.
|
IMGUI_API bool ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0, 0)); // display a colored square/button, hover for details, return true when pressed.
|
||||||
IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags); // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls.
|
IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags); // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls.
|
||||||
|
|
||||||
// Widgets: Trees
|
// Widgets: Trees
|
||||||
@ -557,14 +558,14 @@ namespace ImGui
|
|||||||
// Widgets: Selectables
|
// Widgets: Selectables
|
||||||
// - A selectable highlights when hovered, and can display another color when selected.
|
// - A selectable highlights when hovered, and can display another color when selected.
|
||||||
// - Neighbors selectable extend their highlight bounds in order to leave no gap between them. This is so a series of selected Selectable appear contiguous.
|
// - Neighbors selectable extend their highlight bounds in order to leave no gap between them. This is so a series of selected Selectable appear contiguous.
|
||||||
IMGUI_API bool Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0,0)); // "bool selected" carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height
|
IMGUI_API bool Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0)); // "bool selected" carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height
|
||||||
IMGUI_API bool Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0,0)); // "bool* p_selected" point to the selection state (read-write), as a convenient helper.
|
IMGUI_API bool Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0)); // "bool* p_selected" point to the selection state (read-write), as a convenient helper.
|
||||||
|
|
||||||
// Widgets: List Boxes
|
// Widgets: List Boxes
|
||||||
// - FIXME: To be consistent with all the newer API, ListBoxHeader/ListBoxFooter should in reality be called BeginListBox/EndListBox. Will rename them.
|
// - FIXME: To be consistent with all the newer API, ListBoxHeader/ListBoxFooter should in reality be called BeginListBox/EndListBox. Will rename them.
|
||||||
IMGUI_API bool ListBox(const char* label, int* current_item, const char* const items[], int items_count, int height_in_items = -1);
|
IMGUI_API bool ListBox(const char* label, int* current_item, const char* const items[], int items_count, int height_in_items = -1);
|
||||||
IMGUI_API bool ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
|
IMGUI_API bool ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
|
||||||
IMGUI_API bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0,0)); // use if you want to reimplement ListBox() will custom data or interactions. if the function return true, you can output elements then call ListBoxFooter() afterwards.
|
IMGUI_API bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)); // use if you want to reimplement ListBox() will custom data or interactions. if the function return true, you can output elements then call ListBoxFooter() afterwards.
|
||||||
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // "
|
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // "
|
||||||
IMGUI_API void ListBoxFooter(); // terminate the scrolling region. only call ListBoxFooter() if ListBoxHeader() returned true!
|
IMGUI_API void ListBoxFooter(); // terminate the scrolling region. only call ListBoxFooter() if ListBoxHeader() returned true!
|
||||||
|
|
||||||
@ -1569,7 +1570,7 @@ struct ImGuiIO
|
|||||||
// Input - Fill before calling NewFrame()
|
// Input - Fill before calling NewFrame()
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX,-FLT_MAX) if mouse is unavailable (on another screen, etc.)
|
ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.)
|
||||||
bool MouseDown[5]; // Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
|
bool MouseDown[5]; // Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
|
||||||
float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text.
|
float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text.
|
||||||
float MouseWheelH; // Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all back-ends.
|
float MouseWheelH; // Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all back-ends.
|
||||||
@ -1981,13 +1982,13 @@ typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* c
|
|||||||
// is enabled, those fields allow us to render meshes larger than 64K vertices while keeping 16-bit indices.
|
// is enabled, those fields allow us to render meshes larger than 64K vertices while keeping 16-bit indices.
|
||||||
struct ImDrawCmd
|
struct ImDrawCmd
|
||||||
{
|
{
|
||||||
unsigned int ElemCount; // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[].
|
unsigned int ElemCount; // 4 // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[].
|
||||||
ImVec4 ClipRect; // Clipping rectangle (x1, y1, x2, y2). Subtract ImDrawData->DisplayPos to get clipping rectangle in "viewport" coordinates
|
ImVec4 ClipRect; // 4*4 // Clipping rectangle (x1, y1, x2, y2). Subtract ImDrawData->DisplayPos to get clipping rectangle in "viewport" coordinates
|
||||||
ImTextureID TextureId; // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas.
|
ImTextureID TextureId; // 4-8 // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas.
|
||||||
unsigned int VtxOffset; // Start offset in vertex buffer. Pre-1.71 or without ImGuiBackendFlags_RendererHasVtxOffset: always 0. With ImGuiBackendFlags_RendererHasVtxOffset: may be >0 to support meshes larger than 64K vertices with 16-bit indices.
|
unsigned int VtxOffset; // 4 // Start offset in vertex buffer. Pre-1.71 or without ImGuiBackendFlags_RendererHasVtxOffset: always 0. With ImGuiBackendFlags_RendererHasVtxOffset: may be >0 to support meshes larger than 64K vertices with 16-bit indices.
|
||||||
unsigned int IdxOffset; // Start offset in index buffer. Always equal to sum of ElemCount drawn so far.
|
unsigned int IdxOffset; // 4 // Start offset in index buffer. Always equal to sum of ElemCount drawn so far.
|
||||||
ImDrawCallback UserCallback; // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally.
|
ImDrawCallback UserCallback; // 4-8 // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally.
|
||||||
void* UserCallbackData; // The draw callback code can access this.
|
void* UserCallbackData; // 4-8 // The draw callback code can access this.
|
||||||
|
|
||||||
ImDrawCmd() { ElemCount = 0; TextureId = (ImTextureID)NULL; VtxOffset = IdxOffset = 0; UserCallback = NULL; UserCallbackData = NULL; }
|
ImDrawCmd() { ElemCount = 0; TextureId = (ImTextureID)NULL; VtxOffset = IdxOffset = 0; UserCallback = NULL; UserCallbackData = NULL; }
|
||||||
};
|
};
|
||||||
@ -2087,10 +2088,11 @@ struct ImDrawList
|
|||||||
ImVector<ImVec4> _ClipRectStack; // [Internal]
|
ImVector<ImVec4> _ClipRectStack; // [Internal]
|
||||||
ImVector<ImTextureID> _TextureIdStack; // [Internal]
|
ImVector<ImTextureID> _TextureIdStack; // [Internal]
|
||||||
ImVector<ImVec2> _Path; // [Internal] current path building
|
ImVector<ImVec2> _Path; // [Internal] current path building
|
||||||
ImDrawListSplitter _Splitter; // [Internal] for channels api
|
ImDrawListSplitter _Splitter; // [Internal] for channels api (note: prefer using your own persistent instance of ImDrawListSplitter!)
|
||||||
|
|
||||||
// If you want to create ImDrawList instances, pass them ImGui::GetDrawListSharedData() or create and use your own ImDrawListSharedData (so you can use ImDrawList without ImGui)
|
// If you want to create ImDrawList instances, pass them ImGui::GetDrawListSharedData() or create and use your own ImDrawListSharedData (so you can use ImDrawList without ImGui)
|
||||||
ImDrawList(const ImDrawListSharedData* shared_data) { _Data = shared_data; _OwnerName = NULL; Clear(); }
|
ImDrawList(const ImDrawListSharedData* shared_data) { _Data = shared_data; Flags = ImDrawListFlags_None; _VtxCurrentOffset = _VtxCurrentIdx = 0; _VtxWritePtr = NULL; _IdxWritePtr = NULL; _OwnerName = NULL; }
|
||||||
|
|
||||||
~ImDrawList() { ClearFreeMemory(); }
|
~ImDrawList() { ClearFreeMemory(); }
|
||||||
IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
|
IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
|
||||||
IMGUI_API void PushClipRectFullScreen();
|
IMGUI_API void PushClipRectFullScreen();
|
||||||
@ -2151,15 +2153,15 @@ struct ImDrawList
|
|||||||
// - Use to split render into layers. By switching channels to can render out-of-order (e.g. submit FG primitives before BG primitives)
|
// - Use to split render into layers. By switching channels to can render out-of-order (e.g. submit FG primitives before BG primitives)
|
||||||
// - Use to minimize draw calls (e.g. if going back-and-forth between multiple clipping rectangles, prefer to append into separate channels then merge at the end)
|
// - Use to minimize draw calls (e.g. if going back-and-forth between multiple clipping rectangles, prefer to append into separate channels then merge at the end)
|
||||||
// - FIXME-OBSOLETE: This API shouldn't have been in ImDrawList in the first place!
|
// - FIXME-OBSOLETE: This API shouldn't have been in ImDrawList in the first place!
|
||||||
// Prefer using your own persistent copy of ImDrawListSplitter as you can stack them.
|
// Prefer using your own persistent instance of ImDrawListSplitter as you can stack them.
|
||||||
// Using the ImDrawList::ChannelsXXXX you cannot stack a split over another.
|
// Using the ImDrawList::ChannelsXXXX you cannot stack a split over another.
|
||||||
inline void ChannelsSplit(int count) { _Splitter.Split(this, count); }
|
inline void ChannelsSplit(int count) { _Splitter.Split(this, count); }
|
||||||
inline void ChannelsMerge() { _Splitter.Merge(this); }
|
inline void ChannelsMerge() { _Splitter.Merge(this); }
|
||||||
inline void ChannelsSetCurrent(int n) { _Splitter.SetCurrentChannel(this, n); }
|
inline void ChannelsSetCurrent(int n) { _Splitter.SetCurrentChannel(this, n); }
|
||||||
|
|
||||||
// Internal helpers
|
// [Internal helpers]
|
||||||
// NB: all primitives needs to be reserved via PrimReserve() beforehand!
|
// NB: all primitives needs to be reserved via PrimReserve() beforehand!
|
||||||
IMGUI_API void Clear();
|
IMGUI_API void ResetForNewFrame();
|
||||||
IMGUI_API void ClearFreeMemory();
|
IMGUI_API void ClearFreeMemory();
|
||||||
IMGUI_API void PrimReserve(int idx_count, int vtx_count);
|
IMGUI_API void PrimReserve(int idx_count, int vtx_count);
|
||||||
IMGUI_API void PrimUnreserve(int idx_count, int vtx_count);
|
IMGUI_API void PrimUnreserve(int idx_count, int vtx_count);
|
||||||
@ -2263,7 +2265,7 @@ struct ImFontAtlasCustomRect
|
|||||||
float GlyphAdvanceX; // Input // For custom font glyphs only: glyph xadvance
|
float GlyphAdvanceX; // Input // For custom font glyphs only: glyph xadvance
|
||||||
ImVec2 GlyphOffset; // Input // For custom font glyphs only: glyph display offset
|
ImVec2 GlyphOffset; // Input // For custom font glyphs only: glyph display offset
|
||||||
ImFont* Font; // Input // For custom font glyphs only: target font
|
ImFont* Font; // Input // For custom font glyphs only: target font
|
||||||
ImFontAtlasCustomRect() { Width = Height = 0; X = Y = 0xFFFF; GlyphID = 0; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0,0); Font = NULL; }
|
ImFontAtlasCustomRect() { Width = Height = 0; X = Y = 0xFFFF; GlyphID = 0; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0, 0); Font = NULL; }
|
||||||
bool IsPacked() const { return X != 0xFFFF; }
|
bool IsPacked() const { return X != 0xFFFF; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2344,7 +2346,7 @@ struct ImFontAtlas
|
|||||||
// Read docs/FONTS.txt for more details about using colorful icons.
|
// Read docs/FONTS.txt for more details about using colorful icons.
|
||||||
// Note: this API may be redesigned later in order to support multi-monitor varying DPI settings.
|
// Note: this API may be redesigned later in order to support multi-monitor varying DPI settings.
|
||||||
IMGUI_API int AddCustomRectRegular(int width, int height);
|
IMGUI_API int AddCustomRectRegular(int width, int height);
|
||||||
IMGUI_API int AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0,0));
|
IMGUI_API int AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0, 0));
|
||||||
const ImFontAtlasCustomRect*GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; }
|
const ImFontAtlasCustomRect*GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; }
|
||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
|
@ -2733,7 +2733,7 @@ static void ShowDemoWindowLayout()
|
|||||||
}
|
}
|
||||||
if (show_child)
|
if (show_child)
|
||||||
{
|
{
|
||||||
ImGui::BeginChild("child", ImVec2(0,0), true);
|
ImGui::BeginChild("child", ImVec2(0, 0), true);
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
@ -4451,7 +4451,7 @@ struct ExampleAppLog
|
|||||||
Filter.Draw("Filter", -100.0f);
|
Filter.Draw("Filter", -100.0f);
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::BeginChild("scrolling", ImVec2(0,0), false, ImGuiWindowFlags_HorizontalScrollbar);
|
ImGui::BeginChild("scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);
|
||||||
|
|
||||||
if (clear)
|
if (clear)
|
||||||
Clear();
|
Clear();
|
||||||
@ -4724,7 +4724,7 @@ static void ShowExampleAppLongText(bool* p_open)
|
|||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
// Multiple calls to Text(), manually coarsely clipped - demonstrate how to use the ImGuiListClipper helper.
|
// Multiple calls to Text(), manually coarsely clipped - demonstrate how to use the ImGuiListClipper helper.
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0));
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||||
ImGuiListClipper clipper(lines);
|
ImGuiListClipper clipper(lines);
|
||||||
while (clipper.Step())
|
while (clipper.Step())
|
||||||
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
|
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
|
||||||
@ -4734,7 +4734,7 @@ static void ShowExampleAppLongText(bool* p_open)
|
|||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
// Multiple calls to Text(), not clipped (slow)
|
// Multiple calls to Text(), not clipped (slow)
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0));
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||||
for (int i = 0; i < lines; i++)
|
for (int i = 0; i < lines; i++)
|
||||||
ImGui::Text("%i The quick brown fox jumps over the lazy dog", i);
|
ImGui::Text("%i The quick brown fox jumps over the lazy dog", i);
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
@ -382,12 +382,13 @@ void ImDrawListSharedData::SetCircleSegmentMaxError(float max_error)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImDrawList::Clear()
|
// Initialize before use in a new frame. We always have a command ready in the buffer.
|
||||||
|
void ImDrawList::ResetForNewFrame()
|
||||||
{
|
{
|
||||||
CmdBuffer.resize(0);
|
CmdBuffer.resize(0);
|
||||||
IdxBuffer.resize(0);
|
IdxBuffer.resize(0);
|
||||||
VtxBuffer.resize(0);
|
VtxBuffer.resize(0);
|
||||||
Flags = _Data ? _Data->InitialFlags : ImDrawListFlags_None;
|
Flags = _Data->InitialFlags;
|
||||||
_VtxCurrentOffset = 0;
|
_VtxCurrentOffset = 0;
|
||||||
_VtxCurrentIdx = 0;
|
_VtxCurrentIdx = 0;
|
||||||
_VtxWritePtr = NULL;
|
_VtxWritePtr = NULL;
|
||||||
@ -396,6 +397,7 @@ void ImDrawList::Clear()
|
|||||||
_TextureIdStack.resize(0);
|
_TextureIdStack.resize(0);
|
||||||
_Path.resize(0);
|
_Path.resize(0);
|
||||||
_Splitter.Clear();
|
_Splitter.Clear();
|
||||||
|
CmdBuffer.push_back(ImDrawCmd());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImDrawList::ClearFreeMemory()
|
void ImDrawList::ClearFreeMemory()
|
||||||
@ -403,6 +405,8 @@ void ImDrawList::ClearFreeMemory()
|
|||||||
CmdBuffer.clear();
|
CmdBuffer.clear();
|
||||||
IdxBuffer.clear();
|
IdxBuffer.clear();
|
||||||
VtxBuffer.clear();
|
VtxBuffer.clear();
|
||||||
|
Flags = ImDrawListFlags_None;
|
||||||
|
_VtxCurrentOffset = 0;
|
||||||
_VtxCurrentIdx = 0;
|
_VtxCurrentIdx = 0;
|
||||||
_VtxWritePtr = NULL;
|
_VtxWritePtr = NULL;
|
||||||
_IdxWritePtr = NULL;
|
_IdxWritePtr = NULL;
|
||||||
@ -440,14 +444,14 @@ void ImDrawList::AddDrawCmd()
|
|||||||
|
|
||||||
void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data)
|
void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data)
|
||||||
{
|
{
|
||||||
ImDrawCmd* current_cmd = CmdBuffer.Size ? &CmdBuffer.back() : NULL;
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
if (!current_cmd || current_cmd->ElemCount != 0 || current_cmd->UserCallback != NULL)
|
if (curr_cmd->ElemCount != 0 || curr_cmd->UserCallback != NULL)
|
||||||
{
|
{
|
||||||
AddDrawCmd();
|
AddDrawCmd();
|
||||||
current_cmd = &CmdBuffer.back();
|
curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
}
|
}
|
||||||
current_cmd->UserCallback = callback;
|
curr_cmd->UserCallback = callback;
|
||||||
current_cmd->UserCallbackData = callback_data;
|
curr_cmd->UserCallbackData = callback_data;
|
||||||
|
|
||||||
AddDrawCmd(); // Force a new command after us (see comment below)
|
AddDrawCmd(); // Force a new command after us (see comment below)
|
||||||
}
|
}
|
||||||
@ -458,26 +462,32 @@ void ImDrawList::UpdateClipRect()
|
|||||||
{
|
{
|
||||||
// If current command is used with different settings we need to add a new command
|
// If current command is used with different settings we need to add a new command
|
||||||
const ImVec4 curr_clip_rect = GetCurrentClipRect();
|
const ImVec4 curr_clip_rect = GetCurrentClipRect();
|
||||||
ImDrawCmd* curr_cmd = CmdBuffer.Size > 0 ? &CmdBuffer.Data[CmdBuffer.Size-1] : NULL;
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
if (!curr_cmd || (curr_cmd->ElemCount != 0 && memcmp(&curr_cmd->ClipRect, &curr_clip_rect, sizeof(ImVec4)) != 0) || curr_cmd->UserCallback != NULL)
|
if ((curr_cmd->ElemCount != 0 && memcmp(&curr_cmd->ClipRect, &curr_clip_rect, sizeof(ImVec4)) != 0) || curr_cmd->UserCallback != NULL)
|
||||||
{
|
{
|
||||||
AddDrawCmd();
|
AddDrawCmd();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to merge with previous command if it matches, else use current command
|
// Try to merge with previous command if it matches, else use current command
|
||||||
ImDrawCmd* prev_cmd = CmdBuffer.Size > 1 ? curr_cmd - 1 : NULL;
|
if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1)
|
||||||
if (curr_cmd->ElemCount == 0 && prev_cmd && memcmp(&prev_cmd->ClipRect, &curr_clip_rect, sizeof(ImVec4)) == 0 && prev_cmd->TextureId == GetCurrentTextureId() && prev_cmd->UserCallback == NULL)
|
{
|
||||||
CmdBuffer.pop_back();
|
ImDrawCmd* prev_cmd = curr_cmd - 1;
|
||||||
else
|
if (memcmp(&prev_cmd->ClipRect, &curr_clip_rect, sizeof(ImVec4)) == 0 && prev_cmd->VtxOffset == _VtxCurrentOffset && prev_cmd->TextureId == GetCurrentTextureId() && prev_cmd->UserCallback == NULL)
|
||||||
curr_cmd->ClipRect = curr_clip_rect;
|
{
|
||||||
|
CmdBuffer.pop_back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
curr_cmd->ClipRect = curr_clip_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImDrawList::UpdateTextureID()
|
void ImDrawList::UpdateTextureID()
|
||||||
{
|
{
|
||||||
// If current command is used with different settings we need to add a new command
|
// If current command is used with different settings we need to add a new command
|
||||||
const ImTextureID curr_texture_id = GetCurrentTextureId();
|
const ImTextureID curr_texture_id = GetCurrentTextureId();
|
||||||
ImDrawCmd* curr_cmd = CmdBuffer.Size ? &CmdBuffer.back() : NULL;
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
if (!curr_cmd || (curr_cmd->ElemCount != 0 && curr_cmd->TextureId != curr_texture_id) || curr_cmd->UserCallback != NULL)
|
if (!curr_cmd || (curr_cmd->ElemCount != 0 && curr_cmd->TextureId != curr_texture_id) || curr_cmd->UserCallback != NULL)
|
||||||
{
|
{
|
||||||
AddDrawCmd();
|
AddDrawCmd();
|
||||||
@ -485,11 +495,17 @@ void ImDrawList::UpdateTextureID()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to merge with previous command if it matches, else use current command
|
// Try to merge with previous command if it matches, else use current command
|
||||||
ImDrawCmd* prev_cmd = CmdBuffer.Size > 1 ? curr_cmd - 1 : NULL;
|
if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1)
|
||||||
if (curr_cmd->ElemCount == 0 && prev_cmd && prev_cmd->TextureId == curr_texture_id && memcmp(&prev_cmd->ClipRect, &GetCurrentClipRect(), sizeof(ImVec4)) == 0 && prev_cmd->UserCallback == NULL)
|
{
|
||||||
CmdBuffer.pop_back();
|
ImDrawCmd* prev_cmd = curr_cmd - 1;
|
||||||
else
|
if (prev_cmd->TextureId == curr_texture_id && memcmp(&prev_cmd->ClipRect, &GetCurrentClipRect(), sizeof(ImVec4)) == 0 && prev_cmd->VtxOffset == _VtxCurrentOffset && prev_cmd->UserCallback == NULL)
|
||||||
curr_cmd->TextureId = curr_texture_id;
|
{
|
||||||
|
CmdBuffer.pop_back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
curr_cmd->TextureId = curr_texture_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef GetCurrentClipRect
|
#undef GetCurrentClipRect
|
||||||
@ -553,8 +569,8 @@ void ImDrawList::PrimReserve(int idx_count, int vtx_count)
|
|||||||
AddDrawCmd();
|
AddDrawCmd();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImDrawCmd& draw_cmd = CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* draw_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
draw_cmd.ElemCount += idx_count;
|
draw_cmd->ElemCount += idx_count;
|
||||||
|
|
||||||
int vtx_buffer_old_size = VtxBuffer.Size;
|
int vtx_buffer_old_size = VtxBuffer.Size;
|
||||||
VtxBuffer.resize(vtx_buffer_old_size + vtx_count);
|
VtxBuffer.resize(vtx_buffer_old_size + vtx_count);
|
||||||
@ -570,8 +586,8 @@ void ImDrawList::PrimUnreserve(int idx_count, int vtx_count)
|
|||||||
{
|
{
|
||||||
IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0);
|
IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0);
|
||||||
|
|
||||||
ImDrawCmd& draw_cmd = CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* draw_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
draw_cmd.ElemCount -= idx_count;
|
draw_cmd->ElemCount -= idx_count;
|
||||||
VtxBuffer.shrink(VtxBuffer.Size - vtx_count);
|
VtxBuffer.shrink(VtxBuffer.Size - vtx_count);
|
||||||
IdxBuffer.shrink(IdxBuffer.Size - idx_count);
|
IdxBuffer.shrink(IdxBuffer.Size - idx_count);
|
||||||
}
|
}
|
||||||
@ -2879,7 +2895,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons
|
|||||||
const float line_height = size;
|
const float line_height = size;
|
||||||
const float scale = size / FontSize;
|
const float scale = size / FontSize;
|
||||||
|
|
||||||
ImVec2 text_size = ImVec2(0,0);
|
ImVec2 text_size = ImVec2(0, 0);
|
||||||
float line_width = 0.0f;
|
float line_width = 0.0f;
|
||||||
|
|
||||||
const bool word_wrap_enabled = (wrap_width > 0.0f);
|
const bool word_wrap_enabled = (wrap_width > 0.0f);
|
||||||
|
@ -1785,7 +1785,7 @@ struct IMGUI_API ImGuiWindow
|
|||||||
ImGuiCond SetWindowCollapsedAllowFlags; // store acceptable condition flags for SetNextWindowCollapsed() use.
|
ImGuiCond SetWindowCollapsedAllowFlags; // store acceptable condition flags for SetNextWindowCollapsed() use.
|
||||||
ImGuiCond SetWindowDockAllowFlags; // store acceptable condition flags for SetNextWindowDock() use.
|
ImGuiCond SetWindowDockAllowFlags; // store acceptable condition flags for SetNextWindowDock() use.
|
||||||
ImVec2 SetWindowPosVal; // store window position when using a non-zero Pivot (position set needs to be processed when we know the window size)
|
ImVec2 SetWindowPosVal; // store window position when using a non-zero Pivot (position set needs to be processed when we know the window size)
|
||||||
ImVec2 SetWindowPosPivot; // store window pivot for positioning. ImVec2(0,0) when positioning from top-left corner; ImVec2(0.5f,0.5f) for centering; ImVec2(1,1) for bottom right.
|
ImVec2 SetWindowPosPivot; // store window pivot for positioning. ImVec2(0, 0) when positioning from top-left corner; ImVec2(0.5f, 0.5f) for centering; ImVec2(1, 1) for bottom right.
|
||||||
|
|
||||||
ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack. (In theory this should be in the TempData structure)
|
ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack. (In theory this should be in the TempData structure)
|
||||||
ImGuiWindowTempData DC; // Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name.
|
ImGuiWindowTempData DC; // Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name.
|
||||||
@ -2184,7 +2184,7 @@ namespace ImGui
|
|||||||
// NB: All position are in absolute pixels coordinates (we are never using window coordinates internally)
|
// NB: All position are in absolute pixels coordinates (we are never using window coordinates internally)
|
||||||
IMGUI_API void RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true);
|
IMGUI_API void RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true);
|
||||||
IMGUI_API void RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width);
|
IMGUI_API void RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width);
|
||||||
IMGUI_API void RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0,0), const ImRect* clip_rect = NULL);
|
IMGUI_API void RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0, 0), const ImRect* clip_rect = NULL);
|
||||||
IMGUI_API void RenderTextClippedEx(ImDrawList* draw_list, const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0, 0), const ImRect* clip_rect = NULL);
|
IMGUI_API void RenderTextClippedEx(ImDrawList* draw_list, const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0, 0), const ImRect* clip_rect = NULL);
|
||||||
IMGUI_API void RenderTextEllipsis(ImDrawList* draw_list, const ImVec2& pos_min, const ImVec2& pos_max, float clip_max_x, float ellipsis_max_x, const char* text, const char* text_end, const ImVec2* text_size_if_known);
|
IMGUI_API void RenderTextEllipsis(ImDrawList* draw_list, const ImVec2& pos_min, const ImVec2& pos_max, float clip_max_x, float ellipsis_max_x, const char* text, const char* text_end, const ImVec2* text_size_if_known);
|
||||||
IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);
|
IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);
|
||||||
@ -2212,7 +2212,7 @@ namespace ImGui
|
|||||||
|
|
||||||
// Widgets
|
// Widgets
|
||||||
IMGUI_API void TextEx(const char* text, const char* text_end = NULL, ImGuiTextFlags flags = 0);
|
IMGUI_API void TextEx(const char* text, const char* text_end = NULL, ImGuiTextFlags flags = 0);
|
||||||
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos);
|
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos);
|
||||||
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos, ImGuiDockNode* dock_node);
|
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos, ImGuiDockNode* dock_node);
|
||||||
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
||||||
|
@ -1232,7 +1232,7 @@ void ImGui::Spacing()
|
|||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
return;
|
return;
|
||||||
ItemSize(ImVec2(0,0));
|
ItemSize(ImVec2(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::Dummy(const ImVec2& size)
|
void ImGui::Dummy(const ImVec2& size)
|
||||||
@ -1256,7 +1256,7 @@ void ImGui::NewLine()
|
|||||||
const ImGuiLayoutType backup_layout_type = window->DC.LayoutType;
|
const ImGuiLayoutType backup_layout_type = window->DC.LayoutType;
|
||||||
window->DC.LayoutType = ImGuiLayoutType_Vertical;
|
window->DC.LayoutType = ImGuiLayoutType_Vertical;
|
||||||
if (window->DC.CurrLineSize.y > 0.0f) // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height.
|
if (window->DC.CurrLineSize.y > 0.0f) // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height.
|
||||||
ItemSize(ImVec2(0,0));
|
ItemSize(ImVec2(0, 0));
|
||||||
else
|
else
|
||||||
ItemSize(ImVec2(0.0f, g.FontSize));
|
ItemSize(ImVec2(0.0f, g.FontSize));
|
||||||
window->DC.LayoutType = backup_layout_type;
|
window->DC.LayoutType = backup_layout_type;
|
||||||
@ -1618,7 +1618,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
|
|||||||
|
|
||||||
// The old Combo() API exposed "popup_max_height_in_items". The new more general BeginCombo() API doesn't have/need it, but we emulate it here.
|
// The old Combo() API exposed "popup_max_height_in_items". The new more general BeginCombo() API doesn't have/need it, but we emulate it here.
|
||||||
if (popup_max_height_in_items != -1 && !(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint))
|
if (popup_max_height_in_items != -1 && !(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint))
|
||||||
SetNextWindowSizeConstraints(ImVec2(0,0), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items)));
|
SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items)));
|
||||||
|
|
||||||
if (!BeginCombo(label, preview_value, ImGuiComboFlags_None))
|
if (!BeginCombo(label, preview_value, ImGuiComboFlags_None))
|
||||||
return false;
|
return false;
|
||||||
@ -3189,7 +3189,7 @@ bool ImGui::InputDouble(const char* label, double* v, double step, double step_f
|
|||||||
bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
|
bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
|
||||||
{
|
{
|
||||||
IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline()
|
IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline()
|
||||||
return InputTextEx(label, NULL, buf, (int)buf_size, ImVec2(0,0), flags, callback, user_data);
|
return InputTextEx(label, NULL, buf, (int)buf_size, ImVec2(0, 0), flags, callback, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
|
bool ImGui::InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
|
||||||
@ -3224,7 +3224,7 @@ static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* t
|
|||||||
const float line_height = g.FontSize;
|
const float line_height = g.FontSize;
|
||||||
const float scale = line_height / font->FontSize;
|
const float scale = line_height / font->FontSize;
|
||||||
|
|
||||||
ImVec2 text_size = ImVec2(0,0);
|
ImVec2 text_size = ImVec2(0, 0);
|
||||||
float line_width = 0.0f;
|
float line_width = 0.0f;
|
||||||
|
|
||||||
const ImWchar* s = text_begin;
|
const ImWchar* s = text_begin;
|
||||||
@ -7696,7 +7696,7 @@ void ImGui::PushColumnsBackground()
|
|||||||
int cmd_size = window->DrawList->CmdBuffer.Size;
|
int cmd_size = window->DrawList->CmdBuffer.Size;
|
||||||
PushClipRect(columns->HostClipRect.Min, columns->HostClipRect.Max, false);
|
PushClipRect(columns->HostClipRect.Min, columns->HostClipRect.Max, false);
|
||||||
IM_UNUSED(cmd_size);
|
IM_UNUSED(cmd_size);
|
||||||
IM_ASSERT(cmd_size == window->DrawList->CmdBuffer.Size); // Being in channel 0 this should not have created an ImDrawCmd
|
IM_ASSERT(cmd_size >= window->DrawList->CmdBuffer.Size); // Being in channel 0 this should not have created an ImDrawCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::PopColumnsBackground()
|
void ImGui::PopColumnsBackground()
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
// - v0.60: (2019/01/10) re-factored to match big update in STB builder. fixed texture height waste. fixed redundant glyphs when merging. support for glyph padding.
|
// - v0.60: (2019/01/10) re-factored to match big update in STB builder. fixed texture height waste. fixed redundant glyphs when merging. support for glyph padding.
|
||||||
// - v0.61: (2019/01/15) added support for imgui allocators + added FreeType only override function SetAllocatorFunctions().
|
// - v0.61: (2019/01/15) added support for imgui allocators + added FreeType only override function SetAllocatorFunctions().
|
||||||
// - v0.62: (2019/02/09) added RasterizerFlags::Monochrome flag to disable font anti-aliasing (combine with ::MonoHinting for best results!)
|
// - v0.62: (2019/02/09) added RasterizerFlags::Monochrome flag to disable font anti-aliasing (combine with ::MonoHinting for best results!)
|
||||||
|
// - v0.63: (2020/06/04) fix for rare case where FT_Get_Char_Index() succeed but FT_Load_Glyph() fails.
|
||||||
|
|
||||||
// Gamma Correct Blending:
|
// Gamma Correct Blending:
|
||||||
// FreeType assumes blending in linear space rather than gamma space.
|
// FreeType assumes blending in linear space rather than gamma space.
|
||||||
@ -467,7 +468,6 @@ bool ImFontAtlasBuildWithFreeType(FT_Library ft_library, ImFontAtlas* atlas, uns
|
|||||||
ImFontBuildSrcGlyphFT& src_glyph = src_tmp.GlyphsList[glyph_i];
|
ImFontBuildSrcGlyphFT& src_glyph = src_tmp.GlyphsList[glyph_i];
|
||||||
|
|
||||||
const FT_Glyph_Metrics* metrics = src_tmp.Font.LoadGlyph(src_glyph.Codepoint);
|
const FT_Glyph_Metrics* metrics = src_tmp.Font.LoadGlyph(src_glyph.Codepoint);
|
||||||
IM_ASSERT(metrics != NULL);
|
|
||||||
if (metrics == NULL)
|
if (metrics == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -559,6 +559,8 @@ bool ImFontAtlasBuildWithFreeType(FT_Library ft_library, ImFontAtlas* atlas, uns
|
|||||||
ImFontBuildSrcGlyphFT& src_glyph = src_tmp.GlyphsList[glyph_i];
|
ImFontBuildSrcGlyphFT& src_glyph = src_tmp.GlyphsList[glyph_i];
|
||||||
stbrp_rect& pack_rect = src_tmp.Rects[glyph_i];
|
stbrp_rect& pack_rect = src_tmp.Rects[glyph_i];
|
||||||
IM_ASSERT(pack_rect.was_packed);
|
IM_ASSERT(pack_rect.was_packed);
|
||||||
|
if (pack_rect.w == 0 && pack_rect.h == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
GlyphInfo& info = src_glyph.Info;
|
GlyphInfo& info = src_glyph.Info;
|
||||||
IM_ASSERT(info.Width + padding <= pack_rect.w);
|
IM_ASSERT(info.Width + padding <= pack_rect.w);
|
||||||
|
Loading…
Reference in New Issue
Block a user