[nostalgia] Collapse NostalgiaCore down to a single library and cleanup impl data access
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
add_library(
|
||||
NostalgiaCore-GLFW
|
||||
clipboard.cpp
|
||||
core.cpp
|
||||
gfx.cpp
|
||||
)
|
||||
|
||||
find_package(glfw3 REQUIRED)
|
||||
find_package(imgui REQUIRED)
|
||||
|
||||
if(APPLE)
|
||||
find_package(OpenGL REQUIRED)
|
||||
else()
|
||||
set(OPENGL_gl_LIBRARY GL)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
NostalgiaCore-GLFW PUBLIC
|
||||
${OPENGL_gl_LIBRARY}
|
||||
glfw::glfw
|
||||
imgui::imgui
|
||||
imgui-glfw
|
||||
NostalgiaGlUtils
|
||||
NostalgiaCore-Userspace
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
NostalgiaCore-GLFW
|
||||
DESTINATION
|
||||
LIBRARY DESTINATION lib/nostalgia
|
||||
ARCHIVE DESTINATION lib/nostalgia
|
||||
)
|
||||
@@ -68,9 +68,10 @@ bool buttonDown(Key) noexcept {
|
||||
return false;
|
||||
}
|
||||
|
||||
void shutdown(Context *ctx) noexcept {
|
||||
ox::Error shutdown(Context *ctx) noexcept {
|
||||
const auto id = ctx->windowerData<GlfwImplData>();
|
||||
glfwSetWindowShouldClose(id->window, true);
|
||||
return OxError(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,18 +16,14 @@ namespace nostalgia::core {
|
||||
constexpr auto Scale = 5;
|
||||
|
||||
static void handleGlfwError(int err, const char *desc) noexcept {
|
||||
oxErrf("GLFW error ({}): {}\n", err, desc);
|
||||
}
|
||||
|
||||
void ImGui_Impl_NewFrame() noexcept {
|
||||
ImGui_ImplGlfw_NewFrame();
|
||||
oxErrf("GLFW error ({}): {}\n", err, desc);
|
||||
}
|
||||
|
||||
static void handleKeyPress(Context *ctx, int key) noexcept {
|
||||
switch (key) {
|
||||
case GLFW_KEY_ESCAPE:
|
||||
case GLFW_KEY_Q:
|
||||
shutdown(ctx);
|
||||
oxIgnoreError(shutdown(ctx));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -41,6 +37,10 @@ static void handleGlfwKeyEvent(GLFWwindow *window, int key, int, int action, int
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui_Impl_NewFrame() noexcept {
|
||||
ImGui_ImplGlfw_NewFrame();
|
||||
}
|
||||
|
||||
ox::Error initGfx(Context *ctx) noexcept {
|
||||
auto id = ctx->windowerData<GlfwImplData>();
|
||||
glfwSetErrorCallback(handleGlfwError);
|
||||
|
||||
Reference in New Issue
Block a user