From be2498e5834340db17e4b7f6cc45a2c04260590a Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 24 Feb 2020 14:16:05 +0100 Subject: [PATCH] added a None TextInputWrapper --- MLEM/Misc/TextInputWrapper.cs | 17 ++++++++++++++--- Sandbox/Program.cs | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/MLEM/Misc/TextInputWrapper.cs b/MLEM/Misc/TextInputWrapper.cs index fed5b21..f8f61c8 100644 --- a/MLEM/Misc/TextInputWrapper.cs +++ b/MLEM/Misc/TextInputWrapper.cs @@ -15,9 +15,9 @@ namespace MLEM.Misc { throw new InvalidOperationException( "The TextInputWrapper was not initialized yet. Please do so before running your game like so:\n" + "DesktopGL: TextInputWrapper.Current = new TextInputWrapper.DesktopGl((w, c) => w.TextInput += c);\n" + - "Mobile and Consoles: TextInputWrapper.Current = new TextInputWrapper.Mobile();\n" + - "Other Systems: TextInputWrapper.Current = new TextInputWrapper.Primitive();\n" + - "Note that the primitive wrapper needs to have its Update() method called."); + "Mobile and consoles: TextInputWrapper.Current = new TextInputWrapper.Mobile();\n" + + "Other systems: TextInputWrapper.Current = new TextInputWrapper.Primitive(); (also call Update() every game tick for this one)\n" + + "No text input: TextInputWrapper.Current = new TextInputWrapper.None();"); return current; } set => current = value; @@ -66,6 +66,17 @@ namespace MLEM.Misc { } + public class None : TextInputWrapper { + + public override bool RequiresOnScreenKeyboard() { + return false; + } + + public override void AddListener(GameWindow window, TextInputCallback callback) { + } + + } + public class Primitive : TextInputWrapper { private TextInputCallback callback; diff --git a/Sandbox/Program.cs b/Sandbox/Program.cs index cd8cb41..082653c 100644 --- a/Sandbox/Program.cs +++ b/Sandbox/Program.cs @@ -5,7 +5,7 @@ namespace Sandbox { internal static class Program { private static void Main() { - TextInputWrapper.Current = new TextInputWrapper.DesktopGl((w, c) => w.TextInput += c); + //TextInputWrapper.Current = new TextInputWrapper.DesktopGl((w, c) => w.TextInput += c); using (var game = new GameImpl()) game.Run(); }