1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-29 03:23:37 +02:00

added a None TextInputWrapper

This commit is contained in:
Ellpeck 2020-02-24 14:16:05 +01:00
parent 0adb444c69
commit be2498e583
2 changed files with 15 additions and 4 deletions

View file

@ -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<TextInputEventArgs>((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;

View file

@ -5,7 +5,7 @@ namespace Sandbox {
internal static class Program {
private static void Main() {
TextInputWrapper.Current = new TextInputWrapper.DesktopGl<TextInputEventArgs>((w, c) => w.TextInput += c);
//TextInputWrapper.Current = new TextInputWrapper.DesktopGl<TextInputEventArgs>((w, c) => w.TextInput += c);
using (var game = new GameImpl())
game.Run();
}