Browse Source

Fix for issue #11, added C++ guards

shared-context
Mikko Mononen 11 years ago
parent
commit
39602081e8
4 changed files with 44 additions and 14 deletions
  1. +8
    -0
      example/demo.h
  2. +19
    -13
      src/nanovg.h
  3. +9
    -1
      src/nanovg_gl2.h
  4. +8
    -0
      src/nanovg_gl3.h

+ 8
- 0
example/demo.h View File

@@ -3,6 +3,10 @@


#include "nanovg.h" #include "nanovg.h"


#ifdef __cplusplus
extern "C" {
#endif

struct DemoData { struct DemoData {
int fontNormal, fontBold, fontIcons; int fontNormal, fontBold, fontIcons;
int images[12]; int images[12];
@@ -23,4 +27,8 @@ void initFPS(struct FPScounter* fps);
void updateFPS(struct FPScounter* fps, float frameTime); void updateFPS(struct FPScounter* fps, float frameTime);
void renderFPS(struct NVGcontext* vg, float x, float y, struct FPScounter* fps); void renderFPS(struct NVGcontext* vg, float x, float y, struct FPScounter* fps);


#ifdef __cplusplus
}
#endif

#endif // WIDGETS_H #endif // WIDGETS_H

+ 19
- 13
src/nanovg.h View File

@@ -19,10 +19,25 @@
#ifndef NANOVG_H #ifndef NANOVG_H
#define NANOVG_H #define NANOVG_H


#ifdef __cplusplus
extern "C" {
#endif

#define NVG_PI 3.14159265358979323846264338327f #define NVG_PI 3.14159265358979323846264338327f


struct NVGcontext; 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 { enum NVGwinding {
NVG_CCW = 1, // Winding for solid shapes NVG_CCW = 1, // Winding for solid shapes
@@ -355,18 +370,6 @@ enum NVGtexture {
NVG_TEXTURE_RGBA = 0x02, 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 struct NVGscissor
{ {
float xform[6]; float xform[6];
@@ -410,5 +413,8 @@ struct NVGcontext* nvgCreateInternal(struct NVGparams* params);
void nvgDeleteInternal(struct NVGcontext* ctx); void nvgDeleteInternal(struct NVGcontext* ctx);




#ifdef __cplusplus
}
#endif


#endif // NANOVG_H #endif // NANOVG_H

+ 9
- 1
src/nanovg_gl2.h View File

@@ -18,9 +18,17 @@
#ifndef NANOVG_GL2_H #ifndef NANOVG_GL2_H
#define NANOVG_GL2_H #define NANOVG_GL2_H


#ifdef __cplusplus
extern "C" {
#endif

struct NVGcontext* nvgCreateGL2(); struct NVGcontext* nvgCreateGL2();
void nvgDeleteGL2(struct NVGcontext* ctx); void nvgDeleteGL2(struct NVGcontext* ctx);


#ifdef __cplusplus
}
#endif

#endif #endif


#ifdef NANOVG_GL2_IMPLEMENTATION #ifdef NANOVG_GL2_IMPLEMENTATION
@@ -522,7 +530,7 @@ static void glnvg__renderFill(void* uptr, struct NVGpaint* paint, struct NVGscis
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);


} else { } else {
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);


glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);


+ 8
- 0
src/nanovg_gl3.h View File

@@ -18,9 +18,17 @@
#ifndef NANOVG_GL3_H #ifndef NANOVG_GL3_H
#define NANOVG_GL3_H #define NANOVG_GL3_H


#ifdef __cplusplus
extern "C" {
#endif

struct NVGcontext* nvgCreateGL3(); struct NVGcontext* nvgCreateGL3();
void nvgDeleteGL3(struct NVGcontext* ctx); void nvgDeleteGL3(struct NVGcontext* ctx);


#ifdef __cplusplus
}
#endif

#endif #endif


#ifdef NANOVG_GL3_IMPLEMENTATION #ifdef NANOVG_GL3_IMPLEMENTATION


Loading…
Cancel
Save