mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-03-22 18:51:05 +00:00
Integrate ImGui into buildsystem, adjust its OpenGL code for qgl
This commit is contained in:
parent
07f7d14f9b
commit
33ed99902e
2 changed files with 61 additions and 3 deletions
|
@ -739,6 +739,20 @@ set(src_idlib
|
|||
|
||||
add_globbed_headers(src_idlib "idlib")
|
||||
|
||||
set(src_imgui
|
||||
libs/imgui/backends/imgui_impl_sdl2.cpp
|
||||
libs/imgui/backends/imgui_impl_opengl2.cpp
|
||||
|
||||
libs/imgui/imgui.cpp
|
||||
libs/imgui/imgui_draw.cpp
|
||||
libs/imgui/imgui_tables.cpp
|
||||
libs/imgui/imgui_widgets.cpp
|
||||
|
||||
libs/imgui/imgui_demo.cpp
|
||||
)
|
||||
|
||||
add_globbed_headers(src_imgui "libs/imgui")
|
||||
|
||||
set(src_game
|
||||
game/AF.cpp
|
||||
game/AFEntity.cpp
|
||||
|
@ -1148,6 +1162,7 @@ if(CORE)
|
|||
${src_core}
|
||||
${src_sys_base}
|
||||
${src_sys_core}
|
||||
${src_imgui}
|
||||
${src_editor_tools}
|
||||
)
|
||||
|
||||
|
@ -1156,7 +1171,9 @@ if(CORE)
|
|||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${DHEWM3BINARY})
|
||||
endif()
|
||||
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX neo FILES ${src_core} ${src_sys_base} ${src_sys_core} ${src_editor_tools})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX neo FILES ${src_core} ${src_sys_base} ${src_sys_core} ${src_imgui} ${src_editor_tools})
|
||||
|
||||
target_include_directories(${DHEWM3BINARY} PRIVATE "${CMAKE_SOURCE_DIR}/libs/imgui")
|
||||
|
||||
if(HARDLINK_GAME)
|
||||
set_target_properties(${DHEWM3BINARY} PROPERTIES COMPILE_DEFINITIONS "${TOOLS_DEFINES}")
|
||||
|
@ -1197,10 +1214,10 @@ if(DEDICATED)
|
|||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX neo FILES ${src_core} ${src_sys_base} ${src_stub_openal} ${src_stub_gl} ${src_debuggerServer})
|
||||
|
||||
if(HARDLINK_GAME)
|
||||
set_target_properties(${DHEWM3BINARY}ded PROPERTIES COMPILE_DEFINITIONS "ID_DEDICATED")
|
||||
set_target_properties(${DHEWM3BINARY}ded PROPERTIES COMPILE_DEFINITIONS "IMGUI_DISABLE;ID_DEDICATED")
|
||||
target_include_directories(${DHEWM3BINARY}ded PRIVATE ${game_includes})
|
||||
else()
|
||||
set_target_properties(${DHEWM3BINARY}ded PROPERTIES COMPILE_DEFINITIONS "ID_DEDICATED;__DOOM_DLL__")
|
||||
set_target_properties(${DHEWM3BINARY}ded PROPERTIES COMPILE_DEFINITIONS "IMGUI_DISABLE;ID_DEDICATED;__DOOM_DLL__")
|
||||
endif()
|
||||
set_target_properties(${DHEWM3BINARY}ded PROPERTIES LINK_FLAGS "${ldflags}")
|
||||
target_link_libraries(${DHEWM3BINARY}ded
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
#pragma clang diagnostic ignored "-Wnonportable-system-include-path"
|
||||
#endif
|
||||
|
||||
// DG: use qgl instead of GL/gl.h for dhewm3 (where D3_OSTYPE is always defined by CMake)
|
||||
#ifndef D3_OSTYPE
|
||||
|
||||
// Include OpenGL header (without an OpenGL loader) requires a bit of fiddling
|
||||
#if defined(_WIN32) && !defined(APIENTRY)
|
||||
#define APIENTRY __stdcall // It is customary to use APIENTRY for OpenGL function pointer declarations on all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
|
||||
|
@ -65,6 +68,44 @@
|
|||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#else // DG: use qgl
|
||||
|
||||
#include "renderer/qgl.h"
|
||||
|
||||
// creating some #defines for the used gl functions instead of adapting the code below
|
||||
// will make updating to new imgui versions easier
|
||||
#define glBindTexture qglBindTexture
|
||||
#define glBlendFunc qglBlendFunc
|
||||
#define glColorPointer qglColorPointer
|
||||
#define glDeleteTextures qglDeleteTextures
|
||||
#define glDisableClientState qglDisableClientState
|
||||
#define glDisable qglDisable
|
||||
#define glDrawElements qglDrawElements
|
||||
#define glEnableClientState qglEnableClientState
|
||||
#define glEnable qglEnable
|
||||
#define glGenTextures qglGenTextures
|
||||
#define glGetIntegerv qglGetIntegerv
|
||||
#define glGetTexEnviv qglGetTexEnviv
|
||||
#define glLoadIdentity qglLoadIdentity
|
||||
#define glMatrixMode qglMatrixMode
|
||||
#define glOrtho qglOrtho
|
||||
#define glPixelStorei qglPixelStorei
|
||||
#define glPolygonMode qglPolygonMode
|
||||
#define glPopAttrib qglPopAttrib
|
||||
#define glPopMatrix qglPopMatrix
|
||||
#define glPushAttrib qglPushAttrib
|
||||
#define glPushMatrix qglPushMatrix
|
||||
#define glScissor qglScissor
|
||||
#define glShadeModel qglShadeModel
|
||||
#define glTexCoordPointer qglTexCoordPointer
|
||||
#define glTexEnvi qglTexEnvi
|
||||
#define glTexImage2D qglTexImage2D
|
||||
#define glTexParameteri qglTexParameteri
|
||||
#define glVertexPointer qglVertexPointer
|
||||
#define glViewport qglViewport
|
||||
|
||||
#endif // DG: use qgl
|
||||
|
||||
struct ImGui_ImplOpenGL2_Data
|
||||
{
|
||||
GLuint FontTexture;
|
||||
|
|
Loading…
Reference in a new issue