From 2c555f50786bfa3aa3428f6a6b86bbf7df72c8a8 Mon Sep 17 00:00:00 2001 From: gnieboer Date: Wed, 13 Apr 2016 19:57:46 +0300 Subject: [PATCH] Allows build on MSVC as MSVC doesn't support __attribute((format... and I needed to add glew to get it to build on windows, which then requires a glewInit() call. --- lib/fosphor/gl.c | 8 ++++++++ lib/fosphor/gl_font.h | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/fosphor/gl.c b/lib/fosphor/gl.c index 8b8fe4b..297de53 100644 --- a/lib/fosphor/gl.c +++ b/lib/fosphor/gl.c @@ -252,6 +252,14 @@ fosphor_gl_init(struct fosphor *self) if (!gl) return -ENOMEM; +#ifdef USING_GLEW + GLenum err = glewInit(); + if (GLEW_OK != err) + { + fprintf(stderr, "Glew initialization error: %s\n", glewGetErrorString(err)); + } +#endif + self->gl = gl; memset(gl, 0, sizeof(struct fosphor_gl_state)); diff --git a/lib/fosphor/gl_font.h b/lib/fosphor/gl_font.h index 4a5c230..107c14b 100644 --- a/lib/fosphor/gl_font.h +++ b/lib/fosphor/gl_font.h @@ -35,6 +35,12 @@ struct gl_font; #define GLF_FLG_LCD (1 << 0) +#ifdef _MSC_VER +#define PRINT_CHECK +#else +#define PRINT CHECK __attribute__((format(printf, 6, 7))) +#endif + enum glf_align { GLF_LEFT, @@ -60,7 +66,7 @@ void glf_draw_str(const struct gl_font *glf, void glf_printf(const struct gl_font *glf, float x, enum glf_align x_align, float y, enum glf_align y_align, - const char *fmt, ...) __attribute__((format(printf, 6, 7))); + const char *fmt, ...) PRINT_CHECK; void glf_begin(const struct gl_font *glf, float fg_color[3]); void glf_end(void); -- 2.7.1.windows.1