protected override void LoadContent() { base.LoadContent(); MyraEnvironment.Platform = new MGPlatform(GraphicsDevice); _allWidgets = new AllWidgets(); _desktop = new Desktop(); _desktop.KeyDown += (s, a) => { if (_desktop.HasModalWidget || _allWidgets._mainMenu.IsOpen) { return; } if (_desktop.IsKeyDown(Keys.LeftControl) || _desktop.IsKeyDown(Keys.RightControl)) { if (_desktop.IsKeyDown(Keys.O)) { _allWidgets.OpenFile(); } else if (_desktop.IsKeyDown(Keys.S)) { _allWidgets.SaveFile(); } else if (_desktop.IsKeyDown(Keys.D)) { _allWidgets.ChooseFolder(); } else if (_desktop.IsKeyDown(Keys.L)) { _allWidgets.ChooseColor(); } else if (_desktop.IsKeyDown(Keys.Q)) { Exit(); } } }; _desktop.Root = _allWidgets; // Inform Myra that external text input is available // So it stops translating Keys to chars _desktop.HasExternalTextInput = true; // Provide that text input Window.TextInput += (s, a) => { _desktop.OnChar(a.Character); }; }
protected override void OnLoad() { graphicsDevice.ClearColor = new Vector4(0, 0, 0, 1); MyraEnvironment.Platform = new TrippyPlatform(graphicsDevice, InputContext); _allWidgets = new AllWidgets(); _desktop = new Desktop(); _desktop.KeyDown += (s, a) => { if (_desktop.HasModalWidget || _allWidgets._mainMenu.IsOpen) { return; } if (_desktop.IsKeyDown(Keys.LeftControl) || _desktop.IsKeyDown(Keys.RightControl)) { if (_desktop.IsKeyDown(Keys.O)) { _allWidgets.OpenFile(); } else if (_desktop.IsKeyDown(Keys.S)) { _allWidgets.SaveFile(); } else if (_desktop.IsKeyDown(Keys.D)) { _allWidgets.ChooseFolder(); } else if (_desktop.IsKeyDown(Keys.L)) { _allWidgets.ChooseColor(); } else if (_desktop.IsKeyDown(Keys.Q)) { // Exit(); } } }; _desktop.Root = _allWidgets; /* // Inform Myra that external text input is available * // So it stops translating Keys to chars * _desktop.HasExternalTextInput = true; * * // Provide that text input * Window.TextInput += (s, a) => * { * _desktop.OnChar(a.Character); * };*/ }
protected override void LoadContent() { base.LoadContent(); MyraEnvironment.Game = this; _desktop = new Desktop(); _allWidgets = new AllWidgets(); _desktop.KeyDown += (s, a) => { if (_desktop.HasModalWindow || _allWidgets._mainMenu.IsOpen) { return; } if (_desktop.DownKeys.Contains(Keys.LeftControl) || _desktop.DownKeys.Contains(Keys.RightControl)) { if (_desktop.DownKeys.Contains(Keys.O)) { _allWidgets.OpenFile(); } else if (_desktop.DownKeys.Contains(Keys.S)) { _allWidgets.SaveFile(); } else if (_desktop.DownKeys.Contains(Keys.D)) { _allWidgets.ChooseFolder(); } else if (_desktop.DownKeys.Contains(Keys.L)) { _allWidgets.ChooseColor(); } else if (_desktop.DownKeys.Contains(Keys.Q)) { Exit(); } } }; _desktop.Widgets.Add(_allWidgets); #if MONOGAME // Inform Myra that external text input is available // So it stops translating Keys to chars _desktop.HasExternalTextInput = true; // Provide that text input Window.TextInput += (s, a) => { _desktop.OnChar(a.Character); }; #endif #if ANDROID _desktop.WidgetGotKeyboardFocus += (s, a) => { var asTextBox = a.Data as TextBox; if (asTextBox == null) { return; } Guide.BeginShowKeyboardInput(PlayerIndex.One, "Title", "Description", asTextBox.Text, new AsyncCallback(r => { var text = Guide.EndShowKeyboardInput(r); asTextBox.Text = text; }), null); }; #endif }