diff --git a/examples/.gitignore b/examples/.gitignore index 9516dc7f..12785499 100644 --- a/examples/.gitignore +++ b/examples/.gitignore @@ -1,4 +1,4 @@ -## Visual Studio files +build/* Debug/* Release/* ipch/* diff --git a/examples/allegro5_example/imgui_impl_a5.cpp b/examples/allegro5_example/imgui_impl_a5.cpp index 62f7af67..42691362 100644 --- a/examples/allegro5_example/imgui_impl_a5.cpp +++ b/examples/allegro5_example/imgui_impl_a5.cpp @@ -12,7 +12,7 @@ #include // uint64_t #include // memcpy -#include +#include "imgui.h" #include "imgui_impl_a5.h" #include #include diff --git a/examples/allegro5_example/main.cpp b/examples/allegro5_example/main.cpp index 3c9c9770..7ecf4321 100644 --- a/examples/allegro5_example/main.cpp +++ b/examples/allegro5_example/main.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include "imgui.h" #include "imgui_impl_a5.h" int main(int, char**) diff --git a/examples/apple_example/imguiex.xcodeproj/project.pbxproj b/examples/apple_example/imguiex.xcodeproj/project.pbxproj index be43fb60..3e5b0789 100644 --- a/examples/apple_example/imguiex.xcodeproj/project.pbxproj +++ b/examples/apple_example/imguiex.xcodeproj/project.pbxproj @@ -17,8 +17,8 @@ 1A1A0F331CB3A0E10090F036 /* imgui_demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 197E1E881B89443600E3FE6A /* imgui_demo.cpp */; }; 1A1A0F341CB3A0EC0090F036 /* debug_hud.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D2FC5891B2E6A5500C130BA /* debug_hud.cpp */; }; 1A1A0F481CB3A2E50090F036 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1A0F391CB3A1B20090F036 /* main.cpp */; }; - 1A1A0F4A1CB3A5070090F036 /* imgui_impl_glfw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1A0F371CB3A1B20090F036 /* imgui_impl_glfw.cpp */; }; - 1A1A0F4E1CB3C54D0090F036 /* libglfw3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1A0F4D1CB3C54D0090F036 /* libglfw3.dylib */; }; + 1A1A0F4A1CB3A5070090F036 /* imgui_impl_glfw_gl2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1A0F371CB3A1B20090F036 /* imgui_impl_glfw_gl2.cpp */; }; + 1A1A0F4E1CB3C54D0090F036 /* libglfw.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1A0F4D1CB3C54D0090F036 /* libglfw.dylib */; }; 6D1E39171B35EEF10017B40F /* uSynergy.c in Sources */ = {isa = PBXBuildFile; fileRef = 6D1E39151B35EEF10017B40F /* uSynergy.c */; }; 6D2FC55A1B2E632000C130BA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D2FC5591B2E632000C130BA /* main.m */; }; 6D2FC55D1B2E632000C130BA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D2FC55C1B2E632000C130BA /* AppDelegate.m */; }; @@ -43,10 +43,10 @@ 1A1A0F221CB39FB50090F036 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 1A1A0F271CB39FB50090F036 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 1A1A0F2C1CB39FB50090F036 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 1A1A0F371CB3A1B20090F036 /* imgui_impl_glfw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = imgui_impl_glfw.cpp; sourceTree = ""; }; - 1A1A0F381CB3A1B20090F036 /* imgui_impl_glfw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imgui_impl_glfw.h; sourceTree = ""; }; + 1A1A0F371CB3A1B20090F036 /* imgui_impl_glfw_gl2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = imgui_impl_glfw_gl2.cpp; sourceTree = ""; }; + 1A1A0F381CB3A1B20090F036 /* imgui_impl_glfw_gl2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imgui_impl_glfw_gl2.h; sourceTree = ""; }; 1A1A0F391CB3A1B20090F036 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; - 1A1A0F4D1CB3C54D0090F036 /* libglfw3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libglfw3.dylib; path = /usr/local/lib/libglfw3.dylib; sourceTree = ""; }; + 1A1A0F4D1CB3C54D0090F036 /* libglfw.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libglfw.dylib; path = /usr/local/lib/libglfw.dylib; sourceTree = ""; }; 6D1E39151B35EEF10017B40F /* uSynergy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = uSynergy.c; sourceTree = ""; }; 6D1E39161B35EEF10017B40F /* uSynergy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uSynergy.h; sourceTree = ""; }; 6D2FC5541B2E632000C130BA /* imguiex-ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "imguiex-ios.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -77,7 +77,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 1A1A0F4E1CB3C54D0090F036 /* libglfw3.dylib in Frameworks */, + 1A1A0F4E1CB3C54D0090F036 /* libglfw.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -96,7 +96,7 @@ 1A1A0F201CB39FB50090F036 /* imguiex-osx */ = { isa = PBXGroup; children = ( - 1A1A0F4D1CB3C54D0090F036 /* libglfw3.dylib */, + 1A1A0F4D1CB3C54D0090F036 /* libglfw.dylib */, 1A1A0F351CB3A1B20090F036 /* opengl2_example */, 1A1A0F211CB39FB50090F036 /* AppDelegate.h */, 1A1A0F221CB39FB50090F036 /* AppDelegate.m */, @@ -117,8 +117,8 @@ 1A1A0F351CB3A1B20090F036 /* opengl2_example */ = { isa = PBXGroup; children = ( - 1A1A0F371CB3A1B20090F036 /* imgui_impl_glfw.cpp */, - 1A1A0F381CB3A1B20090F036 /* imgui_impl_glfw.h */, + 1A1A0F371CB3A1B20090F036 /* imgui_impl_glfw_gl2.cpp */, + 1A1A0F381CB3A1B20090F036 /* imgui_impl_glfw_gl2.h */, 1A1A0F391CB3A1B20090F036 /* main.cpp */, ); name = opengl2_example; @@ -307,7 +307,7 @@ 1A1A0F481CB3A2E50090F036 /* main.cpp in Sources */, 1A1A0F321CB3A0DE0090F036 /* uSynergy.c in Sources */, 1A1A0F231CB39FB50090F036 /* AppDelegate.m in Sources */, - 1A1A0F4A1CB3A5070090F036 /* imgui_impl_glfw.cpp in Sources */, + 1A1A0F4A1CB3A5070090F036 /* imgui_impl_glfw_gl2.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/examples/directx10_example/main.cpp b/examples/directx10_example/main.cpp index 38f4054e..fccdda60 100644 --- a/examples/directx10_example/main.cpp +++ b/examples/directx10_example/main.cpp @@ -1,7 +1,7 @@ // ImGui - standalone example application for DirectX 10 // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. -#include +#include "imgui.h" #include "imgui_impl_dx10.h" #include #include diff --git a/examples/directx11_example/imgui_impl_dx11.cpp b/examples/directx11_example/imgui_impl_dx11.cpp index cd57bc97..67b8a9ee 100644 --- a/examples/directx11_example/imgui_impl_dx11.cpp +++ b/examples/directx11_example/imgui_impl_dx11.cpp @@ -6,7 +6,7 @@ // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. // https://github.com/ocornut/imgui -#include +#include "imgui.h" #include "imgui_impl_dx11.h" // DirectX diff --git a/examples/directx11_example/main.cpp b/examples/directx11_example/main.cpp index 1ce5d49d..8388406e 100644 --- a/examples/directx11_example/main.cpp +++ b/examples/directx11_example/main.cpp @@ -1,7 +1,7 @@ // ImGui - standalone example application for DirectX 11 // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. -#include +#include "imgui.h" #include "imgui_impl_dx11.h" #include #define DIRECTINPUT_VERSION 0x0800 diff --git a/examples/directx9_example/imgui_impl_dx9.cpp b/examples/directx9_example/imgui_impl_dx9.cpp index a4e67691..b47a840b 100644 --- a/examples/directx9_example/imgui_impl_dx9.cpp +++ b/examples/directx9_example/imgui_impl_dx9.cpp @@ -6,7 +6,7 @@ // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. // https://github.com/ocornut/imgui -#include +#include "imgui.h" #include "imgui_impl_dx9.h" // DirectX diff --git a/examples/directx9_example/main.cpp b/examples/directx9_example/main.cpp index 09a109d9..d0323dca 100644 --- a/examples/directx9_example/main.cpp +++ b/examples/directx9_example/main.cpp @@ -1,7 +1,7 @@ // ImGui - standalone example application for DirectX 9 // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. -#include +#include "imgui.h" #include "imgui_impl_dx9.h" #include #define DIRECTINPUT_VERSION 0x0800 diff --git a/examples/marmalade_example/imgui_impl_marmalade.cpp b/examples/marmalade_example/imgui_impl_marmalade.cpp index 36fc8328..0bffb30d 100644 --- a/examples/marmalade_example/imgui_impl_marmalade.cpp +++ b/examples/marmalade_example/imgui_impl_marmalade.cpp @@ -9,7 +9,7 @@ // Copyright (C) 2015 by Giovanni Zito // This file is part of ImGui -#include +#include "imgui.h" #include "imgui_impl_marmalade.h" #include diff --git a/examples/marmalade_example/main.cpp b/examples/marmalade_example/main.cpp index 2b5edb77..338c469c 100644 --- a/examples/marmalade_example/main.cpp +++ b/examples/marmalade_example/main.cpp @@ -4,7 +4,7 @@ // Copyright (C) 2015 by Giovanni Zito // This file is part of ImGui -#include +#include "imgui.h" #include "imgui_impl_marmalade.h" #include diff --git a/examples/null_example/main.cpp b/examples/null_example/main.cpp index 04c1bda4..3dd41b0e 100644 --- a/examples/null_example/main.cpp +++ b/examples/null_example/main.cpp @@ -1,5 +1,5 @@ // ImGui - null/dummy example application (compile and link imgui with no inputs, no outputs) -#include +#include "imgui.h" #include int main(int, char**) diff --git a/examples/opengl2_example/Makefile b/examples/opengl2_example/Makefile index f10c59a8..b0ee3152 100644 --- a/examples/opengl2_example/Makefile +++ b/examples/opengl2_example/Makefile @@ -2,13 +2,17 @@ # Cross Platform Makefile # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X # -# -# if you using Mac OS X: -# You'll need glfw -# http://www.glfw.org +# You will need GLFW (http://www.glfw.org): +# Linux: +# apt-get install libglfw-dev +# Mac OS X: +# brew install glfw +# MSYS2: +# pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw # #CXX = g++ +#CXX = clang++ EXE = opengl2_example OBJS = main.o imgui_impl_glfw_gl2.o @@ -46,6 +50,7 @@ ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) CFLAGS = $(CXXFLAGS) endif + .cpp.o: $(CXX) $(CXXFLAGS) -c -o $@ $< diff --git a/examples/opengl2_example/imgui_impl_glfw_gl2.cpp b/examples/opengl2_example/imgui_impl_glfw_gl2.cpp index e5fe2f47..27052b60 100644 --- a/examples/opengl2_example/imgui_impl_glfw_gl2.cpp +++ b/examples/opengl2_example/imgui_impl_glfw_gl2.cpp @@ -15,7 +15,7 @@ // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. // https://github.com/ocornut/imgui -#include +#include "imgui.h" #include "imgui_impl_glfw_gl2.h" // GLFW diff --git a/examples/opengl2_example/main.cpp b/examples/opengl2_example/main.cpp index 6359f5b6..01eba4fb 100644 --- a/examples/opengl2_example/main.cpp +++ b/examples/opengl2_example/main.cpp @@ -6,7 +6,7 @@ // **Prefer using the code in the opengl3_example/ folder** // See imgui_impl_glfw.cpp for details. -#include +#include "imgui.h" #include "imgui_impl_glfw_gl2.h" #include #include diff --git a/examples/opengl3_example/Makefile b/examples/opengl3_example/Makefile index 32343ed2..133c0a64 100644 --- a/examples/opengl3_example/Makefile +++ b/examples/opengl3_example/Makefile @@ -2,15 +2,17 @@ # Cross Platform Makefile # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X # -# -# You will need GLFW (http://www.glfw.org) -# -# apt-get install libglfw-dev # Linux -# brew install glfw # Mac OS X -# pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw # MSYS2 +# You will need GLFW (http://www.glfw.org): +# Linux: +# apt-get install libglfw-dev +# Mac OS X: +# brew install glfw +# MSYS2: +# pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw # #CXX = g++ +#CXX = clang++ EXE = opengl3_example OBJS = main.o imgui_impl_glfw_gl3.o diff --git a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp index 5e9f1787..0b8e5d83 100644 --- a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp +++ b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp @@ -8,7 +8,7 @@ // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. // https://github.com/ocornut/imgui -#include +#include "imgui.h" #include "imgui_impl_glfw_gl3.h" // GL3W/GLFW diff --git a/examples/opengl3_example/main.cpp b/examples/opengl3_example/main.cpp index 7b5f1c56..b1df4f68 100644 --- a/examples/opengl3_example/main.cpp +++ b/examples/opengl3_example/main.cpp @@ -3,7 +3,7 @@ // (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) // (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.) -#include +#include "imgui.h" #include "imgui_impl_glfw_gl3.h" #include #include // This example is using gl3w to access OpenGL functions (because it is small). You may use glew/glad/glLoadGen/etc. whatever already works for you. diff --git a/examples/sdl_opengl2_example/imgui_impl_sdl_gl2.cpp b/examples/sdl_opengl2_example/imgui_impl_sdl_gl2.cpp index 76def29c..801c433f 100644 --- a/examples/sdl_opengl2_example/imgui_impl_sdl_gl2.cpp +++ b/examples/sdl_opengl2_example/imgui_impl_sdl_gl2.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include "imgui.h" #include "imgui_impl_sdl_gl2.h" // Data diff --git a/examples/sdl_opengl2_example/main.cpp b/examples/sdl_opengl2_example/main.cpp index 21b567a8..bc475647 100644 --- a/examples/sdl_opengl2_example/main.cpp +++ b/examples/sdl_opengl2_example/main.cpp @@ -6,7 +6,7 @@ // **Prefer using the code in the sdl_opengl3_example/ folder** // See imgui_impl_sdl.cpp for details. -#include +#include "imgui.h" #include "imgui_impl_sdl_gl2.h" #include #include diff --git a/examples/sdl_opengl3_example/Makefile b/examples/sdl_opengl3_example/Makefile index 364ca123..45f6a663 100644 --- a/examples/sdl_opengl3_example/Makefile +++ b/examples/sdl_opengl3_example/Makefile @@ -2,15 +2,17 @@ # Cross Platform Makefile # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X # -# -# You will need SDL2 (http://www.libsdl.org) -# -# apt-get install libsdl2-dev # Linux -# brew install sdl2 # Mac OS X -# pacman -S mingw-w64-i686-SDL # MSYS2 +# You will need SDL2 (http://www.libsdl.org): +# Linux: +# apt-get install libsdl2-dev +# Mac OS X: +# brew install sdl2 +# MSYS2: +# pacman -S mingw-w64-i686-SDL # #CXX = g++ +#CXX = clang++ EXE = sdl_opengl3_example OBJS = main.o imgui_impl_sdl_gl3.o diff --git a/examples/sdl_opengl3_example/main.cpp b/examples/sdl_opengl3_example/main.cpp index 7ee60389..6321181d 100644 --- a/examples/sdl_opengl3_example/main.cpp +++ b/examples/sdl_opengl3_example/main.cpp @@ -3,7 +3,7 @@ // (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) // (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.) -#include +#include "imgui.h" #include "imgui_impl_sdl_gl3.h" #include #include // This example is using gl3w to access OpenGL functions (because it is small). You may use glew/glad/glLoadGen/etc. whatever already works for you. diff --git a/examples/vulkan_example/imgui_impl_glfw_vulkan.cpp b/examples/vulkan_example/imgui_impl_glfw_vulkan.cpp index b9e6d78f..3748b504 100644 --- a/examples/vulkan_example/imgui_impl_glfw_vulkan.cpp +++ b/examples/vulkan_example/imgui_impl_glfw_vulkan.cpp @@ -6,7 +6,8 @@ // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. // https://github.com/ocornut/imgui -#include +#include "imgui.h" +#include "imgui_impl_glfw_vulkan.h" // GLFW #define GLFW_INCLUDE_NONE @@ -19,8 +20,6 @@ #include #endif -#include "imgui_impl_glfw_vulkan.h" - // GLFW Data static GLFWwindow* g_Window = NULL; static double g_Time = 0.0f; @@ -36,7 +35,7 @@ static VkDescriptorPool g_DescriptorPool = VK_NULL_HANDLE; static void (*g_CheckVkResult)(VkResult err) = NULL; static VkCommandBuffer g_CommandBuffer = VK_NULL_HANDLE; -static size_t g_BufferMemoryAlignment = 256; +static VkDeviceSize g_BufferMemoryAlignment = 256; static VkPipelineCreateFlags g_PipelineCreateFlags = 0; static int g_FrameIndex = 0; @@ -52,8 +51,8 @@ static VkImageView g_FontView = VK_NULL_HANDLE; static VkDeviceMemory g_VertexBufferMemory[IMGUI_VK_QUEUED_FRAMES] = {}; static VkDeviceMemory g_IndexBufferMemory[IMGUI_VK_QUEUED_FRAMES] = {}; -static size_t g_VertexBufferSize[IMGUI_VK_QUEUED_FRAMES] = {}; -static size_t g_IndexBufferSize[IMGUI_VK_QUEUED_FRAMES] = {}; +static VkDeviceSize g_VertexBufferSize[IMGUI_VK_QUEUED_FRAMES] = {}; +static VkDeviceSize g_IndexBufferSize[IMGUI_VK_QUEUED_FRAMES] = {}; static VkBuffer g_VertexBuffer[IMGUI_VK_QUEUED_FRAMES] = {}; static VkBuffer g_IndexBuffer[IMGUI_VK_QUEUED_FRAMES] = {}; @@ -164,7 +163,7 @@ void ImGui_ImplGlfwVulkan_RenderDrawLists(ImDrawData* draw_data) vkDestroyBuffer(g_Device, g_VertexBuffer[g_FrameIndex], g_Allocator); if (g_VertexBufferMemory[g_FrameIndex]) vkFreeMemory(g_Device, g_VertexBufferMemory[g_FrameIndex], g_Allocator); - size_t vertex_buffer_size = ((vertex_size-1) / g_BufferMemoryAlignment+1) * g_BufferMemoryAlignment; + VkDeviceSize vertex_buffer_size = ((vertex_size-1) / g_BufferMemoryAlignment+1) * g_BufferMemoryAlignment; VkBufferCreateInfo buffer_info = {}; buffer_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; buffer_info.size = vertex_buffer_size; @@ -194,7 +193,7 @@ void ImGui_ImplGlfwVulkan_RenderDrawLists(ImDrawData* draw_data) vkDestroyBuffer(g_Device, g_IndexBuffer[g_FrameIndex], g_Allocator); if (g_IndexBufferMemory[g_FrameIndex]) vkFreeMemory(g_Device, g_IndexBufferMemory[g_FrameIndex], g_Allocator); - size_t index_buffer_size = ((index_size-1) / g_BufferMemoryAlignment+1) * g_BufferMemoryAlignment; + VkDeviceSize index_buffer_size = ((index_size-1) / g_BufferMemoryAlignment+1) * g_BufferMemoryAlignment; VkBufferCreateInfo buffer_info = {}; buffer_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; buffer_info.size = index_buffer_size; diff --git a/examples/vulkan_example/main.cpp b/examples/vulkan_example/main.cpp index 6c4ef33f..75b08d22 100644 --- a/examples/vulkan_example/main.cpp +++ b/examples/vulkan_example/main.cpp @@ -1,7 +1,8 @@ // ImGui - standalone example application for Glfw + Vulkan, using programmable pipeline // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. -#include +#include "imgui.h" +#include "imgui_impl_glfw_vulkan.h" #include // printf, fprintf #include // abort @@ -9,8 +10,6 @@ #define GLFW_INCLUDE_VULKAN #include -#include "imgui_impl_glfw_vulkan.h" - #define IMGUI_MAX_POSSIBLE_BACK_BUFFERS 16 #define IMGUI_UNLIMITED_FRAME_RATE //#ifdef _DEBUG diff --git a/imconfig.h b/imconfig.h index 824a81af..afa54914 100644 --- a/imconfig.h +++ b/imconfig.h @@ -1,7 +1,10 @@ //----------------------------------------------------------------------------- -// USER IMPLEMENTATION -// This file contains compile-time options for ImGui. -// Other options (memory allocation overrides, callbacks, etc.) can be set at runtime via the ImGuiIO structure - ImGui::GetIO(). +// COMPILE-TIME OPTIONS FOR DEAR IMGUI +// Most options (memory allocation, clipboard callbacks, etc.) can be set at runtime via the ImGuiIO structure - ImGui::GetIO(). +//----------------------------------------------------------------------------- +// A) You may edit imconfig.h (and not overwrite it when updating imgui, or maintain a patch/branch with your modifications to imconfig.h) +// B) or add configuration directives in your own file and compile with #define IMGUI_USER_CONFIG "myfilename.h" +// Note that options such as IMGUI_API, IM_VEC2_CLASS_EXTRA or ImDrawIdx needs to be defined consistently everywhere you include imgui.h, not only for the imgui*.cpp compilation units. //----------------------------------------------------------------------------- #pragma once @@ -13,30 +16,31 @@ //#define IMGUI_API __declspec( dllexport ) //#define IMGUI_API __declspec( dllimport ) -//---- Don't define obsolete functions names. Consider enabling from time to time or when updating to reduce like hood of using already obsolete function/names +//---- Don't define obsolete functions names. Consider enabling from time to time or when updating to reduce likelihood of using already obsolete function/names //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS -//---- Include imgui_user.h at the end of imgui.h -//#define IMGUI_INCLUDE_IMGUI_USER_H - -//---- Don't implement default handlers for Windows (so as not to link with OpenClipboard() and others Win32 functions) -//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS -//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS +//---- Don't implement default handlers for Windows (so as not to link with certain functions) +//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // Don't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. +//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // Don't use and link with ImmGetContext/ImmSetCompositionWindow. //---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty) -//---- It is very strongly recommended to NOT disable the demo windows. Please read the comment at the top of imgui_demo.cpp to learn why. +//---- It is very strongly recommended to NOT disable the demo windows. Please read the comment at the top of imgui_demo.cpp. //#define IMGUI_DISABLE_DEMO_WINDOWS //---- Don't implement ImFormatString(), ImFormatStringV() so you can reimplement them yourself. //#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS -//---- Pack colors to BGRA instead of RGBA (remove need to post process vertex buffer in back ends) +//---- Include imgui_user.h at the end of imgui.h as a convenience +//#define IMGUI_INCLUDE_IMGUI_USER_H + +//---- Pack colors to BGRA8 instead of RGBA8 (if you needed to convert from one to another anyway) //#define IMGUI_USE_BGRA_PACKED_COLOR -//---- Implement STB libraries in a namespace to avoid linkage conflicts +//---- Implement STB libraries in a namespace to avoid linkage conflicts (defaults to global namespace) //#define IMGUI_STB_NAMESPACE ImGuiStb //---- Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4. +// This will be inlined as part of ImVec2 and ImVec4 class declarations. /* #define IM_VEC2_CLASS_EXTRA \ ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ @@ -47,15 +51,13 @@ operator MyVec4() const { return MyVec4(x,y,z,w); } */ -//---- Use 32-bit vertex indices (instead of default: 16-bit) to allow meshes with more than 64K vertices +//---- Use 32-bit vertex indices (instead of default 16-bit) to allow meshes with more than 64K vertices. Render function needs to support it. //#define ImDrawIdx unsigned int //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. -//---- e.g. create variants of the ImGui::Value() helper for your low-level math types, or your own widgets/helpers. /* namespace ImGui { - void Value(const char* prefix, const MyMatrix44& v, const char* float_format = NULL); + void MyFunction(const char* name, const MyMatrix44& v); } */ - diff --git a/imgui.h b/imgui.h index 9d3a5690..24831dba 100644 --- a/imgui.h +++ b/imgui.h @@ -8,9 +8,14 @@ #pragma once +// User-editable configuration files (edit stock imconfig.h or define IMGUI_USER_CONFIG to your own filename) +#ifdef IMGUI_USER_CONFIG +#include IMGUI_USER_CONFIG +#endif #if !defined(IMGUI_DISABLE_INCLUDE_IMCONFIG_H) || defined(IMGUI_INCLUDE_IMCONFIG_H) -#include "imconfig.h" // User-editable configuration file +#include "imconfig.h" #endif + #include // FLT_MAX #include // va_list #include // ptrdiff_t, NULL @@ -1130,6 +1135,7 @@ public: Capacity = new_capacity; } + // NB: &v cannot be pointing inside the ImVector Data itself! e.g. v.push_back(v[10]) is forbidden. inline void push_back(const value_type& v) { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); Data[Size++] = v; } inline void pop_back() { IM_ASSERT(Size > 0); Size--; } inline void push_front(const value_type& v) { if (Size == 0) push_back(v); else insert(Data, v); }