diff --git a/example/demo.h b/example/demo.h index 08f3a56..38a0a58 100644 --- a/example/demo.h +++ b/example/demo.h @@ -3,6 +3,10 @@ #include "nanovg.h" +#ifdef __cplusplus +extern "C" { +#endif + struct DemoData { int fontNormal, fontBold, fontIcons; int images[12]; @@ -23,4 +27,8 @@ void initFPS(struct FPScounter* fps); void updateFPS(struct FPScounter* fps, float frameTime); void renderFPS(struct NVGcontext* vg, float x, float y, struct FPScounter* fps); +#ifdef __cplusplus +} +#endif + #endif // WIDGETS_H \ No newline at end of file diff --git a/src/nanovg.h b/src/nanovg.h index fabe79c..72a4c17 100644 --- a/src/nanovg.h +++ b/src/nanovg.h @@ -19,10 +19,25 @@ #ifndef NANOVG_H #define NANOVG_H +#ifdef __cplusplus +extern "C" { +#endif + #define NVG_PI 3.14159265358979323846264338327f struct NVGcontext; -struct NVGpaint; + +struct NVGpaint +{ + float xform[6]; + float extent[2]; + float radius; + float feather; + unsigned int innerColor; + unsigned int outerColor; + int image; + int repeat; +}; enum NVGwinding { NVG_CCW = 1, // Winding for solid shapes @@ -355,18 +370,6 @@ enum NVGtexture { NVG_TEXTURE_RGBA = 0x02, }; -struct NVGpaint -{ - float xform[6]; - float extent[2]; - float radius; - float feather; - unsigned int innerColor; - unsigned int outerColor; - int image; - int repeat; -}; - struct NVGscissor { float xform[6]; @@ -410,5 +413,8 @@ struct NVGcontext* nvgCreateInternal(struct NVGparams* params); void nvgDeleteInternal(struct NVGcontext* ctx); +#ifdef __cplusplus +} +#endif #endif // NANOVG_H diff --git a/src/nanovg_gl2.h b/src/nanovg_gl2.h index 25272e8..ee630d0 100644 --- a/src/nanovg_gl2.h +++ b/src/nanovg_gl2.h @@ -18,9 +18,17 @@ #ifndef NANOVG_GL2_H #define NANOVG_GL2_H +#ifdef __cplusplus +extern "C" { +#endif + struct NVGcontext* nvgCreateGL2(); void nvgDeleteGL2(struct NVGcontext* ctx); +#ifdef __cplusplus +} +#endif + #endif #ifdef NANOVG_GL2_IMPLEMENTATION @@ -522,7 +530,7 @@ static void glnvg__renderFill(void* uptr, struct NVGpaint* paint, struct NVGscis glDisable(GL_TEXTURE_2D); } else { - + glEnable(GL_CULL_FACE); glEnableClientState(GL_VERTEX_ARRAY); diff --git a/src/nanovg_gl3.h b/src/nanovg_gl3.h index 1975f5c..425fd85 100644 --- a/src/nanovg_gl3.h +++ b/src/nanovg_gl3.h @@ -18,9 +18,17 @@ #ifndef NANOVG_GL3_H #define NANOVG_GL3_H +#ifdef __cplusplus +extern "C" { +#endif + struct NVGcontext* nvgCreateGL3(); void nvgDeleteGL3(struct NVGcontext* ctx); +#ifdef __cplusplus +} +#endif + #endif #ifdef NANOVG_GL3_IMPLEMENTATION