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: with:
dotnet-version: 6.0.x dotnet-version: 6.0.x
- name: Build project - name: Build project
run: dotnet build -c Release run: dotnet build -c Release -f net6.0
- name: Test project - name: Test project
run: dotnet test run: dotnet test -c Release -f net6.0
publish: publish:
name: Build Release Package name: Build Release Package
runs-on: ubuntu-latest 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) [![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 ## Installation - NuGet

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems> <EnableDefaultItems>false</EnableDefaultItems>
<AssemblyName>Raylib-cs</AssemblyName> <AssemblyName>Raylib-cs</AssemblyName>
<RootNamespace>Raylib_cs</RootNamespace> <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)"/> /// <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) 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;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace Raylib_cs; namespace Raylib_cs
[StructLayout(LayoutKind.Sequential)]
public readonly struct CBool
{ {
[StructLayout(LayoutKind.Sequential)]
public readonly struct CBool
{
private readonly byte value; private readonly byte value;
private CBool(bool value) private CBool(bool value)
@@ -27,4 +27,5 @@ public readonly struct CBool
{ {
return Convert.ToBoolean(value).ToString(); return Convert.ToBoolean(value).ToString();
} }
}
} }

View File

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