SilkRay 2025.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package SilkRay --version 2025.1.1
                    
NuGet\Install-Package SilkRay -Version 2025.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SilkRay" Version="2025.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SilkRay" Version="2025.1.1" />
                    
Directory.Packages.props
<PackageReference Include="SilkRay" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SilkRay --version 2025.1.1
                    
#r "nuget: SilkRay, 2025.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SilkRay@2025.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SilkRay&version=2025.1.1
                    
Install as a Cake Addin
#tool nuget:?package=SilkRay&version=2025.1.1
                    
Install as a Cake Tool

SilkRay

A C# implementation of core Raylib functions using Silk.NET OpenGL bindings.

Overview

SilkRay provides a familiar Raylib-style API for 2D graphics programming in C# using modern Silk.NET libraries. It implements the core functionality from Raylib's rcore and rshapes modules.

Features

Core Functions (rcore)

  • Window management (InitWindow, CloseWindow, WindowShouldClose)
  • Drawing lifecycle (BeginDrawing, EndDrawing, ClearBackground)
  • Screen properties (GetScreenWidth, GetScreenHeight)
  • Timing functions (GetTime, GetFrameTime, GetFPS)

Shape Drawing (rshapes)

  • Pixels: DrawPixel, DrawPixelV
  • Lines: DrawLine, DrawLineV, DrawLineEx
  • Rectangles: DrawRectangle, DrawRectangleV, DrawRectangleRec, DrawRectangleLines
  • Circles: DrawCircle, DrawCircleV, DrawCircleLines

Data Structures

  • Color - RGBA color with predefined constants
  • Vector2 - 2D vector math operations
  • Rectangle - Rectangle structure for bounds

Quick Start

using SilkRay;

// Initialize window
Raylib.InitWindow(800, 450, "My SilkRay App");
Raylib.SetTargetFPS(60);

// Main loop
while (!Raylib.WindowShouldClose())
{
    Raylib.BeginDrawing();
    
    Raylib.ClearBackground(Color.RayWhite);
    
    // Draw shapes
    Raylib.DrawRectangle(100, 100, 200, 100, Color.Red);
    Raylib.DrawCircle(400, 200, 50, Color.Blue);
    Raylib.DrawLine(0, 0, 800, 450, Color.Green);
    
    Raylib.EndDrawing();
}

Raylib.CloseWindow();

Examples

The project includes several example programs:

  1. Basic Shapes - Demonstrates all shape drawing functions
  2. Animation - Shows a bouncing ball with trail effects
  3. Color Palette - Displays all predefined colors

Run examples:

Example.RunBasicShapesExample();
Example.RunAnimatedExample();
Example.RunColorPaletteExample();

Building

dotnet restore
dotnet build
dotnet run

Dependencies

  • Silk.NET.OpenGL (2.20.0)
  • Silk.NET.Windowing (2.20.0)
  • Silk.NET.Input (2.20.0)
  • .NET 8.0

Architecture

  • Raylib.cs - Main API that matches Raylib function signatures
  • Renderer.cs - OpenGL rendering backend using Silk.NET
  • Shader.cs - Shader program management
  • Color.cs - Color utilities and predefined constants
  • Vector2.cs - 2D math operations

Limitations

  • Text rendering not yet implemented
  • Input handling is basic (placeholders for keyboard/mouse)
  • Limited to 2D graphics
  • No texture/image loading
  • No audio support

Future Enhancements

  • Font loading and text rendering
  • Complete input system implementation
  • Texture and sprite support
  • Additional shape primitives
  • Performance optimizations

License

This project is provided as-is for educational and development purposes.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2025.1.2 273 9/16/2025
2025.1.1 274 9/16/2025
2025.1.0 272 9/16/2025

Updated release with README.md included in package