public override void Initialize()
        {
            mouse = new UIMouse();
            keyboard = new UIKeyboard();
            messageLog = new MessageLog();
            screenManager = new ScreenManager(this);
            camera = new Camera(sim);
            console = new Console(sim);

            base.Initialize();
        }
Example #2
0
        private void UpdateKeyboardInput()
        {
            UIKeyboard keyboard = manager.UI.Keyboard;

            // Key Presses
            Keys[] pressedKeys = keyboard.State.GetPressedKeys();
            for (int i = 0; i < pressedKeys.Length; i++)
            {
                switch (pressedKeys[i])
                {
                case Keys.W:
                    manager.UI.Camera.MoveForward();
                    break;

                case Keys.A:
                    manager.UI.Camera.MoveLeft();
                    break;

                case Keys.S:
                    manager.UI.Camera.MoveBack();
                    break;

                case Keys.D:
                    manager.UI.Camera.MoveRight();
                    break;

                case Keys.Q:
                    manager.UI.Camera.RotateLeft();
                    break;

                case Keys.E:
                    manager.UI.Camera.RotateRight();
                    break;

                case Keys.R:
                    manager.UI.Camera.RotateDown();
                    break;

                case Keys.F:
                    manager.UI.Camera.RotateUp();
                    break;

                case Keys.Up:
                    manager.UI.Camera.MoveUp();
                    break;

                case Keys.Down:
                    manager.UI.Camera.MoveDown();
                    break;
                }
            }

            // Key Pushes
            if (manager.UI.Keyboard.KeyPushed(Keys.Escape))
            {
                if (selected == null)
                {
                    manager.ChangeScreen(new MenuScreen(manager));
                }
                else
                {
                    selected.Updated -= UpdateSelectionInfo;
                    selected          = null;
                    SelectionInfoChanged(null, EventArgs.Empty);
                }
            }
            if (manager.UI.Keyboard.KeyPushed(Keys.B))
            {
                SetMode(mode == Mode.Build ? Mode.Normal : Mode.Build);
            }
            if (manager.UI.Keyboard.KeyPushed(Keys.X))
            {
                Sim.Settings.Graphics.Default.ShowBBs = !Sim.Settings.Graphics.Default.ShowBBs;
            }
            if (manager.UI.Keyboard.KeyPushed(Keys.P))
            {
                world.Paused = !world.Paused;
            }
        }