b451f83174
Captures the pre-Godot-port state of the codebase. This is the rollback anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md). All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
21 lines
685 B
C#
21 lines
685 B
C#
using System.Runtime.InteropServices;
|
|
|
|
namespace Theriapolis.Game.Platform;
|
|
|
|
/// <summary>
|
|
/// Cross-platform clipboard writer via SDL2, which MonoGame.Framework.DesktopGL
|
|
/// already loads. Silently no-ops if the native call fails so debug-only callers
|
|
/// never crash the game.
|
|
/// </summary>
|
|
public static class Clipboard
|
|
{
|
|
[DllImport("SDL2", EntryPoint = "SDL_SetClipboardText", CallingConvention = CallingConvention.Cdecl)]
|
|
private static extern int SDL_SetClipboardText([MarshalAs(UnmanagedType.LPUTF8Str)] string text);
|
|
|
|
public static bool TrySetText(string text)
|
|
{
|
|
try { return SDL_SetClipboardText(text) == 0; }
|
|
catch { return false; }
|
|
}
|
|
}
|