Watch
2
0
Fork
You've already forked raylib-cs
0

Initial commit

Chris 2024-06-16 08:11:26 +01:00
commit cd1c35df91
4 changed files with 101 additions and 0 deletions

26
Build.md Normal file

@ -0,0 +1,26 @@
## How is it versioned?
Starting from [v5.0.0](https://github.com/ChrisDill/Raylib-cs/releases/tag/v5.0.0), raylib-cs follows semantic versioning. Versions prior
to this used the raylib version plus a build number.
## Any plans for generating the bindings automatically?
Currently the bindings are handmade. A few attempts at code generation have been made so this could change in the future.
## Why don't we support net framework using netstandard2.0?
It is possible to get raylib-cs to work in `netstandard2.0` but it involves workarounds that are not ideal. The main issue we had was
loading native libraries.
If we target `netstandard2.0` and a user tried to consume the library on `net framework`, it would not look for the native library
in the `runtimes/{tfm}/native` folder, where `{tfm}` is your current platform at runtime (e.g. `win-x64`, `linux-x86`, etc.).
We tried to work around this by searching for the library at runtime manually.
Our goal was to have a single DLL for all platforms as that is the entire point of C# (remember Java's "write once, run anywhere" motto).
It kinda worked but there were issues with NuGet. There is also little documentation on using native libs via NuGet and having them work on
all .net runtimes.
That said, we are happy to consider pull requests adding support as long as it meets our goal of having a single DLL for all platforms &
runtimes and works via NuGet without manually editing the NuPkg on every release.

68
Home.md Normal file

@ -0,0 +1,68 @@
## Welcome to the Raylib-cs wiki!
Raylib-cs is set of C# bindings for raylib, a simple and easy-to-use library to learn videogames programming.
Raylib-cs is designed to be close to the original api however there are some differences to make it easier to use in C# without
limiting you to a specific approach.
## String usage
Raylib-cs has wrapper functions around functions that take in strings to make them
easier to use. For example `InitWindow` takes in a string for the title.
```csharp
// Example usage
Raylib.InitWindow(800, 450, "åäö");
```
Originally used MarshalAs attributes to handle this but switched to a unsafe/safe approach to provide users with more control and to
make the marshalling code more explicit internally. Note that the safe utils involve additional memory allocation marshalling the data across.
## Color usage
Raylib-cs color presets are stored as static in the `Color` struct. This is more consistent with other types in C#.
```csharp
// Example usage
Raylib.ClearBackground(Color.RayWhite);
Raylib.BeginDrawing();
Raylib.DrawRectangle(0, 0, 100, 100, Color.Red);
Raylib.EndDrawing();
```
## Enum usage
Raylib-cs enums are used as the intended type instead of `int` for type safety and ease of use.
```csharp
// Example usage
if (Raylib.IsKeyPressed(KeyboardKey.Enter))
{
}
if (Raylib.IsMouseButtonPressed(MouseButton.Left))
{
}
```
## Math usage
Raylib-cs depends on `System.Numerics` for math types to make it easier to use
with other libraries and to provide a nicer api for math operations.
```csharp
// Example usage
Vector2 a = Vector2.Zero;
Vector3 b = Vector3.Zero;
Matrix4x4 m = Matrix4x4.Identity;
Quaternion q = Quaternion.Identity;
```
Note that the matrix layout in raylib is different to `System.Numerics`. When data is passed to/from raylib, you may need to transpose
the matrix to make sure it is in the right order for any operations you need to do.

5
_Footer.md Normal file

@ -0,0 +1,5 @@
[www.raylib.com](https://www.raylib.com/ "raylib website")
  \|  
[github](https://github.com/ChrisDill/Raylib-cs "Raylib-cs repository on GitHub")
  \|  
[discord](https://discord.gg/raylib)

2
_Sidebar.md Normal file

@ -0,0 +1,2 @@
### Table of Contents
* [Build](Build)