From c960c46564bcaf92e73facb3647aa8da6651cde6 Mon Sep 17 00:00:00 2001 From: Olli Wang Date: Fri, 5 Aug 2016 15:51:56 +0800 Subject: [PATCH] Moves additional bgfx nanovg functions to a separate header file. This commit moves the additional nanovg functions for bgfx to a separate header file, so it is possible to compile the original nanovg source files with bgfx in a custom build environment. --- examples/common/nanovg/nanovg.h | 8 ++------ examples/common/nanovg/nanovg_bgfx.cpp | 4 ++++ examples/common/nanovg/nanovg_bgfx.h | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 examples/common/nanovg/nanovg_bgfx.h diff --git a/examples/common/nanovg/nanovg.h b/examples/common/nanovg/nanovg.h index 692d1bd2b..7bf504149 100644 --- a/examples/common/nanovg/nanovg.h +++ b/examples/common/nanovg/nanovg.h @@ -19,6 +19,8 @@ #ifndef NANOVG_H #define NANOVG_H +#include "nanovg_bgfx.h" + #ifdef __cplusplus extern "C" { #endif @@ -598,12 +600,6 @@ struct NVGparams { }; typedef struct NVGparams NVGparams; -namespace bx { struct AllocatorI; } - -NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId, bx::AllocatorI* _allocator = NULL); -void nvgViewId(struct NVGcontext* ctx, unsigned char _viewId); -void nvgDelete(struct NVGcontext* ctx); - // Constructor and destructor, called by the render back-end. NVGcontext* nvgCreateInternal(NVGparams* params); void nvgDeleteInternal(NVGcontext* ctx); diff --git a/examples/common/nanovg/nanovg_bgfx.cpp b/examples/common/nanovg/nanovg_bgfx.cpp index e5795ad21..9c426f8e2 100644 --- a/examples/common/nanovg/nanovg_bgfx.cpp +++ b/examples/common/nanovg/nanovg_bgfx.cpp @@ -1088,6 +1088,10 @@ error: return NULL; } +NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId) { + return nvgCreate(edgeaa, _viewId, NULL); +} + void nvgViewId(struct NVGcontext* ctx, unsigned char _viewId) { struct NVGparams* params = nvgInternalParams(ctx); diff --git a/examples/common/nanovg/nanovg_bgfx.h b/examples/common/nanovg/nanovg_bgfx.h new file mode 100644 index 000000000..d24ee4fa7 --- /dev/null +++ b/examples/common/nanovg/nanovg_bgfx.h @@ -0,0 +1,18 @@ +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#ifndef NANOVG_BGFX_H_HEADER_GUARD +#define NANOVG_BGFX_H_HEADER_GUARD + +namespace bx { struct AllocatorI; } + +struct NVGcontext; + +NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId, bx::AllocatorI* _allocator); +NVGcontext* nvgCreate(int edgeaa, unsigned char _viewId); +void nvgViewId(struct NVGcontext* ctx, unsigned char _viewId); +void nvgDelete(struct NVGcontext* ctx); + +#endif // NANOVG_BGFX_H_HEADER_GUARD