Watch
2
0
Fork
You've already forked raylib-cs
0
C# bindings for raylib, a simple and easy-to-use library to learn videogames programming http://www.raylib.com/
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Matorio b84a0d4f12 Merging
Added new extension "byte.Lerp".
Added new extension "Log" for "TraceLogLevel".
Constructors on Color no longer just truncate the float value, but also round it (+ 0.5f).
New static method on Color, "Color.Lerp".
Added static method "FromHSV" to Color.
Added new getter method "GetHSV" on Color.
Added index security on the FilePathList indexer.
Merged Rectangle extensions with the type itself as read-only methods.
Merged Image extensions with the type itself.
Merged Texture2D extensions with the type itself.
New file "Raymath.Utils" with some useful methods taken from Unity.
Added "MoveTowards" extensions to RaylibExtensions.
Added "TranslateLocal" and "TranslateGlobal" to Transform.
Added "Load", "Export", "ExportAsCode", "Format", "Crop", and "Unload" shortcut methods to Wave.
Added "IsValid" property to Wave, Texture2D, Sound, Shader, RenderTexture2D, Music, Image, Model, Material, Font, and AudioStream.
Added "IsPlaying" and "IsProcessed" properties to AudioStream.
Added "Load", "Play", "Stop", "Pause", "Resume", "SetBufferSizeDefault", "SetPan", "SetPitch", "SetVolume", and "Unload" shortcut methods to AudioStream.
Added "Load", "Export", and "Unload" methods to AutomationEventList.
Added "Default" property to Font.
Added "Load", "GetMaterial", "GetTexture", "SetTexture", "SetShader", and "Unload" methods to material.
Added "Draw", "DrawInstanced", "Export", "ExportAsCode", "Upload", and "Unload" methods to Mesh.
Added "Load", "LoadFromMesh", "Unload", and a lot of "Draw" overloads.
Added "Load", "Play", "Pause", "Stop", "SetPan", "SetPitch", "SetVolume", "Seek", and "Unload" methods to Music.
Added "Load" and "Unload" methods to RenderTexture2D.
Added "Load", "LoadFromMemory", "GetLocationAttrib", "SetValue", "SetTexture", "SetMatrix", and "Unload" methods to Shader.
Removed unnecessary "partial" declarations.
2025-07-17 03:14:57 -05:00
.github Enable Targeting .Net 8 (#297) 2025-05-07 08:16:47 +01:00
Examples Enable Targeting .Net 8 (#297) 2025-05-07 08:16:47 +01:00
Raylib-cs Merging 2025-07-17 03:14:57 -05:00
Raylib-cs.Native Enable Targeting .Net 8 (#297) 2025-05-07 08:16:47 +01:00
Raylib-cs.Tests Enable Targeting .Net 8 (#297) 2025-05-07 08:16:47 +01:00
.editorconfig Add .editorconfig and apply formatting 2023-08-27 15:20:26 +01:00
.gitignore Add missing model resources (#251) 2024-06-18 21:25:29 +01:00
LICENSE Update release version to 7.0.1 (#293) 2025-01-30 21:51:19 +00:00
Raylib-cs.sln Native build improvements (#235) 2024-06-08 07:27:01 +01:00
README.md Add STAThread notice to README (#302) 2025-05-22 18:07:30 +01:00

Raylib-cs Logo

Raylib-cs

C# bindings for raylib, a simple and easy-to-use library to learn videogames programming (www.raylib.com)

GitHub contributors License Chat on Discord GitHub stars Build

Raylib-cs targets net6.0 and uses the official 5.5 release to build the native libraries.

Status

Raylib-cs is passively maintained. Occasional updates may be released from time to time. Pull requests may be accepted if they don't have a large maintainence burden.

Installation - NuGet

This is the prefered method to get started.

  1. Pick a folder in which you would like to start a raylib project. For example "MyRaylibCSProj".
  2. Then from a terminal (for example a VSCode terminal), whilst in the directory you just created run the following commands. (Please keep in mind .NET should already be installed on your system)
dotnet new console
dotnet add package Raylib-cs

NuGet

If you need to edit Raylib-cs source then you will need to add the bindings as a project (see below).

If you are new to using NuGet (or you've forgotten) and are trying to run the above command in the command prompt, remember that you need to be inside the intended project directory (not just inside the solution directory) otherwise the command won't work.

Installation - Manual

  1. Download/clone the repo

  2. Add Raylib-cs/Raylib-cs.csproj to your project as an existing project.

  3. Download/build the native libraries for the platforms you want using the official 5.5 release. NOTE: the MSVC version is required for Windows platforms

  4. Setup the native libraries so they are in the same directory as the executable/can be found in the search path.

  5. Start coding!

Hello, World!

using Raylib_cs;

namespace HelloWorld;

class Program
{
    // STAThread is required if you deploy using NativeAOT on Windows - See https://github.com/raylib-cs/raylib-cs/issues/301
    [STAThread]
    public static void Main()
    {
        Raylib.InitWindow(800, 480, "Hello World");

        while (!Raylib.WindowShouldClose())
        {
            Raylib.BeginDrawing();
            Raylib.ClearBackground(Color.White);

            Raylib.DrawText("Hello, world!", 12, 12, 20, Color.Black);

            Raylib.EndDrawing();
        }

        Raylib.CloseWindow();
    }
}

Contributing

Feel free to open an issue. If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are welcome.

If you want to request features or report bugs related to raylib directly (in contrast to this binding), please refer to the author's project repo.

License

See LICENSE for details.