![]() |
VOOZH | about |
dotnet add package Raylib-CsLo --version 4.2.0.9
NuGet\Install-Package Raylib-CsLo -Version 4.2.0.9
<PackageReference Include="Raylib-CsLo" Version="4.2.0.9" />
<PackageVersion Include="Raylib-CsLo" Version="4.2.0.9" />Directory.Packages.props
<PackageReference Include="Raylib-CsLo" />Project file
paket add Raylib-CsLo --version 4.2.0.9
#r "nuget: Raylib-CsLo, 4.2.0.9"
#:package Raylib-CsLo@4.2.0.9
#addin nuget:?package=Raylib-CsLo&version=4.2.0.9Install as a Cake Addin
#tool nuget:?package=Raylib-CsLo&version=4.2.0.9Install as a Cake Tool
| 👁 Raylib-CsLo-Logo |
|---|
👁 Nuget Package
👁 Source Code
👁 Source Code
👁 .NET 5+
👁 Chat on Discord
Raylib-Csv4.2.0.5 should now include full osx support, both x64 and arm64, which includes supporting the M1.
If you test on the M1 and have problems, please raise an issue.
Managed C# bindings to Raylib, a friendly 2d/3d game framework similar to XNA / MonoGame.
raylib : Core features, including Audio.rlgl : OpenGl abstractionraygui : An Imperitive Guiphysac : A 2d physics frameworkeasings : for simple animations (Managed Port)raymath : game math library (Managed Port)unsafe for 3d workflows.net5+, Mono 6.4+, NetCore3+ (via netStandard 2.1)Win10. User Reports Arch Linux works. Please test on other platforms and raise an issue if any problems occur.Raylib is a friendly-to-use game framework that includes basic scenarios to meet your needs: audio, 2d, 3d, fonts, animation, 2d physics. Somewhat similar to Xna or MonoGame but friendlier. However, Raylib is a C/CPP framework. Raylib-CsLo is a C# Wrapper over the top, which lets you gain raylib's powers to quickly prototype your game ideas.
If you stick with 2d, you don't need to use any unsafe (pointer) code, which lets 2d users feel at home and use Raylib-CsLo as an awesome 2d game framework.
unsafe to use)3d in CsLo requires the unsafe keyword. If you use 3d, you need to understand a bit of how pointers work. Raylib uses these to link things like Model, Mesh, and Material. Writing wrappers over these is possible but it would basically be creating a an entirely new framework. I suggest leaving this as-is, as it avoids object allocation (GC Pressure).
Additionally, 3d users: Be sure you check the Usage Tips section below, especially on how you need to use Matrix4x4.Transpose() when sending matricies to Raylib.
using Raylib_CsLo;
namespace StandaloneExample
{
public static class Program
{
public static async Task Main(string[] args)
{
Raylib.InitWindow(1280, 720, "Hello, Raylib-CsLo");
Raylib.SetTargetFPS(60);
// Main game loop
while (!Raylib.WindowShouldClose()) // Detect window close button or ESC key
{
Raylib.BeginDrawing();
Raylib.ClearBackground(Raylib.SKYBLUE);
Raylib.DrawFPS(10, 10);
Raylib.DrawText("Raylib is easy!!!", 640 , 360, 50, Raylib.RED);
Raylib.EndDrawing();
}
Raylib.CloseWindow();
}
}
}
./Raylib-CsLo-DEV.sln in Visual Studio 2022.Raylib-CsLo.Examples project will run by default, and will run through all (aprox 100+) examples../StandaloneExample folderThe following platforms are shipped in the nuget package:
win-x64 : confirmed working on Win10, x64. This is the platform used for dev/testing of raylib-cslo.linux-x64: confirmed working on Arch Linux. Binaries built under Ubuntu 20.04 so that shold also work.osx-x64: not confirmed yet. Please let me know if you try.You can build the native binaries for whatever platform you need. Please see the readme under https://github.com/NotNotTech/Raylib-CsLo/tree/main/Raylib-CsLo/runtimes for more info.
Here are links to most the examples.
Raylib-CsRaylib-Cs |
Raylib-CsLo |
|---|---|
| An artisanal, bespoke binding+wrapper. | A cold, calculating robo-binding. |
| Each binding is hand crafted with carefull design | Exact Bindings (Autogen) with wrappers to make C# usage nice. |
Bindings for Raylib and extras RayMath, RlGl. |
Bindings for Raylib and all extras (RayGui, Easings, Physac, RlGl, RayMath) |
| Optimized for normal C# usage | Optimized for maximum performance and might require 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 / Examples |
| Born 2018-07 | Born 2021-11 |
| Lots of examples | ALL 100+ Raylib examples |
| zlib Licensed | MPL 2.0 Licensed |
| Nuget Package | Nuget Package |
| Raylib 4.0 | Raylib 4.2 |
| lots of contribs | few contribs |
If you need a custom camera, check out the Raylib-Extras-CsLo project, which contains a custom First Person Camera and Third Person Camera. https://github.com/NotNotTech/Raylib-Extras-CsLo
SOME_IDEA?
Raylib-CsLo include the SOME_FUNCTION_YOU_NEED() function?
raygui and physac, but with the exception of things in the Known Issues section further below.SOME_OTHER_FUNCTION_YOU_NEED()?
string marshalling), but some involving pointers have been left as-is. If you come across a function that you feel needs more wrapping, you can raise an issue or perhaps submit a PRsbyte* or vice-versa?
sbyte* have string wrappers, so be sure to look at the overload you can call.int?
_ to the end of the function/property. For example: Camera3D.projection_ = CameraProjection.CAMERA_ORTHOGRAPHIC; or Gesture gesture = Raylib.GetGestureDetected_();.(int).sbyte[] arrays being allocated?
sbyte[] is allocated for string marshall purposes, to avoid runtime allocations.RayMath?
Raylib_CsLo.RayMath contains a lot of super helpful functions for doing gamedev related maths.RayMath helper functions have been translated into C# code. This makes the code pretty fast, but if the same function exists under System.Numerics you should use that instead, because the DotNet CLR treats things under System.Numerics special, and optimizes it better.Matrix4x4.Transpose(yourMatrix)Audio: v4.2 Regression Bug. There is a state corruption bug in the native audio subsystem if you dispose of streaming audio. You may encounter this if you use multiple windows and audio streaming. see this tracking issue for more info.
RayGui: be sure to call RayGui.GuiLoadStyleDefault(); right after you InitWindow(). 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 are not ported: use System.Runtime.InteropServices.NativeMemory.Alloc() instead
LogCustom() is ported but doesn't support variable length arguments.
Texture2D doesn't exist. it is just an alias for Texture so use that instead. You might want to use using aliases like the following
```cs
//usings to make C# code more like the raylib cpp examples.
//to see more stuff like this, look at Raylib-CsLo.Examples/program.cs
global using Camera = Raylib_CsLo.Camera3D;
global using RenderTexture2D = Raylib_CsLo.RenderTexture;
global using Texture2D = Raylib_CsLo.Texture;
global using TextureCubemap = Raylib_CsLo.Texture;
global using Matrix = System.Numerics.Matrix4x4;
```
OFF.dev.slncheck out the readme under the binding-gen folder
If there is a platform that doesn't work due to no native binary being shipped with the Raylib-CsLo nuget package, you should just be able to yoink the official raylib native library ...like from here and if it's put in the right folder location (output folder), raylib-cslo can use it, assuming it's named properly. If you do this you need to be aware that the various raylib-extras will not be available, but everything else should work.
By default, this repository is licensed under the Mozilla Public License 2.0 (MPL). The MPL is a popular "weak copyleft" license that allows just about anything. For example, you may use/include/static-link this library in a commercial, closed-source project without any burdens. The main limitation of the MPL being that: Modifications to the source code in this project must be open sourced.
The MPL is a great choice, both by providing flexibility to the user, and by encouraging contributions to the underlying project. If you would like to read about the MPL, FOSSA has a great overview of the MPL 2.0 here.
If for some reason you or your organization really, REALLY can not open source your modifications to this project, I am willing to offer a PCL for USD $1000, half of which will be donated to the upstream raylib project. Payment can be made via github donations. Yes $1000 is a lot of money, so just try to accept the MPL terms and move on with life!
If you still think a PCL is what you need, raise an issue or email JasonS aat Novaleaf doot coom to discuss.
changelog for major releases.
Shpendicus).Shpendicus).Peter0x44).Raylib4.2. Bugs:
physac.dll and bindings for it added. Physics and Audio examples ported. All raylib examples complete!RayGui, and Easings Raylib.extras ported to managed code. Shapes,Textures, and Text examples ported.Model, and Shader examples ported.RayMath, RlGl)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 | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
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 |
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 | 13,513 | 3/2/2023 |
| 4.2.0.9-pre-m1-0 | 6,321 | 3/1/2023 |
| 4.2.0.8 | 6,482 | 3/1/2023 |
| 4.2.0.7 | 6,366 | 2/28/2023 |
| 4.2.0.6 | 6,552 | 2/25/2023 |
| 4.2.0.5 | 6,629 | 2/6/2023 |
| 4.2.0.5-alpha1 | 6,173 | 2/2/2023 |
| 4.2.0.4 | 6,575 | 1/31/2023 |
| 4.2.0.3 | 9,698 | 9/22/2022 |
| 4.2.0.2 | 6,161 | 9/20/2022 |
| 4.2.0.1 | 6,335 | 9/20/2022 |
| 4.2.0-alpha1 | 6,115 | 9/20/2022 |
| 4.2.0-alpha0 | 5,940 | 9/19/2022 |
| 4.0.1 | 9,451 | 4/9/2022 |
| 4.0.0 | 7,593 | 1/16/2022 |
| 4.0.0-rc.5.0 | 511 | 12/15/2021 |
| 4.0.0-rc.4.2 | 382 | 12/11/2021 |
| 4.0.0-rc.4.1 | 378 | 12/9/2021 |
| 4.0.0-rc.4.0 | 387 | 12/5/2021 |
Release Notes: fix confirmed working! mac-arm64 (M1) support