[nostalgia] Add scaffolding for ImGui
This commit is contained in:
parent
63e46d7bb4
commit
bae1f05038
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
.clangd
|
.clangd
|
||||||
.current_build
|
.current_build
|
||||||
scripts/__pycache__
|
scripts/__pycache__
|
||||||
|
deps/imgui/src
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
build
|
build
|
||||||
.conanbuild
|
.conanbuild
|
||||||
|
@ -44,12 +44,19 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(deps/ox)
|
add_subdirectory(deps/ox)
|
||||||
include_directories(SYSTEM deps/ox/src)
|
include_directories(
|
||||||
|
SYSTEM
|
||||||
|
deps/imgui/src
|
||||||
|
deps/ox/src
|
||||||
|
)
|
||||||
|
|
||||||
if(BUILDCORE_TARGET STREQUAL "gba")
|
if(BUILDCORE_TARGET STREQUAL "gba")
|
||||||
add_subdirectory(deps/gbastartup)
|
add_subdirectory(deps/gbastartup)
|
||||||
elseif(NOSTALGIA_BUILD_STUDIO)
|
else()
|
||||||
add_subdirectory(deps/QDark)
|
if(NOSTALGIA_BUILD_STUDIO)
|
||||||
|
add_subdirectory(deps/QDark)
|
||||||
|
endif()
|
||||||
|
add_subdirectory(deps/imgui)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
@ -2,7 +2,13 @@ from conans import ConanFile, CMake
|
|||||||
|
|
||||||
class NostalgiaConan(ConanFile):
|
class NostalgiaConan(ConanFile):
|
||||||
settings = 'os', 'compiler', 'build_type', 'arch'
|
settings = 'os', 'compiler', 'build_type', 'arch'
|
||||||
requires = 'jsoncpp/1.9.4', 'glfw/3.3.4'
|
requires = 'jsoncpp/1.9.4', 'glfw/3.3.4', 'imgui/1.82'
|
||||||
generators = 'cmake', 'cmake_find_package', 'cmake_paths'
|
generators = 'cmake', 'cmake_find_package', 'cmake_paths'
|
||||||
default_options = {
|
default_options = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def imports(self):
|
||||||
|
self.copy('imgui_impl_glfw.cpp', dst='../deps/imgui/src', src='./res/bindings')
|
||||||
|
self.copy('imgui_impl_opengl3.cpp', dst='../deps/imgui/src', src='./res/bindings')
|
||||||
|
self.copy('imgui_impl_glfw.h', dst='../deps/imgui/src', src='./res/bindings')
|
||||||
|
self.copy('imgui_impl_opengl3.h', dst='../deps/imgui/src', src='./res/bindings')
|
||||||
|
40
deps/imgui/CMakeLists.txt
vendored
Normal file
40
deps/imgui/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
add_library(
|
||||||
|
imgui-glfw
|
||||||
|
src/imgui_impl_glfw.cpp
|
||||||
|
src/imgui_impl_opengl3.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package(glfw3 REQUIRED)
|
||||||
|
find_package(imgui REQUIRED)
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
target_compile_definitions(
|
||||||
|
imgui-glfw PRIVATE
|
||||||
|
IMGUI_IMPL_OPENGL_LOADER_CUSTOM="OpenGL/gl3.h"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(
|
||||||
|
imgui-glfw PUBLIC
|
||||||
|
${OPENGL_gl_LIBRARY}
|
||||||
|
glfw::glfw
|
||||||
|
imgui::imgui
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT MSVC)
|
||||||
|
target_compile_options(
|
||||||
|
imgui-glfw PRIVATE
|
||||||
|
-Wno-all
|
||||||
|
-Wno-extra
|
||||||
|
-Wno-old-style-cast
|
||||||
|
-Wno-deprecated-declarations
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(
|
||||||
|
TARGETS
|
||||||
|
imgui-glfw
|
||||||
|
DESTINATION
|
||||||
|
LIBRARY DESTINATION lib/nostalgia
|
||||||
|
ARCHIVE DESTINATION lib/nostalgia
|
||||||
|
)
|
@ -5,10 +5,20 @@ add_library(
|
|||||||
)
|
)
|
||||||
|
|
||||||
find_package(glfw3 REQUIRED)
|
find_package(glfw3 REQUIRED)
|
||||||
|
find_package(imgui REQUIRED)
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
else()
|
||||||
|
set(OPENGL_gl_LIBRARY GL)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
NostalgiaCore-GLFW PUBLIC
|
NostalgiaCore-GLFW PUBLIC
|
||||||
|
${OPENGL_gl_LIBRARY}
|
||||||
glfw::glfw
|
glfw::glfw
|
||||||
|
imgui::imgui
|
||||||
|
imgui-glfw
|
||||||
NostalgiaGlUtils
|
NostalgiaGlUtils
|
||||||
NostalgiaCore-Userspace
|
NostalgiaCore-Userspace
|
||||||
)
|
)
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
namespace nostalgia::core {
|
namespace nostalgia::core {
|
||||||
|
|
||||||
struct GlfwImplData {
|
struct GlfwImplData {
|
||||||
class GLFWwindow *window = nullptr;
|
struct GLFWwindow *window = nullptr;
|
||||||
int64_t startTime = 0;
|
int64_t startTime = 0;
|
||||||
bool running = false;
|
bool running = false;
|
||||||
event_handler eventHandler = nullptr;
|
event_handler eventHandler = nullptr;
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
#include <imgui.h>
|
||||||
|
#include <imgui_impl_glfw.h>
|
||||||
|
|
||||||
#include <nostalgia/core/userland/gfx.hpp>
|
#include <nostalgia/core/userland/gfx.hpp>
|
||||||
|
|
||||||
@ -37,6 +39,7 @@ ox::Error initGfx(Context *ctx) noexcept {
|
|||||||
glfwSetWindowUserPointer(id->window, ctx);
|
glfwSetWindowUserPointer(id->window, ctx);
|
||||||
glfwMakeContextCurrent(id->window);
|
glfwMakeContextCurrent(id->window);
|
||||||
oxReturnError(renderer::init(ctx));
|
oxReturnError(renderer::init(ctx));
|
||||||
|
ImGui_ImplGlfw_InitForOpenGL(id->window, true);
|
||||||
return OxError(0);
|
return OxError(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user