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

Multi-target net5.0

This commit is contained in:
2021-12-17 12:48:56 +00:00
parent 6d7ac90088
commit 3e8e4a6319
7 changed files with 232 additions and 212 deletions

View File

@@ -20,9 +20,9 @@ jobs:
with:
dotnet-version: 6.0.x
- name: Build project
run: dotnet build -c Release
run: dotnet build -c Release -f net6.0
- name: Test project
run: dotnet test
run: dotnet test -c Release -f net6.0
publish:
name: Build Release Package
runs-on: ubuntu-latest

View File

@@ -12,7 +12,7 @@ C# bindings for raylib 4.0.0, a simple and easy-to-use library to learn videogam
[![Build](https://github.com/ChrisDill/Raylib-cs/workflows/Build/badge.svg)](https://github.com/ChrisDill/Raylib-cs/actions?query=workflow%3ABuild)
Raylib-cs targets net6.0.
Raylib-cs targets net5.0 and net6.0.
## Installation - NuGet

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems>
<AssemblyName>Raylib-cs</AssemblyName>
<RootNamespace>Raylib_cs</RootNamespace>

View File

@@ -274,6 +274,24 @@ namespace Raylib_cs
}
}
/// <inheritdoc cref="ImageDrawPixel(Image*, int, int, Color)"/>
public static void ImageDrawPixel(ref Image dst, int posX, int posY, Color color)
{
fixed (Image* p = &dst)
{
ImageDrawPixel(p, posX, posY, color);
}
}
/// <inheritdoc cref="ImageDrawPixelV(Image*, Vector2, Color)"/>
public static void ImageDrawPixelV(ref Image dst, Vector2 position, Color color)
{
fixed (Image* p = &dst)
{
ImageDrawPixelV(p, position, color);
}
}
/// <inheritdoc cref="ImageDrawText(Image*, byte*, int, int, int, Color)"/>
public static void ImageDrawText(ref Image dst, Utf8String text, int x, int y, int fontSize, Color color)
{

View File

@@ -1,11 +1,11 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs;
[StructLayout(LayoutKind.Sequential)]
public readonly struct CBool
namespace Raylib_cs
{
[StructLayout(LayoutKind.Sequential)]
public readonly struct CBool
{
private readonly byte value;
private CBool(bool value)
@@ -27,4 +27,5 @@ public readonly struct CBool
{
return Convert.ToBoolean(value).ToString();
}
}
}

View File

@@ -1,13 +1,13 @@
using System;
using System.Text;
namespace Raylib_cs;
namespace Raylib_cs
{
#region LICENSE
#region LICENSE
// ** -- TAKEN FROM SQLitePCL.raw -- ** \\
/* https://github.com/ericsink/SQLitePCL.raw */
/*
// ** -- TAKEN FROM SQLitePCL.raw -- ** \\
/* https://github.com/ericsink/SQLitePCL.raw */
/*
Copyright 2014-2021 SourceGear, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -18,21 +18,21 @@ namespace Raylib_cs;
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
*/
// CHANGES:
// - Update Method Names
// - Implicit Conversion From string
// CHANGES:
// - Update Method Names
// - Implicit Conversion From string
#endregion
#endregion
/// <summary>
/// A raw string representation suitable for passing into many core SQLite apis. These will normally be pointers to
/// utf8 encoded bytes, with a trailing <c>\0</c> terminator. <see langword="null"/> strings can be represented as
/// well as empty strings.
/// </summary>
public readonly ref struct Utf8String
{
/// <summary>
/// A raw string representation suitable for passing into many core SQLite apis. These will normally be pointers to
/// utf8 encoded bytes, with a trailing <c>\0</c> terminator. <see langword="null"/> strings can be represented as
/// well as empty strings.
/// </summary>
public readonly ref struct Utf8String
{
// this span will contain a zero terminator byte
// if sp.Length is 0, it represents a null string
// if sp.Length is 1, the only byte must be zero, and it is an empty string
@@ -187,10 +187,10 @@ public readonly ref struct Utf8String
{
return FromString(s);
}
}
}
public static class Utf8StringUtils
{
public static class Utf8StringUtils
{
public static byte[] ToUtf8String(this string sourceText)
{
if (sourceText == null)
@@ -206,4 +206,5 @@ public static class Utf8StringUtils
return byteArray;
}
}
}