error callback

This commit is contained in:
Benjamin Palko 2024-09-04 09:10:05 -04:00
parent 9d9b801cfc
commit 30869c4d2e

View file

@ -2,7 +2,7 @@
#include <fmt/core.h> #include <fmt/core.h>
void error_callback(int error_code, const char *description) { void error_callback(int error_code, const char *description) {
fmt::print("[ERROR - {}] {}", error_code, *description); fmt::print("[ERROR - {}] {}\n", error_code, description);
} }
void key_callback(GLFWwindow *window, int key, int scancode, int action, void key_callback(GLFWwindow *window, int key, int scancode, int action,
@ -15,6 +15,8 @@ void key_callback(GLFWwindow *window, int key, int scancode, int action,
int main() { int main() {
glfwSetErrorCallback(error_callback);
int supported = glfwPlatformSupported(GLFW_PLATFORM_WAYLAND); int supported = glfwPlatformSupported(GLFW_PLATFORM_WAYLAND);
fmt::print("Wayland support: {}\n", supported == GLFW_TRUE); fmt::print("Wayland support: {}\n", supported == GLFW_TRUE);
@ -32,7 +34,6 @@ int main() {
return -1; return -1;
} }
glfwSetErrorCallback(error_callback);
glfwSetKeyCallback(window, key_callback); glfwSetKeyCallback(window, key_callback);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
glClearColor(0.4f, 0.3f, 0.4f, 0.0f); glClearColor(0.4f, 0.3f, 0.4f, 0.0f);