mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-06-30 19:03:42 -04:00
4.0 (#100)
* Fix formatting/update doc comments in Raylib.cs * Update types in Raylib.cs to 4.0 * Remove app.config * Update Raylib.cs functions * Split Enums, Structs & Classes into own files * Testing utils for Raylib.cs * Update Raylib-cs.csproj * Reorganize types - Move into types folder - Group types based on usage * Fix parameter names * Rename CloseAudioStream to UnloadAudioStream * Remove ref SetShaderValue overloads * Remove some constants from Raylib.cs * Include README.md in package * Replace old version of GetDroppedUtils * Update README.md * Remove Physac-cs and Raygui-cs - Not actively maintained and a pain for users to setup... * Update comments to xmldoc * Rename Gestures enum to Gesture * Minor fixes - Rename Gestures enum to Gesture - Update tests to net6.0 * Testing CBool type instead of bool * Update XmlDoc comments * Update build.yml to net6.0 for tests * Remove Easings.cs - Easings used to be part of raylib. It is now a separate extra library so I am removing it from the main bindings. * Update rlgl * More XmlDoc comments * Use CBool in structs * Big unsafe update * Fix typos and change refs to pointers in Rlgl * Update LoggingUtils and Material * Fix typo in Rlgl * Update build.yml * Rename RaylibUtils.cs to Raylib.Utils now a partial class * Convert some RLGL consts to Enums Also added helper methods/overloads for related methods * Make class Raylib partial * Convert some text functions to not use ref I dont think they will work. need testing * Testing fixes for Text functions * Create rlMultMatrixf safe overload * Implement safe ModelAnimation * Testing fix for ModelAnimation using wrapper struct * Added TODOs * Fix rlMultMatrixf - Add missing ToFloatV functions to Raymath - Fix rlMultMatrixf overload to use MatrixToFloatV * Fix IsGestureDetected and formatting * Add a few text tests * Move wrapper functions into Raylib.Utils * Remove ref from raylib bindings * Multi-target net5.0 * Testing string approaches * Fixing more util and unsafe functions * Testing TraceLogCallback fix Set lang version to C# 10 * Replace managed callbacks with unsafe delegates * Update default LogConsole callback * Setup unsafe/safe functions for math types in Raylib.cs * Replace string in Rlgl with sbyte* * Yet more string changes - Use sbyte/byte correctly in Raylib.cs - Using Marshal.StringToCoTaskMemUTF8 - Update utils string usage * Fix typo bug and whitespace * Fix DrawTextPro and more whitespace * Remove unused ToString * Add file functions back into Raylib * Test paths filter for pull requests * Change to paths-ignore filter * Redo partial change * Move binding functions into interop folder Co-authored-by: Ben Parsons <9parsonsb@gmail.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5.0</TargetFrameworks>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ApplicationIcon>../Logo/raylib-cs.ico</ApplicationIcon>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
@ -13,6 +13,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Raylib-cs/Raylib-cs.csproj" />
|
||||
<PackageReference Include="Raylib-cs" Version="4.0.0-alpha.2" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,43 +1,95 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Raylib_cs;
|
||||
|
||||
namespace Raylib_cs.Tests
|
||||
{
|
||||
public class RaylibTests
|
||||
{
|
||||
// Test if binding structs are blittable.
|
||||
[Fact]
|
||||
public void IsBlittable()
|
||||
private unsafe void CheckType<T>() where T : unmanaged
|
||||
{
|
||||
Assert.True(BlittableHelper.IsBlittable<Color>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Rectangle>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Image>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Texture2D>());
|
||||
Assert.True(BlittableHelper.IsBlittable<RenderTexture2D>());
|
||||
Assert.True(BlittableHelper.IsBlittable<NPatchInfo>());
|
||||
Assert.True(BlittableHelper.IsBlittable<CharInfo>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Font>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Camera3D>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Camera2D>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Mesh>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Shader>());
|
||||
Assert.True(BlittableHelper.IsBlittable<MaterialMap>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Material>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Transform>());
|
||||
Assert.True(BlittableHelper.IsBlittable<BoneInfo>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Model>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Model>());
|
||||
Assert.True(BlittableHelper.IsBlittable<ModelAnimation>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Ray>());
|
||||
Assert.True(BlittableHelper.IsBlittable<RayHitInfo>());
|
||||
Assert.True(BlittableHelper.IsBlittable<BoundingBox>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Wave>());
|
||||
Assert.True(BlittableHelper.IsBlittable<AudioStream>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Sound>());
|
||||
Assert.True(BlittableHelper.IsBlittable<Music>());
|
||||
Assert.True(BlittableHelper.IsBlittable<VrDeviceInfo>());
|
||||
Assert.True(BlittableHelper.IsBlittable<VrStereoConfig>());
|
||||
Assert.True(BlittableHelper.IsBlittable<RenderBatch>());
|
||||
Assert.True(BlittableHelper.IsBlittable<T>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CheckTypes()
|
||||
{
|
||||
CheckType<Color>();
|
||||
CheckType<Rectangle>();
|
||||
CheckType<Image>();
|
||||
CheckType<Texture2D>();
|
||||
CheckType<RenderTexture2D>();
|
||||
CheckType<NPatchInfo>();
|
||||
CheckType<GlyphInfo>();
|
||||
CheckType<Font>();
|
||||
CheckType<Camera2D>();
|
||||
CheckType<Camera3D>();
|
||||
CheckType<Mesh>();
|
||||
CheckType<Shader>();
|
||||
CheckType<MaterialMap>();
|
||||
CheckType<Material>();
|
||||
CheckType<Transform>();
|
||||
CheckType<BoneInfo>();
|
||||
CheckType<Model>();
|
||||
CheckType<ModelAnimation>();
|
||||
CheckType<Ray>();
|
||||
CheckType<RayCollision>();
|
||||
CheckType<BoundingBox>();
|
||||
CheckType<Wave>();
|
||||
CheckType<AudioStream>();
|
||||
CheckType<Sound>();
|
||||
CheckType<Music>();
|
||||
CheckType<VrDeviceInfo>();
|
||||
CheckType<VrStereoConfig>();
|
||||
CheckType<RenderBatch>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TextToInteger()
|
||||
{
|
||||
int value = Raylib.TextToInteger("99999");
|
||||
Assert.Equal(99999, value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TextToPascal()
|
||||
{
|
||||
string input = "hello_world";
|
||||
string text = Raylib.TextToPascal(input).ToString();
|
||||
Assert.Equal("HelloWorld", text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LoadCodepoints()
|
||||
{
|
||||
int count = 0;
|
||||
string input = "aàáâãäāăąȧXǎȁȃeèéêẽëē";
|
||||
int[] codepoints1 = Raylib.LoadCodepoints(input, ref count);
|
||||
|
||||
for (int i = 0; i < input.Length; i++)
|
||||
{
|
||||
Assert.Equal(input[i], codepoints1[i]);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CodepointToUTF8()
|
||||
{
|
||||
int byteSize = 0;
|
||||
string text = Raylib.CodepointToUTF8(224, ref byteSize).ToString();
|
||||
Assert.Equal("à", text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TextCodepointsToUTF8()
|
||||
{
|
||||
string input = "aàáâãäāăąȧXǎȁȃeèéêẽëē";
|
||||
|
||||
int count = 0;
|
||||
int[] codepoints1 = Raylib.LoadCodepoints(input, ref count);
|
||||
|
||||
string text = Raylib.TextCodepointsToUTF8(codepoints1, codepoints1.Length).ToString();
|
||||
Assert.Equal(input, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user