mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-17 07:55:45 +01:00
add GLFW error callback
This commit is contained in:
@@ -15,6 +15,7 @@ atrb_nonnull(1) atrb_format(printf, 1, 2) static inline void info(char const*, .
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) static inline void warn(char const*, ...);
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) static inline void error(char const*, ...);
|
||||
atrb_nonnull(1) atrb_format(printf, 1, 2) noreturn static inline void fatal(char const*, ...);
|
||||
atrb_nonnull(2) static inline void error_callback(int err, char const* const msg);
|
||||
|
||||
// macro to write fmt vardiac args to buf
|
||||
#define WRITE_VA_ARGS(buf, fmt) \
|
||||
@@ -61,4 +62,9 @@ void fatal(char const* fmt, ...) {
|
||||
abort();
|
||||
}
|
||||
|
||||
// callback for GLFW errors
|
||||
void error_callback(int err, char const* const msg) {
|
||||
fprintf(stderr, "\033[91mE: glfw returned (%i); \"%s\"\033[0m\n", err, msg);
|
||||
}
|
||||
|
||||
#undef WRITE_VA_ARGS
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
struct renderdat rdat; // contains the relevant data needed for rendering, contains rubbish data until init was
|
||||
|
||||
static inline int init(void) {
|
||||
glfwSetErrorCallback(error_callback);
|
||||
glfwInitHint(GLFW_JOYSTICK_HAT_BUTTONS, GLFW_FALSE); // disable joystick buttons
|
||||
|
||||
if (!glfwInit()) return 1; // initialize GLFW
|
||||
|
||||
Reference in New Issue
Block a user