Automatically updated C# bindings for sokol https://github.com/floooh/sokol with native dynamic link libraries.
To learn more about sokol
and it's philosophy, see the A Tour of sokol_gfx.h
blog post, written Andre Weissflog, the owner of sokol
.
- Download and install .NET 7.
- Fork the repository using GitHub or clone the repository manually with submodules:
git clone --recurse-submodules https://github.com/bottlenoselabs/sokol-cs
. - Build the native library by running
library.sh
. To execute.sh
scripts on Windows, use Git Bash which can be installed with Git itself: https://git-scm.com/download/win. Thelibrary.sh
script requires that CMake is installed and in your path. - To setup everything you need: Either (1), add the
src/cs/production/Sokol/Sokol.csproj
C# project to your solution as an existing project and reference it within your own solution, or (2) import the MSBuildsokol.props
file which is located in the root of this directory to your.csproj
file. See the Sokol.csproj file for how to import thesokol.props
directly.
<!-- sokol: bindings + native library -->
<Import Project="$([System.IO.Path]::GetFullPath('path/to/sokol.props'))" />
The most basic example of rendering a triangle in clip space using your GPU.
Build + run: dotnet run --project ./src/cs/samples/Triangle/Triangle.csproj
For more information on how C# bindings work, see C2CS
, the tool that generates the bindings for sokol
and other C libraries.
To learn how to use sokol
, check out the official C samples. You can also find the same examples that run in your browser. The comments in the sokol_gfx.h
, sokol_app.h
, etc, are also a good reference for documentation.
sokol_gfx
converges old and modern graphics APIs to one simple and easy to use API. To learn more about the convergence of modern 3D graphics APIs (such as Metal, DirectX11/12, and WebGPU) and how they compare to legacy APIs (such as OpenGL), see A Comparison of Modern Graphics APIs blog written by Alain Galvan, a graphics software engineer.
sokol-cs
is licensed under the MIT license (MIT
) - see the LICENSE file for details.
sokol
is licensed under the ZLib license (zlib
) - see https://github.com/floooh/sokol/blob/master/LICENSE for more details.