bindbc-bgfx ~master

Dynamic and static D bindings for bgfx.


To use this package, run the following command in your project's root directory:

bindbc-bgfx

Dynamic and static D bindings for bgfx.

These bindings target bgfx API version 108 (commit ecb0143a40a4888465ad22f128b45bf6505e644b).

Usage (DUB)

To install this library with DUB, simply run the following command:

dub add bindbc-bgfx

The library is configured to dynamic configuration by default, and should work out of box if you have the dynamic library installed properly (e.g. on Windows, the .DLL files are accessible by the application).

Static bindings

For static linking, static configuration must be enabled:

dub.json

"subConfigurations": {
	"bindbc-bgfx": "static"
},

"libs": [
	"bgfxRelease", "bxRelease", "bimgRelease"
]

Make sure to link against all the necessary system libraries needed by bgfx, and setup the library paths for linker:

"libs-windows": [
	"User32", "Gdi32"
],
"lflags-windows": [
	"/LIBPATH:example\\path\\to\\bgfx\\.build\\win64_vs2019\\bin\\"
],

"libs-linux": [
	"stdc++", "GL", "X11"
],
"lflags-linux": [
	"-L/example/path/to/bgfx/bgfx/.build/linux64_gcc/bin"
]

The bindings also support -betterC, which can be enabled with staticBC and dynamicBC configurations.

Usage

import bindbc.bgfx;

loadBgfx(); // required with dynamically linked bgfx

bgfx_init_t init;
bgfx_init_ctor(&init);

bgfx_init(&init);
bgfx_reset(1280, 720, BGFX_RESET_NONE, init.resolution.format);

bgfx_shutdown();

unloadBgfx(); // optional, only needed with dynamically linked bgfx

This is a very simple sample of how to use these bindings with bgfx. The sample code does not render or output anything but merely demonstrates how the bindings are initialized for proper use. To setup a window, libraries like SDL2 are often used with bgfx to provide the window for bgfx to use with rendering. Please see this C++ example on how to setup bgfx with SDL2.

If you need more in-depth tutorial of how to use bgfx, please see the bgfx examples here.

Generating bindings

The main bgfx repository already contains the latest generated binding definitions for D, so these files can be copied from bgfx/bindings/d/ over the files in bindbc-bgfx/source/bindbc/bgfx when pairing these bindings with custom versions of bgfx. If you need to regenerate the bindings, you can run genie idl in bgfx project folder, and copy the regenerated files to previously mentioned location.

Authors:
  • Ari Vuollet
Dependencies:
none
Versions:
0.4.0+108 2020-Jul-25
0.3.1+106 2020-May-30
0.3.0+106 2020-May-23
0.2.0+104 2020-Mar-21
0.1.1 2019-Oct-08
Show all 7 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 5 downloads this month

  • 56 downloads total

Score:
1.3
Short URL:
bindbc-bgfx.dub.pm