aboutsummaryrefslogtreecommitdiff
path: root/core/src/Entrypoint/Backend_OpenGL3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/Entrypoint/Backend_OpenGL3.cpp')
-rw-r--r--core/src/Entrypoint/Backend_OpenGL3.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/core/src/Entrypoint/Backend_OpenGL3.cpp b/core/src/Entrypoint/Backend_OpenGL3.cpp
index 36a0cb3..50dc78f 100644
--- a/core/src/Entrypoint/Backend_OpenGL3.cpp
+++ b/core/src/Entrypoint/Backend_OpenGL3.cpp
@@ -12,12 +12,14 @@
# define IMGUI_IMPL_OPENGL_LOADER_GLAD
# include <backend/imgui_impl_opengl3.cpp>
-class OpenGL3Backend : public RenderingBackend {
+class OpenGL3Backend : public RenderingBackend
+{
private:
GLFWwindow* mWindow;
public:
- OpenGL3Backend() {
+ OpenGL3Backend()
+ {
glfwSetErrorCallback(&GlfwErrorCallback);
if (!glfwInit()) {
throw std::runtime_error("Failed to initialize GLFW.");
@@ -57,7 +59,8 @@ public:
ImGui_ImplOpenGL3_Init(glslVersion);
}
- virtual ~OpenGL3Backend() {
+ virtual ~OpenGL3Backend()
+ {
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
@@ -66,7 +69,8 @@ public:
glfwTerminate();
}
- virtual void RunUntilWindowClose(void (*windowContent)()) {
+ virtual void RunUntilWindowClose(void (*windowContent)())
+ {
while (!glfwWindowShouldClose(mWindow)) {
glfwPollEvents();
@@ -91,12 +95,14 @@ public:
}
}
- static void GlfwErrorCallback(int errorCode, const char* message) {
+ static void GlfwErrorCallback(int errorCode, const char* message)
+ {
std::cerr << "GLFW Error " << errorCode << ": " << message << "\n";
}
};
-std::unique_ptr<RenderingBackend> RenderingBackend::CreateOpenGL3Backend() {
+std::unique_ptr<RenderingBackend> RenderingBackend::CreateOpenGL3Backend()
+{
try {
return std::make_unique<OpenGL3Backend>();
} catch (std::exception& e) {
@@ -106,7 +112,8 @@ std::unique_ptr<RenderingBackend> RenderingBackend::CreateOpenGL3Backend() {
#else // ^^ BUILD_CORE_WITH_OPENGL3_BACKEND | !BUILD_CORE_WITH_OPENGL3_BACKEND vv
-std::unique_ptr<RenderingBackend> RenderingBackend::CreateOpenGL3Backend() {
+std::unique_ptr<RenderingBackend> RenderingBackend::CreateOpenGL3Backend()
+{
return nullptr;
}