2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-09-09 03:01:41 -04:00

Merge branch 'master' into dev

This commit is contained in:
2023-08-07 20:05:03 +01:00
committed by GitHub
5 changed files with 218 additions and 125 deletions

View File

@@ -1,7 +1,7 @@
---
name: new issue template
about: generic template for new issues
title: "[module] Short description of the issue/bug/feature"
title: "Short description of the issue/bug/feature"
labels: ''
assignees: ''
---
@@ -14,11 +14,14 @@ Before submitting a new issue, please verify and check:
### Issue description
*Briefly describe the issue you are experiencing (or the feature you want to see added to Raylib-cs). Tell us what you were trying to do and what happened instead. You can also ask questions on the [raylib discord server](https://discord.gg/raylib).*
*Briefly describe the issue you are experiencing (or the feature you want to see added to Raylib-cs). Tell us
what you were trying to do and what happened instead. You can also ask questions on the
[raylib discord server](https://discord.gg/raylib).*
### Environment
*Provide your Platform, Operating System, OpenGL version, GPU, Raylib-cs version, Raylib version (if applicable), and details of where or how you experienced the issue.*
*Provide your Platform, Operating System, OpenGL version, GPU, Raylib-cs version, Raylib version (if applicable),
and details of where or how you experienced the issue.*
### Issue screenshot
@@ -26,4 +29,5 @@ Before submitting a new issue, please verify and check:
### Code example
*Provide minimal reproduction code to test the issue. Please, format the code properly and try to keep it as simple as possible, just focusing on the experienced issue.*
*Provide minimal reproduction code to test the issue. Please, format the code properly and try to keep it as simple
as possible, just focusing on the experienced issue.*

View File

@@ -8,143 +8,184 @@ on:
- 'README.md'
- '.github/ISSUE_TEMPLATE/**'
workflow_dispatch:
jobs:
build:
name: Build on dotnet using ${{ matrix.os }}
runs-on: ${{ matrix.os }}
prepare:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
pkgversion: ${{ steps.version.outputs.pkgversion }}
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: check raylib version
id: version
shell: bash
run: |
echo "version=$(sed -n 's/.*<TargetRaylibTag>\(.*\)<\/TargetRaylibTag>.*/\1/p' Raylib-cs/Raylib-cs.csproj)">> ${GITHUB_OUTPUT}
echo "pkgversion=$(sed -n 's/.*<PackageVersion>\(.*\)<\/PackageVersion>.*/\1/p' Raylib-cs/Raylib-cs.csproj)">> ${GITHUB_OUTPUT}
build-linux:
runs-on: ubuntu-latest
needs: prepare
steps:
- name: setup dependencies
run: |
sudo apt install \
libasound2-dev \
libx11-dev \
libxrandr-dev \
libxi-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libxcursor-dev \
libxinerama-dev
- name: build raylib
env:
version: ${{ needs.prepare.outputs.version }}
run: |
curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/refs/tags/${version}.zip
unzip -qq raylib.zip
cmake -S raylib-${version} \
-B build \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_SHARED_LIBS=ON \
-D BUILD_EXAMPLES=OFF
cmake --build build --config Release
- name: upload build
uses: actions/upload-artifact@v3
with:
name: linux-x64
path: build/raylib/libraylib.so
if-no-files-found: error
build-osx:
runs-on: macos-latest
needs: prepare
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
name: [arm64, x64]
include:
- name: arm64
arch: arm64
- name: x64
arch: x86_64
steps:
- uses: actions/checkout@v2
- name: Setup dotnet
uses: actions/setup-dotnet@v1
- name: build raylib
env:
version: ${{ needs.prepare.outputs.version }}
run: |
curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/refs/tags/${version}.zip
unzip -qq raylib.zip
cmake -S raylib-${version} \
-B build \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
-D BUILD_SHARED_LIBS=ON \
-D BUILD_EXAMPLES=OFF
cmake --build build --config Release
- name: upload build
uses: actions/upload-artifact@v3
with:
dotnet-version: 6.0.x
- name: Build project
run: dotnet build -c Release -f net6.0
- name: Test project
run: dotnet test -c Release -f net6.0
name: osx-${{ matrix.name }}
path: build/raylib/libraylib.dylib
if-no-files-found: error
build-windows:
runs-on: windows-latest
needs: prepare
strategy:
matrix:
name: [x86, x64]
include:
- name: x86
arch: win32
- name: x64
arch: x64
steps:
- name: build ${{ matrix.arch }}
shell: bash
env:
version: ${{ needs.prepare.outputs.version }}
run: |
curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/refs/tags/${version}.zip
unzip -qq raylib.zip
cmake -S raylib-${version} \
-A ${{ matrix.arch }} \
-B build \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_SHARED_LIBS=ON \
-D BUILD_EXAMPLES=OFF
cmake --build build --config Release
- name: upload build
uses: actions/upload-artifact@v3
with:
name: win-${{ matrix.name }}
path: build/raylib/Release/raylib.dll
if-no-files-found: error
publish:
name: Build Release Package
runs-on: ubuntu-latest
needs: build
needs:
- prepare
- build-linux
- build-osx
- build-windows
steps:
- uses: actions/checkout@v2
- name: checkout repository
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: linux-x64
path: Raylib-cs/runtimes/linux-x64/native
- uses: actions/download-artifact@v3
with:
name: osx-arm64
path: Raylib-cs/runtimes/osx-arm64/native
- uses: actions/download-artifact@v3
with:
name: osx-x64
path: Raylib-cs/runtimes/osx-x64/native
- uses: actions/download-artifact@v3
with:
name: win-x86
path: Raylib-cs/runtimes/win-x86/native
- uses: actions/download-artifact@v3
with:
name: win-x64
path: Raylib-cs/runtimes/win-x64/native
- name: Setup dotnet
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Download Repo
uses: actions/checkout@v2
- id: get-tag
name: Get Target Raylib Version
uses: mavrosxristoforos/get-xml-info@1.0
with:
xml-file: "./Raylib-cs/Raylib-cs.csproj"
xpath: "//TargetRaylibTag"
- name: echo tag
run: echo ${{ steps.get-tag.outputs.info }}
- name: Download win-x64 Raylib Release
uses: robinraju/release-downloader@v1.3
with:
repository: "raysan5/raylib"
tag: ${{ steps.get-tag.outputs.info }}
fileName: "raylib-${{steps.get-tag.outputs.info}}_win64_msvc16.zip"
- name: extract win-x64
uses: montudor/action-zip@v1
with:
args: unzip -qq raylib-${{steps.get-tag.outputs.info}}_win64_msvc16.zip -d raylib-win64
- name: copy win-x64
uses: canastro/copy-file-action@master
with:
source: "raylib-win64/raylib-${{steps.get-tag.outputs.info}}_win64_msvc16/lib/raylib.dll"
target: "Raylib-cs/runtimes/win-x64/native/raylib.dll"
- name: Download win-x86 Raylib Release
uses: robinraju/release-downloader@v1.3
with:
repository: "raysan5/raylib"
tag: ${{ steps.get-tag.outputs.info }}
fileName: "raylib-${{steps.get-tag.outputs.info}}_win32_msvc16.zip"
- name: extract win-x86
uses: montudor/action-zip@v1
with:
args: unzip -qq raylib-${{steps.get-tag.outputs.info}}_win32_msvc16.zip -d raylib-win86
- name: copy win-x86
uses: canastro/copy-file-action@master
with:
source: "raylib-win86/raylib-${{steps.get-tag.outputs.info}}_win32_msvc16/lib/raylib.dll"
target: "Raylib-cs/runtimes/win-x86/native/raylib.dll"
- name: Download linux-x64 Raylib Release
uses: robinraju/release-downloader@v1.3
with:
repository: "raysan5/raylib"
tag: ${{ steps.get-tag.outputs.info }}
fileName: "raylib-${{steps.get-tag.outputs.info}}_linux_amd64.tar.gz"
- name: extract linux-x64
run: mkdir -p raylib-linux64 && tar -xvf raylib-${{steps.get-tag.outputs.info}}_linux_amd64.tar.gz -C raylib-linux64
- name: copy linux-x64
uses: canastro/copy-file-action@master
with:
source: "raylib-linux64/raylib-${{steps.get-tag.outputs.info}}_linux_amd64/lib/libraylib.so.${{steps.get-tag.outputs.info}}"
target: "Raylib-cs/runtimes/linux-x64/native/libraylib.so"
- name: Download osx-x64 Raylib Release
uses: robinraju/release-downloader@v1.3
with:
repository: "raysan5/raylib"
tag: ${{ steps.get-tag.outputs.info }}
fileName: "raylib-${{steps.get-tag.outputs.info}}_macos.tar.gz"
- name: extract osx-x64
run: mkdir -p raylib-osx64 && tar -xvf raylib-${{steps.get-tag.outputs.info}}_macos.tar.gz -C raylib-osx64
- name: copy osx-x64
uses: canastro/copy-file-action@master
with:
source: "raylib-osx64/raylib-${{steps.get-tag.outputs.info}}_macos/lib/libraylib.dylib"
target: "Raylib-cs/runtimes/osx-x64/native/libraylib.dylib"
- name: copy osx-arm64
uses: canastro/copy-file-action@master
with:
source: "raylib-osx64/raylib-${{steps.get-tag.outputs.info}}_macos/lib/libraylib.dylib"
target: "Raylib-cs/runtimes/osx-arm64/native/libraylib.dylib"
- id: get-nuget-version
name: Get NuGet Package Version
uses: mavrosxristoforos/get-xml-info@1.0
with:
xml-file: "./Raylib-cs/Raylib-cs.csproj"
xpath: "//PackageVersion"
- name: Create NuGet Package
run: dotnet pack -c Release Raylib-cs
- name: Upload NuGet Package As Artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Raylib-cs.${{steps.get-nuget-version.outputs.info}}.nupkg
path: Raylib-cs/bin/Release/Raylib-cs.${{steps.get-nuget-version.outputs.info}}.nupkg
path: Raylib-cs/bin/Release/Raylib-cs.${{ needs.prepare.outputs.pkgversion }}.*pkg
- name: Upload NuGet Package As Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: Raylib-cs/bin/Release/Raylib-cs.${{steps.get-nuget-version.outputs.info}}.nupkg
files: Raylib-cs/bin/Release/Raylib-cs.${{ needs.prepare.outputs.pkgversion }}.*pkg
- name: Publish to NuGet
if: startsWith(github.ref, 'refs/tags/')
run: dotnet nuget push Raylib-cs/bin/Release/Raylib-cs.${{steps.get-nuget-version.outputs.info}}.nupkg --api-key ${{secrets.NUGET_API_KEY}}
run: |
dotnet nuget push \
Raylib-cs/bin/Release/Raylib-cs.${{ needs.prepare.outputs.pkgversion }}.nupkg \
--api-key ${{secrets.NUGET_API_KEY}}

View File

@@ -19,7 +19,7 @@ Raylib-cs targets net5.0 and net6.0.
This is the prefered method to get started.
```
dotnet add package Raylib-cs --version 4.5.0.2
dotnet add package Raylib-cs
```
[![NuGet](https://img.shields.io/nuget/dt/raylib-cs)](https://www.nuget.org/packages/Raylib-cs/)

View File

@@ -12,10 +12,12 @@
<PropertyGroup>
<TargetRaylibTag>4.5.0</TargetRaylibTag>
<Version>4.5.0.2</Version>
<PackageVersion>4.5.0.2</PackageVersion>
<Version>4.5.0.3</Version>
<PackageVersion>4.5.0.3</PackageVersion>
<Authors>Chris Dill, Raysan5</Authors>
<PackProject>true</PackProject>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageLicenseExpression>Zlib</PackageLicenseExpression>
<Title>Raylib-cs</Title>
<Description>C# bindings for raylib - A simple and easy-to-use library to learn videogames programming</Description>
@@ -23,6 +25,7 @@
<PackageTags>raylib;bindings;gamedev</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/ChrisDill/Raylib-cs/</RepositoryUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageProjectUrl>https://www.raylib.com/</PackageProjectUrl>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
@@ -35,6 +38,7 @@
<ItemGroup>
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
</ItemGroup>
<ItemGroup>

View File

@@ -39,6 +39,20 @@ namespace Raylib_cs
SetClipboardText(str1.AsPointer());
}
/// <summary>Open URL with default system browser (if available)</summary>
public static void OpenURL(string url)
{
using var str1 = url.ToUTF8Buffer();
OpenURL(str1.AsPointer());
}
/// <summary>Set internal gamepad mappings (SDL_GameControllerDB)</summary>
public static int SetGamepadMappings(string mappings)
{
using var str1 = mappings.ToUTF8Buffer();
return SetGamepadMappings(str1.AsPointer());
}
/// <summary>Load shader from files and bind default locations</summary>
public static Shader LoadShader(string vsFileName, string fsFileName)
{
@@ -652,6 +666,36 @@ namespace Raylib_cs
return LoadTexture(str1.AsPointer());
}
/// <summary>Update GPU texture with new data</summary>
public static void UpdateTexture<T>(Texture2D texture, T[] pixels) where T : unmanaged
{
UpdateTexture(texture, (ReadOnlySpan<T>)pixels);
}
/// <summary>Update GPU texture with new data</summary>
public static void UpdateTexture<T>(Texture2D texture, ReadOnlySpan<T> pixels) where T : unmanaged
{
fixed (void* pixelPtr = pixels)
{
UpdateTexture(texture, pixelPtr);
}
}
/// <summary>Update GPU texture rectangle with new data</summary>
public static void UpdateTextureRec<T>(Texture2D texture, Rectangle rec, T[] pixels) where T : unmanaged
{
UpdateTextureRec(texture, rec, (ReadOnlySpan<T>)pixels);
}
/// <summary>Update GPU texture rectangle with new data</summary>
public static void UpdateTextureRec<T>(Texture2D texture, Rectangle rec, ReadOnlySpan<T> pixels) where T : unmanaged
{
fixed (void* pixelPtr = pixels)
{
UpdateTextureRec(texture, rec, pixelPtr);
}
}
/// <summary>Generate GPU mipmaps for a texture</summary>
public static void GenTextureMipmaps(ref Texture2D texture)
{