Skip to content

Commit e9f7cb3

Browse files
committed
support for glfw-dx11-imgui
1 parent 69f3df7 commit e9f7cb3

33 files changed

+14547
-5987
lines changed

CMakeLists.txt

+14-10
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
3030
# LOOK for the packages that we need! #
3131
#######################################
3232

33+
# Define the include DIRs
34+
include_directories(
35+
"${CMAKE_SOURCE_DIR}/src"
36+
"${CMAKE_SOURCE_DIR}/include"
37+
"${CMAKE_SOURCE_DIR}/include/imgui"
38+
"${CMAKE_SOURCE_DIR}/include/glad"
39+
"${CMAKE_SOURCE_DIR}/include/glm"
40+
"${CMAKE_SOURCE_DIR}/include/ImGuizmo"
41+
)
42+
3343
# OpenGL
3444
set(OpenGL_GL_PREFERENCE GLVND)
3545
find_package(OpenGL REQUIRED)
@@ -68,18 +78,12 @@ add_library(IMGUIZMO "thirdparty/ImGuizmo.cpp")
6878
find_library(COMCTL32 Comctl32.lib)
6979
find_library(PROPSYS Propsys.lib)
7080
find_library(SHLWAPI Shlwapi.lib)
81+
find_library(D3D11 d3d11.lib)
82+
find_library(D3D11COMPILER d3dcompiler.lib)
83+
find_library(DXGI dxgi.lib)
7184

7285
# Put all libraries into a variable
73-
set(LIBS ${GLFW3_LIBRARY} ${OPENGL_LIBRARY} IMGUI GLAD ${CMAKE_DL_LIBS} ${ASSIMP_LIBRARY} STB_IMAGE STB_IMAGE_WRITE TINYEXR IMGUIZMO ${COMCTL32} ${PROPSYS} ${SHLWAPI})
74-
75-
# Define the include DIRs
76-
include_directories(
77-
"${CMAKE_SOURCE_DIR}/src"
78-
"${CMAKE_SOURCE_DIR}/include"
79-
"${CMAKE_SOURCE_DIR}/include/glad"
80-
"${CMAKE_SOURCE_DIR}/include/glm"
81-
"${CMAKE_SOURCE_DIR}/include/ImGuizmo"
82-
)
86+
set(LIBS ${GLFW3_LIBRARY} ${OPENGL_LIBRARY} IMGUI GLAD ${CMAKE_DL_LIBS} ${ASSIMP_LIBRARY} STB_IMAGE STB_IMAGE_WRITE TINYEXR IMGUIZMO ${COMCTL32} ${PROPSYS} ${SHLWAPI} ${D3D11} ${D3D11COMPILER} ${DXGI})
8387

8488
# Define the link libraries
8589
target_link_libraries(${PROJECT_NAME} ${LIBS})

include/imgui/imconfig.h

+13-16
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@
2828

2929
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
3030
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
31+
//#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions.
3132

32-
//---- Disable all of Dear ImGui or don't implement standard windows.
33-
// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp.
33+
//---- Disable all of Dear ImGui or don't implement standard windows/tools.
34+
// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp.
3435
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
35-
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended.
36-
//#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger window: ShowMetricsWindow() will be empty.
36+
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty.
37+
//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowStackToolWindow() will be empty (this was called IMGUI_DISABLE_METRICS_WINDOW before 1.88).
3738

3839
//---- Don't implement some functions to reduce linkage requirements.
3940
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
@@ -61,12 +62,13 @@
6162
// By default the embedded implementations are declared static and not available outside of Dear ImGui sources files.
6263
//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
6364
//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
65+
//#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if enabled
6466
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
6567
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
6668

67-
//---- Use stb_printf's faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined)
68-
// Requires 'stb_sprintf.h' to be available in the include path. Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by STB sprintf.
69-
// #define IMGUI_USE_STB_SPRINTF
69+
//---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined)
70+
// Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h.
71+
//#define IMGUI_USE_STB_SPRINTF
7072

7173
//---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui)
7274
// Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided).
@@ -80,12 +82,12 @@
8082
//---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
8183
// This will be inlined as part of ImVec2 and ImVec4 class declarations.
8284
/*
83-
#define IM_VEC2_CLASS_EXTRA \
84-
ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
85+
#define IM_VEC2_CLASS_EXTRA \
86+
constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \
8587
operator MyVec2() const { return MyVec2(x,y); }
8688
87-
#define IM_VEC4_CLASS_EXTRA \
88-
ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
89+
#define IM_VEC4_CLASS_EXTRA \
90+
constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \
8991
operator MyVec4() const { return MyVec4(x,y,z,w); }
9092
*/
9193

@@ -106,11 +108,6 @@
106108
//#define IM_DEBUG_BREAK IM_ASSERT(0)
107109
//#define IM_DEBUG_BREAK __debugbreak()
108110

109-
//---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(),
110-
// (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.)
111-
// This adds a small runtime cost which is why it is not enabled by default.
112-
//#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX
113-
114111
//---- Debug Tools: Enable slower asserts
115112
//#define IMGUI_DEBUG_PARANOID
116113

0 commit comments

Comments
 (0)