[nostaliga/core] Add Drawer system and make ImGui use configurable

This commit is contained in:
2021-07-17 18:13:28 -05:00
parent d3a3d57773
commit 0420dfb545
6 changed files with 65 additions and 23 deletions
+10 -10
View File
@@ -7,9 +7,8 @@
*/
#include <GLFW/glfw3.h>
#include <imgui.h>
#include <imgui_impl_glfw.h>
#include <nostalgia/core/config.hpp>
#include <nostalgia/core/userland/gfx.hpp>
#include "core.hpp"
@@ -38,14 +37,15 @@ ox::Error initGfx(Context *ctx) noexcept {
}
glfwSetWindowUserPointer(id->window, ctx);
glfwMakeContextCurrent(id->window);
IMGUI_CHECKVERSION();
ImGui::CreateContext();
auto &io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
io.MouseDrawCursor = true;
ImGui_ImplGlfw_InitForOpenGL(id->window, true);
oxReturnError(renderer::init(ctx));
return OxError(0);
if constexpr(config::ImGuiEnabled) {
IMGUI_CHECKVERSION();
ImGui::CreateContext();
auto &io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
io.MouseDrawCursor = true;
ImGui_ImplGlfw_InitForOpenGL(id->window, true);
}
return renderer::init(ctx);
}
ox::Error shutdownGfx(Context *ctx) noexcept {