From 585fc3873406049a37f9417afc061c9cde266b76 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 26 May 2024 11:25:45 -0400 Subject: Add clipboard pasting to text inputs --- AnodyneArchipelago/Menu/InputHandler.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'AnodyneArchipelago/Menu/InputHandler.cs') diff --git a/AnodyneArchipelago/Menu/InputHandler.cs b/AnodyneArchipelago/Menu/InputHandler.cs index 284d321..432b40c 100644 --- a/AnodyneArchipelago/Menu/InputHandler.cs +++ b/AnodyneArchipelago/Menu/InputHandler.cs @@ -1,6 +1,7 @@ using AnodyneSharp.Input; using Microsoft.Xna.Framework.Input; using System.Collections.Generic; +using System.Threading; namespace AnodyneArchipelago.Menu { @@ -86,6 +87,17 @@ namespace AnodyneArchipelago.Menu public static string ReturnCharacter() { + if (KeyInput.JustPressedKey(Keys.V) && (KeyInput.IsKeyPressed(Keys.LeftControl) || KeyInput.IsKeyPressed(Keys.RightControl))) + { + string result = ""; + Thread clipboardThread = new(() => result = System.Windows.Forms.Clipboard.GetText()); + clipboardThread.SetApartmentState(ApartmentState.STA); + clipboardThread.Start(); + clipboardThread.Join(); + + return result; + } + foreach (InputCharacter inputCharacter in _characters) { if (KeyInput.JustPressedKey(inputCharacter.ReturnKey())) -- cgit 1.4.1