commit cd1c35df91ad0d76813796cc65d6d4efe417857f Author: chrisdill Date: Sun Jun 16 08:11:26 2024 +0100 Initial commit diff --git a/Build.md b/Build.md new file mode 100644 index 0000000..8e3391b --- /dev/null +++ b/Build.md @@ -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. + diff --git a/Home.md b/Home.md new file mode 100644 index 0000000..04fd63a --- /dev/null +++ b/Home.md @@ -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. diff --git a/_Footer.md b/_Footer.md new file mode 100644 index 0000000..0974ee1 --- /dev/null +++ b/_Footer.md @@ -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) \ No newline at end of file diff --git a/_Sidebar.md b/_Sidebar.md new file mode 100644 index 0000000..42494cf --- /dev/null +++ b/_Sidebar.md @@ -0,0 +1,2 @@ +### Table of Contents +* [Build](Build)