public override void ProcessKeyboard(SadConsole.Console console, Keyboard info, out bool handled) { if (info.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.Tab)) { if (Logging.Open) { SadConsole.Global.CurrentScreen = console; Logging.Open = false; } else { Logging.Refresh(); SadConsole.Global.CurrentScreen = Logging.LogConsole; Logging.Open = true; } } if (info.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.Enter)) { Player.UpdateActions(); Player.UpdateReactions(); } if (info.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.Up)) { if (Player.MovementHandler.Direction != Directions.DirectionEnum.North) { Player.MovementHandler.ChangeDirection(Directions.DirectionEnum.North); } Player.Move = true; } if (info.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.Down)) { if (Player.MovementHandler.Direction != Directions.DirectionEnum.South) { Player.MovementHandler.ChangeDirection(Directions.DirectionEnum.South); } Player.Move = true; } if (info.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.Right)) { if (Player.MovementHandler.Direction != Directions.DirectionEnum.West) { Player.MovementHandler.ChangeDirection(Directions.DirectionEnum.West); } Player.Move = true; } if (info.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.Left)) { if (Player.MovementHandler.Direction != Directions.DirectionEnum.East) { Player.MovementHandler.ChangeDirection(Directions.DirectionEnum.East); } Player.Move = true; } handled = true; }
public SpaceMapConsole(int width, int height) : base(width, height) { Width = width; Height = height; trackedRegion = new Rectangle(0, 0, width, height); tooltip = new SadConsole.Console(10, 1); mouseCursor = new SadConsole.Console(1, 1); mouseCursor.SetGlyph(0, 0, 178, new Color(255, 255, 255, 255)); mouseCursor.UseMouse = false; tooltip.UseMouse = false; tooltip.IsVisible = false; Children.Add(tooltip); Children.Add(mouseCursor); }
public SelectedShipConsole(int width, int height) : base(width, height) { Width = width; Height = height; mouseCursor = new SadConsole.Console(1, 1); mouseCursor.SetGlyph(0, 0, 178, new Color(255, 255, 255, 255)); mouseCursor.UseMouse = false; Children.Add(mouseCursor); // Set up controls: Button btnShip = new Button(14, 1); btnShip.Name = "HeaderButton"; btnShip.Position = new Point(0, 0); btnShip.IsEnabled = true; btnShip.IsVisible = true; btnShip.Text = "Ship Console"; this.Add(btnShip); btnShip.Click += BtnShip_Click; }
public SerializationTests() : base(80, 23) { //Settings.SerializationIsCompressed = true; controlsConsole = new ControlsConsole(80, 4); masterView = new Console(34, 15); loadedView = new Console(34, 15); masterView.Fill(Color.White, Color.Red, 0); loadedView.Fill(Color.White, Color.Blue, 0); UseMouse = true; // Add the consoles to the list. Children.Add(controlsConsole); Children.Add(masterView); Children.Add(loadedView); // Setup main view masterView.Position = new Point(3, 6); // Setup sub view loadedView.Position = new Point(80 - 37, 6); // Setup controls controlsConsole.Position = new Point(0, 0); optionButtonSurface = new SadConsole.Controls.RadioButton(18, 1) { Text = "Surface", Position = new Point(1, 1), }; optionButtonSurface.IsSelectedChanged += OptionButton_IsSelectedChanged; controlsConsole.Add(optionButtonSurface); optionButtonView = new SadConsole.Controls.RadioButton(18, 1) { Text = "Surface View", Position = new Point(1, 2) }; optionButtonView.IsSelectedChanged += OptionButton_IsSelectedChanged; controlsConsole.Add(optionButtonView); optionButtonLayered = new SadConsole.Controls.RadioButton(21, 1) { Text = "Layered Surface", Position = new Point(optionButtonSurface.Bounds.Right + 1, 1) }; optionButtonLayered.IsSelectedChanged += OptionButton_IsSelectedChanged; controlsConsole.Add(optionButtonLayered); optionButtonAnimated = new SadConsole.Controls.RadioButton(21, 1) { Text = "Animated Surface", Position = new Point(optionButtonSurface.Bounds.Right + 1, 2) }; optionButtonAnimated.IsSelectedChanged += OptionButton_IsSelectedChanged; controlsConsole.Add(optionButtonAnimated); var buttonSave = new SadConsole.Controls.Button(17, 1) { Text = "Save and Load", Position = new Point(controlsConsole.Width - 19, 1) }; buttonSave.Click += ButtonSave_Click; controlsConsole.Add(buttonSave); basicSurface = new SadConsole.Console(34, 15); animatedSurface = SadConsole.AnimatedConsole.CreateStatic(34, 15, 15, 0.3d); viewSurface = new Console(1, 1); viewSurface.SetSurface(basicSurface, new Rectangle(5, 2, 34 - 10, 15 - 4)); //emptySurface = (SadConsole.Surfaces.BasicSurface)loadedView.TextSurface; MakeBasicSurface(); MakeLayeredSurface(); optionButtonSurface.IsSelected = true; }