/* Copyright (c) 2025 Quinn. * This is a file from the project MCA-Selector-Lite and is * licensed under the MIT Licence. See the project's LICENSE file for details. */ #include #include #include #include #include "io/win/window.h" #include "util/error.h" /* reroutes GLFW errors to our logging system. */ static void error_callback(int err, const char *const msg) { error("glfw returned (%i); \"%s\"", err, msg); } static void quit(void) { window_free(); /* terminates GLFW; destroying any * remaining windows, or other resources held by GLFW. */ glfwTerminate(); } /* Entry-point of the application. */ int main(int argc, char **argv) { (void)argc, (void)argv; printf("debug: [DBG], info: [INF], warning: [WAR], error: [ERR], fatal: [FAT]\n"); atexit(quit); glfwSetErrorCallback(error_callback); glfwInitHint(GLFW_JOYSTICK_HAT_BUTTONS, GLFW_FALSE); // disable joystick buttons; since we won't need them if (!glfwInit() || window_init()) fatal("failed to initialise!"); window_loop(); /* return success, since some architectures do not follow 0=success * This action will call `quit`. */ return EXIT_SUCCESS; }