public override void OnStart(Router router, GameBase game, Dictionary <string, object> args) { game.Print("DotFeather Text Editor"); game.Print("Press [ESC] to exit"); // flush text buffer DFKeyboard.GetString(); Root.Add(editorView); }
public override void OnStart(Dictionary <string, object> args) { Print("DotFeather Text Editor"); Print("Press [ESC] to exit"); editorView = new TextElement("", DFFont.GetDefault(16), Color.White) { Location = (8, 64) }; Root.Add(editorView); // flush text buffer DFKeyboard.GetString(); }
public override void OnUpdate() { Cls(); Print("Keyboard State"); Print($@"Pressing: {string.Join(",", DFKeyboard.AllPressedKeys.Select(d => d.ToString()))}"); Print($@"Pressed: {string.Join(",", DFKeyboard.AllDownKeys.Select(d => d.ToString()))}"); Print($@"Released: {string.Join(",", DFKeyboard.AllUpKeys.Select(d => d.ToString()))}"); Print($@"Input Buffer: {buf}"); Print("Press [ESC] to return"); buf += DFKeyboard.GetString(); if (DFKeyboard.Escape.IsKeyUp) { Router.ChangeScene <LauncherScene>(); } }
public override void OnUpdate(Router router, GameBase game, DFEventArgs e) { editorView.Text = buf.ToString() + '_'; if ((DFKeyboard.BackSpace.ElapsedFrameCount == 1 || DFKeyboard.BackSpace.ElapsedTime > 0.5f && DFKeyboard.BackSpace.ElapsedFrameCount % 3 == 0) && buf.Length > 0) { buf.Length--; } if (DFKeyboard.Enter.ElapsedFrameCount == 1 || DFKeyboard.Enter.ElapsedTime > 0.5f && DFKeyboard.Enter.ElapsedFrameCount % 3 == 0) { buf.Append('\n'); } if (DFKeyboard.HasChar()) { buf.Append(DFKeyboard.GetString()); } if (DFKeyboard.Escape.IsKeyUp) { router.ChangeScene <LauncherScene>(); } }
public override void OnStart(System.Collections.Generic.Dictionary <string, object> args) { // Delete char buffer DFKeyboard.GetString(); }