From e2fc83717f921cfabe3e0f7adc5d969eef3d6ef2 Mon Sep 17 00:00:00 2001 From: ChrisDill Date: Wed, 29 Dec 2021 17:02:50 +0000 Subject: [PATCH] Update default LogConsole callback --- Raylib-cs/Logging.cs | 9 +++++---- Raylib-cs/Raylib.cs | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Raylib-cs/Logging.cs b/Raylib-cs/Logging.cs index aeebc0c..db0f3fe 100644 --- a/Raylib-cs/Logging.cs +++ b/Raylib-cs/Logging.cs @@ -37,16 +37,17 @@ namespace Raylib_cs /// /// Logging workaround for formatting strings from native code /// - public static class Logging + public static unsafe class Logging { static Logging() { - Raylib.SetTraceLogCallback(LogConsole); + Raylib.SetTraceLogCallback(&LogConsole); } - public static void LogConsole(TraceLogLevel msgType, IntPtr text, IntPtr args) + [UnmanagedCallersOnly(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })] + public static unsafe void LogConsole(int msgType, sbyte* text, sbyte* args) { - var message = GetLogMessage(text, args); + var message = GetLogMessage(new IntPtr(text), new IntPtr(args)); Console.WriteLine(message); } diff --git a/Raylib-cs/Raylib.cs b/Raylib-cs/Raylib.cs index a96870b..2481d73 100644 --- a/Raylib-cs/Raylib.cs +++ b/Raylib-cs/Raylib.cs @@ -24,7 +24,6 @@ namespace Raylib_cs /// public static Color Fade(Color color, float alpha) => ColorAlpha(color, alpha); - //------------------------------------------------------------------------------------ // Window and Graphics Device Functions (Module: core) //------------------------------------------------------------------------------------