Package: bgfx-python
BGFX PythonPython 3.7+ wrapper for the BGFX library.Key Features•How To Use• •Using ImGUI•Examples•Logging•Credits•LicenseKey FeaturesUsesCppyyto natively wrap the C++ interface. NoCTypesor ugly C interfaces.Unless specified, the GIL is released for every invocation and pointers are passed by reference. This will ensure great overall performances.Maintains the original documentation; usehelp()on a class or function to view it.Compiles shaders on-the-fly, so you don't have to.Ships withImGuiintegrated in the BGFX rendering pipeline.How To UsePrecompiled wheelsPrecompiled wheels are available for Windows, Linux and MacOS.
To install the latest published release, simply run:$pipinstallbgfx-pythonInstall from sourceTo install the latest version, you'll need to clone this repository and its submodules:$gitclone--depth=1https://github.com/fbertola/bgfx-python
$gitsubmoduleupdate--init--recursiveThen, make sure to havemake,cmakeandninjainstalled in your system.Install the required dependency throughpoetry:$pipinstallpoetry
$poetryinstallFinally, simply build and install the wheel.$pipsetup.pyinstallInstalling on MacOSBuilding on MacOS X > 10.14 requires you to also install the SDK headers:xcode-select--install
open/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkgexportSDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdkInstalling on WindowsThe easiest way is to installVisual Studio 2017 Community Edition. If you haveChocolateyinstalled, then run:chocoinstallvisualstudio2017communityBefore building the package, make sure to activate all the environment variables required by the compiler:call"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"x86_amd64Using ImGUITwo modules are exposed:ImGui, which provides a standard wrapper around all the ImGui funcions and classes.ImGuiExtra, which provides some additional functions to integrate ImGui in the BGFX rendering pipline.To use it in your application, simply follow this template:# Setup the applicationdefinit():ImGuiExtra.create()# Destroy the applicationdefdestroy():ImGuiExtra.destroy()# Update the application, rendering each framdefupdate():ImGuiExtra.beginFrame(mouse_x,mouse_y,buttons_states,0,width,height)# Other ImGui drawing directives...ImGuiExtra.endFrame()LoggingLoguruis used for logging insidebgfx_python. By default the logger is disabled; to enable it, use the following instructions:fromloguruimportloggerlogger.enable("bgfx")ExamplesYou will find some examples in theexamplesfolder, be sure to check them out.
For a more advanced example, see theNatrixproject.CreditsThis software uses the following open source packages:bgfxcppyyLicense (BSD 2-clause)BSD 2-Clause License

Copyright (c) 2021, Federico Bertola
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.GitHub@fbertola