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

Fix INTERNAL functions

This commit is contained in:
2021-12-16 12:18:45 +00:00
parent f3dd16f31f
commit fb1c21a3fa
2 changed files with 16 additions and 22 deletions

View File

@@ -32,7 +32,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Toolkit.HighPerformance" Version="7.1.2" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" /> <PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup> </ItemGroup>

View File

@@ -1,12 +1,7 @@
using System; using System;
using System.Buffers;
using System.Numerics; using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security; using System.Security;
using System.Text;
using System.Text.Unicode;
using System.Xml;
using Microsoft.Toolkit.HighPerformance;
namespace Raylib_cs namespace Raylib_cs
{ {
@@ -239,23 +234,23 @@ namespace Raylib_cs
public static extern Vector2 GetWindowScaleDPI(); public static extern Vector2 GetWindowScaleDPI();
/// <summary>Get the human-readable, UTF-8 encoded name of the primary monitor</summary> /// <summary>Get the human-readable, UTF-8 encoded name of the primary monitor</summary>
[DllImport(nativeLibName, EntryPoint = "GetMonitorName", CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_GetMonitorName(int monitor); public static extern byte* GetMonitorName(int monitor);
/// <summary>Get the human-readable, UTF-8 encoded name of the primary monitor</summary> /// <summary>Get the human-readable, UTF-8 encoded name of the primary monitor</summary>
public static string GetMonitorName(int monitor) public static Utf8String GetMonitorName_(int monitor)
{ {
return Marshal.PtrToStringUTF8(INTERNAL_GetMonitorName(monitor)); return Utf8String.FromPtr(GetMonitorName(monitor));
} }
/// <summary>Get clipboard text content</summary> /// <summary>Get clipboard text content</summary>
[DllImport(nativeLibName, EntryPoint = "GetClipboardText", CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_GetClipboardText(); public static extern byte* GetClipboardText();
/// <summary>Get clipboard text content</summary> /// <summary>Get clipboard text content</summary>
public static string GetClipboardText() public static Utf8String GetClipboardText_()
{ {
return Marshal.PtrToStringUTF8(INTERNAL_GetClipboardText()); return Utf8String.FromPtr(GetClipboardText());
} }
/// <summary>Set clipboard text content</summary> /// <summary>Set clipboard text content</summary>
@@ -528,13 +523,13 @@ namespace Raylib_cs
// WARNING: Callbacks setup is intended for advance users // WARNING: Callbacks setup is intended for advance users
/// <summary>Set custom trace log</summary> /// <summary>Set custom trace log</summary>
[DllImport(nativeLibName, EntryPoint = "SetTraceLogCallback", CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
private static extern void SetTraceLogCallbackInternal(TraceLogCallback callback); public static extern void SetTraceLogCallback(TraceLogCallback callback);
/// <summary>Set custom trace log</summary> /// <summary>Set custom trace log</summary>
public static void SetTraceLogCallback(TraceLogCallback callback) public static void SetTraceLogCallback_(TraceLogCallback callback)
{ {
SetTraceLogCallbackInternal(callback); SetTraceLogCallback(callback);
traceLogCallback = callback; traceLogCallback = callback;
} }
@@ -654,13 +649,13 @@ namespace Raylib_cs
public static extern CBool IsGamepadAvailable(int gamepad); public static extern CBool IsGamepadAvailable(int gamepad);
/// <summary>Return gamepad internal name id</summary> /// <summary>Return gamepad internal name id</summary>
[DllImport(nativeLibName, EntryPoint = "GetGamepadName", CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_GetGamepadName(int gamepad); public static extern byte* GetGamepadName(int gamepad);
/// <summary>Return gamepad internal name id</summary> /// <summary>Return gamepad internal name id</summary>
public static string GetGamepadName(int gamepad) public static Utf8String GetGamepadName_(int gamepad)
{ {
return Marshal.PtrToStringUTF8(INTERNAL_GetGamepadName(gamepad)); return Utf8String.FromPtr(GetGamepadName(gamepad));
} }
/// <summary>Detect if a gamepad button has been pressed once</summary> /// <summary>Detect if a gamepad button has been pressed once</summary>