# Raylib-CSharp\*

Raylib är från början ett bibliotek till C++, och Raylib-cs är inte det enda sättet att koppla Raylib till C#. **Raylib-CSharp** är ett annat paket, som funkar delvis annorlunda.

## Separata bibliotek

Raylib-CSharp är mer uppdelat än Raylib-cs. Varje kategori av funktioner har sitt eget bibliotek, som man måste inkludera via [using](/grundlaggande/anvaenda-bibliotek-using.md).

```csharp
using System.Numerics;
using Raylib_CSharp.Colors;
using Raylib_CSharp.Rendering;
using Raylib_CSharp.Windowing;

Window.Init(800, 600, "Hello");

Vector2 position = new (400, 300);

while (!Window.ShouldClose())
{
  Graphics.BeginDrawing();
  Graphics.ClearBackground(Color.Green);

  Graphics.DrawCircleV(position, 40, Color.Black);

  Graphics.EndDrawing();
}
```

## Funktioner

| Raylib-cs                | Raylib-CSharp            | Bibliotek      |
| ------------------------ | ------------------------ | -------------- |
| Raylib.InitWindow        | Window\.Init             | Windowing      |
| Raylib.SetTargetFPS      | Time.SetTargetFPS        | Raylib\_CSharp |
| Raylib.WindowShouldClose | Window\.ShouldClose      | Windowing      |
| Raylib.BeginDrawing      | Graphics.BeginDrawing    | Rendering      |
| Raylib.EndDrawing        | Graphics.EndDrawing      | Rendering      |
| Raylib.ClearBackground   | Graphics.ClearBackground | Rendering      |
| Raylib.DrawRectangle     | Graphics.DrawRectangle   | Rendering      |
| Raylib.DrawCircle        | Graphics.DrawCircle      | Rendering      |
| Raylib.DrawLine          | Graphics.DrawLine        | Rendering      |
|                          |                          |                |

Varianter av funktionerna – DrawRectangleRec, DrawRectangleLines osv finns såklart också.

## Datatyper

| Struct    | Bibliotek       |
| --------- | --------------- |
| Rectangle | Transformations |
| Color     | Colors          |
| Texture   | Textures        |
| Image     | Images          |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://csharp.progdocs.se/annat/raylib/raylib-csharp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
