mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-17 09:25:44 +01:00
rework logging to be more optimised, and some minor improvements.
removed function definitions and opted for using macros instead. It now does not have a set limit when it comes to printing (at least, it's the stdc's limit again). However, it is now no longer possible to use a character pointer to print information to the screen.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#undef GLAD_GL_IMPLEMENTATION
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "error.h"
|
||||
@@ -15,6 +16,11 @@
|
||||
#define WIN_DEFAULT_WIDTH 640
|
||||
#define WIN_DEFAULT_HEIGHT 480
|
||||
|
||||
// callback for GLFW errors
|
||||
static void error_callback(int err, char const* const msg) {
|
||||
fprintf(stderr, "\033[91mE: glfw returned (%i); \"%s\"\033[0m\n", err, msg);
|
||||
}
|
||||
|
||||
static inline int init(void) {
|
||||
glfwSetErrorCallback(error_callback);
|
||||
glfwInitHint(GLFW_JOYSTICK_HAT_BUTTONS, GLFW_FALSE); // disable joystick buttons
|
||||
@@ -31,7 +37,7 @@ static inline void quit(void) {
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
(void)argc, (void)argv;
|
||||
|
||||
printf("debug: [DBG], info: [INF], warning: [WAR], error: [ERR], fatal: [FAT]\n");
|
||||
if (init()) fatal("failed to initialize!");
|
||||
|
||||
window_loop();
|
||||
|
||||
Reference in New Issue
Block a user