Skip to content

deathbeam/Raylib.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stuff being done here

Everything is 100% generated, Im not touching the generated stuff, only generator. The goal is to eventually PR some of this stuff to Raylib-cs. Natives PR requires 5.5 update there first and generator is a lot of effort due to Raylib-cs project structure being quite difficult to work with. If I decide that its not worth it, I will just keep this as a separate project.

Stuff not being done here

  • Enum to argument mappings - this is raylib design decision, if raylib maintainers decide to provide type info in headers I can parse it, but without it too bad
  • Array->Span mappings - C arrays are fake, ideally raylib should provide C99 [] notation for arrays in headers, but when it doesnt, too bad

Included bindings

  • Raylib
  • Raymath
  • Rlgl
  • Raygui
  • Rres

Supported platforms

  • Windows x64/x86/arm64
  • OSX x64/arm64
  • Linux x64/arm64 (arm64 currently not prebuilt)
  • Browser WASM

Use as dependency

Add source

Needs GitHub credentials.

dotnet nuget add source --name "raylib.net" --username "YOUR_GITHUB_USERNAME" --password "YOUR_GITHUB_TOKEN" --store-password-in-clear-text "https://nuget.pkg.github.com/deathbeam/index.json"

Use package

dotnet add package Raylib.NET --version '*-build.*'
dotnet add package Raylib.NET.Native --version '*-build.*'

Try the example

cd src/Raylib.NET.Example

# linux
dotnet publish -r linux-x64 -c Release
./bin/Release/net8.0/linux-x64/publish/Raylib.NET.Example

# windows
dotnet publish -r win-x64 -c Release
bin/Release/net8.0/win-x64/publish/Raylib.NET.Example.exe

# wasm (EMSDK required + wasm-tools, see below for EMSDK setup)
dotnet workload install wasm-tools
dotnet publish -r browser-wasm -c Release
emrun --port 8080 bin/Release/net8.0/browser-wasm/native/Raylib.NET.Example.html

Local development

Initializes submodules:

git submodule update --init --recursive

Updates raylib submodules (if needed):

git submodule update --recursive --remote

Generate bindings, build natives for whatever os you are on etc:

dotnet build

Cross-compile with RID:

cd src/Raylib.NET.Native
dotnet build -r win-x64
dotnet build -r win-x86
dotnet build -r win-arm64
dotnet build -r linux-x64
dotnet build -r osx-x64
dotnet build -r osx-arm64
dotnet build -r browser-wasm

browser-wasm requires EMSDK:

git clone https://github.com/emscripten-core/emsdk
cd emsdk
./emsdk install latest
./emsdk activate latest
export EMSDK=$PWD