Review README files and comment style
This commit is contained in:
parent
8c22e68c2a
commit
5e2b5aef34
5 changed files with 35 additions and 35 deletions
|
|
@ -80,7 +80,7 @@ public unsafe partial class CustomLogging : IExample
|
||||||
{
|
{
|
||||||
#if !BROWSER
|
#if !BROWSER
|
||||||
// Restore the default formatting logger on desktop. On WebAssembly we leave the (wasm-safe)
|
// Restore the default formatting logger on desktop. On WebAssembly we leave the (wasm-safe)
|
||||||
// custom logger in place — Logging.LogConsole formats via vsprintf, which traps on wasm.
|
// custom logger in place - Logging.LogConsole formats via vsprintf, which traps on wasm.
|
||||||
SetTraceLogCallback(&Logging.LogConsole);
|
SetTraceLogCallback(&Logging.LogConsole);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public partial class EllipseCollision : IExample
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if two ellipses collide
|
// Check if two ellipses collide
|
||||||
// Uses radial boundary distance in the direction between centers — scales correctly with radii
|
// Uses radial boundary distance in the direction between centers - scales correctly with radii
|
||||||
private static bool CheckCollisionEllipses(Vector2 c1, float rx1, float ry1, Vector2 c2, float rx2, float ry2)
|
private static bool CheckCollisionEllipses(Vector2 c1, float rx1, float ry1, Vector2 c2, float rx2, float ry2)
|
||||||
{
|
{
|
||||||
float dx = c2.X - c1.X;
|
float dx = c2.X - c1.X;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Examples/Web — raylib-cs in the browser (WebAssembly)
|
# Examples/Web - raylib-cs in the browser (WebAssembly)
|
||||||
|
|
||||||
Runs the raylib examples in the browser via WebAssembly, with a dropdown and Prev/Next buttons
|
Runs the raylib examples in the browser via WebAssembly, with a dropdown and Prev/Next buttons
|
||||||
to switch between them.
|
to switch between them.
|
||||||
|
|
@ -73,7 +73,7 @@ page), so frames are driven from JavaScript:
|
||||||
|
|
||||||
## Adding more examples
|
## Adding more examples
|
||||||
|
|
||||||
Examples are **auto-discovered by reflection** (`ExampleRegistry.DiscoverAll`) — no list to edit.
|
Examples are **auto-discovered by reflection** (`ExampleRegistry.DiscoverAll`) - no list to edit.
|
||||||
Drop a new `.cs` file in the matching category folder implementing `IExample`, splitting the
|
Drop a new `.cs` file in the matching category folder implementing `IExample`, splitting the
|
||||||
original monolithic `Main` as:
|
original monolithic `Main` as:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
<title>raylib-cs — browser examples</title>
|
<title>raylib-cs - browser examples</title>
|
||||||
<link rel="icon" type="image/x-icon" href="./favicon.ico"/>
|
<link rel="icon" type="image/x-icon" href="./favicon.ico"/>
|
||||||
<link rel="modulepreload" href="./main.js"/>
|
<link rel="modulepreload" href="./main.js"/>
|
||||||
<link rel="modulepreload" href="./_framework/dotnet.js"/>
|
<link rel="modulepreload" href="./_framework/dotnet.js"/>
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
<option value="fit">Fit</option>
|
<option value="fit">Fit</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div id="error" hidden>This example crashed — see the browser console for details. Select another example to continue.</div>
|
<div id="error" hidden>This example crashed - see the browser console for details. Select another example to continue.</div>
|
||||||
<div id="viewport">
|
<div id="viewport">
|
||||||
<canvas id="canvas" width="800" height="450" oncontextmenu="event.preventDefault()" tabindex="-1"></canvas>
|
<canvas id="canvas" width="800" height="450" oncontextmenu="event.preventDefault()" tabindex="-1"></canvas>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
62
README.md
62
README.md
|
|
@ -14,6 +14,7 @@ Raylib-cs targets net8.0, net10.0 and uses the [official 6.0 release](https://gi
|
||||||
to build the native libraries.
|
to build the native libraries.
|
||||||
|
|
||||||
### Version 8.1.0 of Raylib-cs supports the following runtimes:
|
### Version 8.1.0 of Raylib-cs supports the following runtimes:
|
||||||
|
|
||||||
- **browser-wasm** *(raylib-6.0_webassembly)* 🆕
|
- **browser-wasm** *(raylib-6.0_webassembly)* 🆕
|
||||||
- **linux-x64** *(raylib-6.0_linux_amd64)*
|
- **linux-x64** *(raylib-6.0_linux_amd64)*
|
||||||
- **osx-arm64** *(raylib-6.0_macos)*
|
- **osx-arm64** *(raylib-6.0_macos)*
|
||||||
|
|
@ -24,7 +25,6 @@ to build the native libraries.
|
||||||
The following frameworks are deprecated (fall back to Version 7.x if required):
|
The following frameworks are deprecated (fall back to Version 7.x if required):
|
||||||
- net6.0 (end of life)
|
- net6.0 (end of life)
|
||||||
|
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
Raylib-cs is passively maintained. Occasional updates may be released from time to time. Pull requests may be
|
Raylib-cs is passively maintained. Occasional updates may be released from time to time. Pull requests may be
|
||||||
|
|
@ -34,14 +34,14 @@ accepted if they don't have a large maintenance burden.
|
||||||
|
|
||||||
This is the preferred method to get started.
|
This is the preferred method to get started.
|
||||||
|
|
||||||
1) Pick a folder in which you would like to start a raylib project. For example, "MyRaylibCSProj."
|
1) Pick a folder in which you would like to start a raylib project. For example, "HelloRaylibCS."
|
||||||
2) Then from a terminal (for example, a VSCode terminal), whilst in the directory you just created
|
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)
|
run the following commands. (Please keep in mind .NET should already be installed on your system)
|
||||||
|
|
||||||
```
|
```sh
|
||||||
dotnet new console
|
dotnet new console
|
||||||
```
|
```
|
||||||
```
|
```sh
|
||||||
dotnet add package Raylib-cs
|
dotnet add package Raylib-cs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -65,25 +65,6 @@ otherwise the command won't work.
|
||||||
|
|
||||||
5. Start coding!
|
5. Start coding!
|
||||||
|
|
||||||
## Building from source
|
|
||||||
|
|
||||||
The `Examples` and `Raylib-cs.Tests` projects consume the binding as a NuGet package, and the in-repo
|
|
||||||
version may not be published on nuget.org yet. Pack it once into the local feed before the first build:
|
|
||||||
|
|
||||||
```
|
|
||||||
dotnet pack Raylib-cs -c Release -o nuget
|
|
||||||
dotnet build
|
|
||||||
```
|
|
||||||
|
|
||||||
`NuGet.config` points restore at the local `./nuget` feed, so both projects pick up the freshly packed
|
|
||||||
package. If you skip the pack step on a fresh clone, restore fails with NU1301 (the `./nuget` source
|
|
||||||
doesn't exist) or NU1102 (Raylib-cs not found) — running the pack command fixes both.
|
|
||||||
|
|
||||||
When iterating on the binding itself, note that NuGet caches the extracted package by version and
|
|
||||||
ignores repacks of the same version. After repacking, delete the old package from `./nuget` and clear
|
|
||||||
the cached copy (`dotnet nuget locals global-packages --clear`, or delete
|
|
||||||
`~/.nuget/packages/raylib-cs/<version>`) before restoring again.
|
|
||||||
|
|
||||||
## Hello, World!
|
## Hello, World!
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
|
|
@ -115,21 +96,40 @@ internal static class Program
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building the examples locally
|
## Building from source
|
||||||
|
|
||||||
The `Examples` project references the sibling `Raylib-cs` project by default, so local changes to the
|
The `Examples` and `Raylib-cs.Tests` projects reference the sibling `Raylib-cs` project by default, so local changes to the the bindings are picked up directly:
|
||||||
bindings are picked up directly:
|
|
||||||
|
|
||||||
```
|
```sh
|
||||||
dotnet run --project Examples
|
dotnet run --project Examples
|
||||||
```
|
```
|
||||||
|
```sh
|
||||||
To build the examples against the Raylib-cs NuGet package instead (the version set by
|
dotnet test
|
||||||
`RaylibCsVersion` in [Directory.Build.props](Directory.Build.props)), set `UseRaylibCsPackage`:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Both projects can also consume the binding as a NuGet package but the in-repo version may not be published on nuget.org
|
||||||
|
yet. Pack it once into the local feed before the first build. Then to run against the Raylib-cs NuGet package (the
|
||||||
|
version set by `RaylibCsVersion` in [Directory.Build.props](Directory.Build.props)), set `UseRaylibCsPackage`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
dotnet pack Raylib-cs -c Release -o nuget
|
||||||
|
dotnet build
|
||||||
|
```
|
||||||
|
```sh
|
||||||
dotnet run --project Examples -p:UseRaylibCsPackage=true
|
dotnet run --project Examples -p:UseRaylibCsPackage=true
|
||||||
```
|
```
|
||||||
|
```sh
|
||||||
|
dotnet test -p:UseRaylibCsPackage=true
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that `NuGet.config` points restore at the local `./nuget` feed, so both projects pick up the freshly packed
|
||||||
|
package. If you skip the pack step on a fresh clone, restore fails with NU1301 (the `./nuget` source
|
||||||
|
doesn't exist) or NU1102 (Raylib-cs not found) - running the pack command fixes both.
|
||||||
|
|
||||||
|
When iterating on the binding itself, note that NuGet caches the extracted package by version and
|
||||||
|
ignores repacks of the same version. After repacking, delete the old package from `./nuget` and clear
|
||||||
|
the cached copy (`dotnet nuget locals global-packages --clear`, or delete
|
||||||
|
`~/.nuget/packages/raylib-cs/<version>`) before restoring again.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue