-
Notifications
You must be signed in to change notification settings - Fork 149
feat(gameclient): Introduce imgui framework #2127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7a118ef
019af6d
a7806a8
38407bf
34d99c4
9865b8d
821222b
f41c6d5
731da38
67a4645
8f9f434
34e3752
dada1a4
4361776
473f9d7
dd8541a
a23ab53
0b25693
86a0677
34374cb
3adbc7a
56c92d7
d0db383
39de6fc
3f7f17e
cec768f
ebc7fad
1558483
d288d6e
d086853
22b9274
ca0b995
ff01f44
e9a36e6
94124e3
34a4dc6
21171d1
32a61c4
17a3000
a4957f7
e916ac7
eb43457
abe01e0
f142bcd
2eeab3f
1a575df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| FetchContent_Declare( | ||
| imgui | ||
| GIT_REPOSITORY https://github.com/ocornut/imgui.git | ||
| GIT_TAG 791ad9b82db44ada9fedb3e26b2d900974ac0959 | ||
| SYSTEM | ||
| ) | ||
|
|
||
| FetchContent_MakeAvailable(imgui) | ||
|
|
||
| # Main IMGUI sources we are going to need | ||
| set(IMGUI_BASE_SRCS | ||
| "${imgui_SOURCE_DIR}/imgui.cpp" | ||
| "${imgui_SOURCE_DIR}/imgui_draw.cpp" | ||
| "${imgui_SOURCE_DIR}/imgui_tables.cpp" | ||
| "${imgui_SOURCE_DIR}/imgui_widgets.cpp" | ||
| "${imgui_SOURCE_DIR}/imgui_demo.cpp" | ||
| ) | ||
|
|
||
| # Main Win32 DX8 specific sources we are going to need we can specify more if we need extra platforms | ||
| set(IMGUI_WIN32_DX8_ALL_SRCS | ||
| "${IMGUI_BASE_SRCS}" | ||
| "${imgui_SOURCE_DIR}/backends/imgui_impl_win32.cpp" | ||
| "${CMAKE_SOURCE_DIR}/Core/Libraries/Source/ImGui/dx8_backend/imgui_impl_dx8.cpp" | ||
| ) | ||
|
|
||
| # All Include directories | ||
| set(IMGUI_INCLUDE_DIRS | ||
| "${imgui_SOURCE_DIR}" | ||
| "${imgui_SOURCE_DIR}/backends" | ||
| # DX8 override. Remove the following once we are using a standard backend | ||
| "${CMAKE_SOURCE_DIR}/Core/Libraries/Source/ImGui/dx8_backend" | ||
| ) | ||
|
|
||
| # start target build section | ||
| # we currently have a hard dependency on dx8 and win32 api | ||
| if (WIN32) | ||
| # for now we only need it in debug configurations | ||
| if ( NOT ( (CMAKE_BUILD_TYPE STREQUAL "Debug") OR RTS_BUILD_OPTION_DEBUG ) ) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is ,probably, only the case with Visual Studio (CMAKE_BUILD_TYPE probably even ignored) , similarly --config Debug is ignored in Linux/Unix or Windows/MinGW but CMAKE_BUILD_TYPE is central for these it does not only engage compiler optimizations it also automatically sets the '-g' flag for debug symbols and activates the DEBUG or _DEBUG preprocessor defines and extra stuff like bounds checking and stack corruption checks. Especially people coming from non-windows OSes would find it confusing when Cmake Debug profile is activated but they do not find themselves able to debug runtime.(which happened to me when i first started contributing here). Since ImGui is cross-platform it might make use of such conditional debugging mechanisms and assertions, so it doesn't hurt to compile with CMAKE_BUILD_TYPE as Debug on the contrary might even expose debug relevant assertions although i am not sure how ImGui works with Debug assertions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about we allow ImGui in all configurations? Simply have it guarded behind the ImGui Cmake option. It is simpler. |
||
| MESSAGE(FATAL_ERROR "ImGui is currently only available in Debug build modes") | ||
| endif () | ||
|
|
||
| MESSAGE(STATUS "Enabling ImGui") | ||
|
|
||
| add_library(lib_imgui STATIC ${IMGUI_WIN32_DX8_ALL_SRCS} | ||
| "${CMAKE_CURRENT_LIST_DIR}/wrapper/ImGuiFrameManager.cpp" | ||
| ) | ||
| target_include_directories(lib_imgui | ||
| PUBLIC ${IMGUI_INCLUDE_DIRS} | ||
| PUBLIC "${CMAKE_CURRENT_LIST_DIR}/wrapper") | ||
| target_link_libraries(lib_imgui PRIVATE d3d8lib) | ||
|
|
||
| # use our own imconfig.h | ||
| target_compile_definitions(lib_imgui | ||
| PRIVATE IMGUI_DISABLE_DEFAULT_IMCONFIG | ||
| PRIVATE IMGUI_USER_CONFIG="${CMAKE_CURRENT_LIST_DIR}/imconfig.h" | ||
| INTERFACE RTS_HAS_IMGUI | ||
| ) | ||
| else () | ||
| # currently only WIN32 DX is supported | ||
| MESSAGE(FATAL_ERROR "Non-Windows platforms currently not supported for ImGui") | ||
| endif () | ||
| # end target build section | ||
Uh oh!
There was an error while loading. Please reload this page.