1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01: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( throw new InvalidOperationException(
"The TextInputWrapper was not initialized yet. Please do so before running your game like so:\n" + "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" + "DesktopGL: TextInputWrapper.Current = new TextInputWrapper.DesktopGl<TextInputEventArgs>((w, c) => w.TextInput += c);\n" +
"Mobile and Consoles: TextInputWrapper.Current = new TextInputWrapper.Mobile();\n" + "Mobile and consoles: TextInputWrapper.Current = new TextInputWrapper.Mobile();\n" +
"Other Systems: TextInputWrapper.Current = new TextInputWrapper.Primitive();\n" + "Other systems: TextInputWrapper.Current = new TextInputWrapper.Primitive(); (also call Update() every game tick for this one)\n" +
"Note that the primitive wrapper needs to have its Update() method called."); "No text input: TextInputWrapper.Current = new TextInputWrapper.None();");
return current; return current;
} }
set => current = value; 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 { public class Primitive : TextInputWrapper {
private TextInputCallback callback; private TextInputCallback callback;

View file

@ -5,7 +5,7 @@ namespace Sandbox {
internal static class Program { internal static class Program {
private static void Main() { 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()) using (var game = new GameImpl())
game.Run(); game.Run();
} }