Raylib-CsLo
4.0.0-rc.0
See the version list below for details.
dotnet add package Raylib-CsLo --version 4.0.0-rc.0
NuGet\Install-Package Raylib-CsLo -Version 4.0.0-rc.0
<PackageReference Include="Raylib-CsLo" Version="4.0.0-rc.0" />
paket add Raylib-CsLo --version 4.0.0-rc.0
#r "nuget: Raylib-CsLo, 4.0.0-rc.0"
// Install Raylib-CsLo as a Cake Addin #addin nuget:?package=Raylib-CsLo&version=4.0.0-rc.0&prerelease // Install Raylib-CsLo as a Cake Tool #tool nuget:?package=Raylib-CsLo&version=4.0.0-rc.0&prerelease
<h1 align="center"> <a href="#"><img align="center" src="meta/logos/raylib-cslo_128x128.png" height="96"> Raylib-CsLo</a> <br /> </h1>
<div align="center">
</div>
Table of Contents
- Table of Contents
- Raylib-CsLo
- Differences from
raylib-cs
- Usage Tips / FAQ
- Known Issues:
- How to Contribute
- ChangeLog
Raylib-CsLo
LowLevel autogen bindings to Raylib 4.0 and convenience wrappers on top.
- Requires use of
unsafe
- Requires use of
DotNet 6.0
- A focus on performance. No runtime allocations if at all possible.
- because these are autogen, there won't be any intellisense docs. read the raylib cheatsheet for docs
The entire API of Raylib 4.0
is available via these bindings. However, as the bindings are auto-generated, they are not user friendly, even for unsafe
use.
To make these bindings "friendly" to C# use, convenience wrappers are being added, so you can use these bindings with a minimal amount of unsafe
code.
The current mission of this project is to port all Raylib examples (more than 120 of them) to work with these bindings, with as little modification to the example code as possible. In doing so, convenience wrappers will be added for the Raylib api's used in the examples. This is a good heuristic for "primary usage scenarios", so writing wrappers for these API's should make these bindings user friendly in the fastest time, while also providing valuable C# examples.
Right now mose of the examples have been ported.
Release timeline
RELEASE CANDIDATE
- The current status.
- All Raylib features, including Extras bindings
raylib
rlgl
raygui
physac
easings
raymath
- All raylib examples are ported and working (see the github repository for the example project)
- A Nuget package is avalable
RELEASE
- Triggered 2 weeks after the last RC issue is fixed. (so if you find any bugs with the release candidate, be sure to file them!)
Differences from raylib-cs
raylib-cs |
raylib-cslo |
---|---|
each binding is hand crafted with carefull design | Autogen with wrappers to make C# usage nice. |
Optimized for normal C# usage | Optimized for maximum performance and requires unsafe |
New Raylib version? Harder to detect breaking changes | New Raylib version? Breaking changes are easy to spot and fix |
includes Intellisence docs | No docs. Use the Cheatsheet |
has a long track record | didn't exist till mid november 2021! |
has lots of examples | `ALL raylib examples |
zlib licensed | lgpl licensed |
Nuget Package | Nuget Package |
raylib 3.7.1 Stable | raylib 4.0.0 Beta |
Works with various dotnet flavors? | Focus on DotNet6.0 |
lots of contribs | just little 'ol me |
Usage Tips / FAQ
- Does
Raylib-CsLo
include theSOME_FUNCTION_YOU_NEED()
function?- Raylib-CsLo has bindings for everything in the Raylib 4.0 release, including extras like
raygui
andphysac
, but with the exception of things in theKnown Issues
section further below.
- Raylib-CsLo has bindings for everything in the Raylib 4.0 release, including extras like
- Why didn't you add a wrapper for function
SOME_OTHER_FUNCTION_YOU_NEED()
?- Raylib-CsLo uses a manual marshalling technique, as the built in PInvoke marshalling is not very efficienct. Unfortunately writing wrappers takes time.
- I am going through all the examples and porting them, and when I do I'm adding wrappers to the raylib api's used (I'm using examples as a heuristic for "commonly used api's) For a function I haven't written a wrapper for, you can look at how I do it and write your own wrapper, or can help the project by submitting a PR.
- On average it only takes me about 15 min to port each example, but there are many examples.
- How do I convert a string to
sbyte*
or vice-versa?- Look if there is a wrapper overload you can call. If not, you can write your own wrapper by coppying the pattern in one of the existing wrappers.
- Do I have to really cast my Enum to
int
?- The autogen bindings are left untouched, however convenience wrappers are added. Usually these will automagically "work" via function overloads, but where this is not possible, try adding an underscore
_
to the end of the function/property. For example:Camera3D.projection_ = CameraProjection.CAMERA_ORTHOGRAPHIC;
orGesture gesture = Raylib.GetGestureDetected_();
- The autogen bindings are left untouched, however convenience wrappers are added. Usually these will automagically "work" via function overloads, but where this is not possible, try adding an underscore
- I ran the examples in a profiler. What are all these
sbyte[]
arrays being allocated?- A pool of
sbyte[]
is allocated for string marshall purposes, to avoid runtime allocations.
- A pool of
- Why don't you add wrappers for the Math helpers?
- The
RayMath
helper functions have been translated into C# code. This is because crossing between Managed and Native code isn't free. Better you do all your maths in managed code, and pass the final result to raylib.
- The
- Why are my matricies corrupt?
- Raylib/OpenGl uses column-major matricies, while dotnet/vulkan/directx uses row-major. When passing your final calculated matrix to raylib for rendering, call
Matrix4x4.Transpose(yourMatrix)
- Raylib/OpenGl uses column-major matricies, while dotnet/vulkan/directx uses row-major. When passing your final calculated matrix to raylib for rendering, call
Known Issues:
RayGui
: be sure to callRayGui.GuiLoadStyleDefault();
right after youInitWindow()
. This is needed to initialize the gui properly. If you don't, if you close a raylib window and then open a new one (inside the same app), the gui will be broken.- The
Text.Unicode
example doesn't render unicode properly. Maybe the required font is missing, maybe there is a bug in the example (Utf16 to Utf8 conversion) or maybe there is a bug in Raylib. A hunch: I think it's probably due to the fonts not including unicode characters, but I didn't investigate further. - Native Memory allocation functions: use
System.Runtime.InteropServices.NativeMemory.Alloc()
instead LogCustom()
is ported but doesn't support variable length arguments.
How to Contribute
- assume you are using Visual Studio (or maybe rider?) and can run
dev.sln
- fork the repo, build and try out the example project
- ??? add some wrappers? All features are done and working 😄
~ example group ~ | ~ who is doing port ~ | ~ done? ~ |
---|---|---|
core | novaleaf | [X] |
shapes | novaleaf | [X] |
textures | novaleaf | [X] |
text | novaleaf | [X] |
models | novaleaf | [X] |
shaders | novaleaf | [X] |
audio | novaleaf | [X] |
physics | novaleaf | [X] |
ChangeLog
- 4.0.0-rc.0 (2021/11/22):
physac.dll
and bindings for it added.Physics
andAudio
examples ported. Allraylib
examples complete! - 4.0.0-beta.2 (2021/11/22):
RayGui
, andEasings
Raylib.extras ported to managed code.Shapes
,Textures
, andText
examples ported. - 4.0.0-beta.0 (2021/11/20):
Model
, andShader
examples ported. - 4.0.0-alpha.2 (2021/11/18): Model examples ported. AutoGen Bindings expanded to include all api's exposed by Raylib.dll (adding
RayMath
,RlGl
) - 4.0.0-alpha.1 (2021/11/16): all
Core
examples ported, so "feature complete" for the workflows used in those examples (and, complete only for those workflows)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.Toolkit.HighPerformance (>= 7.1.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Raylib-CsLo:
Package | Downloads |
---|---|
RayWrapper.Base
This is the Base package for RayWrapper |
|
Raylib_ImGui
Open-source ImGui renderer for Raylib |
|
RayWork.RLImgui
Imgui.Net integration |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Raylib-CsLo:
Repository | Stars |
---|---|
sinshu/meltysynth
A SoundFont MIDI synthesizer for .NET
|
Version | Downloads | Last updated |
---|---|---|
4.2.0.9 | 10,573 | 3/2/2023 |
4.2.0.9-pre-m1-0 | 5,948 | 3/1/2023 |
4.2.0.8 | 6,082 | 3/1/2023 |
4.2.0.7 | 5,994 | 2/28/2023 |
4.2.0.6 | 6,098 | 2/25/2023 |
4.2.0.5 | 6,241 | 2/6/2023 |
4.2.0.5-alpha1 | 5,842 | 2/2/2023 |
4.2.0.4 | 6,143 | 1/31/2023 |
4.2.0.3 | 8,930 | 9/22/2022 |
4.2.0.2 | 5,755 | 9/20/2022 |
4.2.0.1 | 5,850 | 9/20/2022 |
4.2.0-alpha1 | 5,686 | 9/20/2022 |
4.2.0-alpha0 | 5,519 | 9/19/2022 |
4.0.1 | 8,677 | 4/9/2022 |
4.0.0 | 6,796 | 1/16/2022 |
4.0.0-rc.5.0 | 331 | 12/15/2021 |
4.0.0-rc.4.2 | 173 | 12/11/2021 |
4.0.0-rc.4.1 | 169 | 12/9/2021 |
4.0.0-rc.4.0 | 182 | 12/5/2021 |
4.0.0-rc.3.1 | 943 | 11/29/2021 |
4.0.0-rc.3 | 848 | 11/29/2021 |
4.0.0-rc.2 | 182 | 11/27/2021 |
4.0.0-rc.1 | 2,986 | 11/25/2021 |
4.0.0-rc.0.1 | 5,783 | 11/23/2021 |
4.0.0-rc.0 | 146 | 11/23/2021 |
4.0.0-beta.2 | 157 | 11/22/2021 |
4.0.0-beta.1 | 936 | 11/20/2021 |
4.0.0-beta.0 | 946 | 11/20/2021 |
4.0.0-alpha.2 | 154 | 11/19/2021 |
4.0.0-alpha.1 | 219 | 11/17/2021 |
4.0.0-alpha.0 | 248 | 11/17/2021 |
Beta release. Review the examples on github.