Beispiel #1
0
        void UpdateStates()
        {
            m_previousMouseState = m_actualMouseState;
            m_keyboardState.UpdateStates();
            m_actualMouseState = MinerWars.AppCode.Toolkit.Input.MyWindowsMouse.GetCurrentState();
            if (IsJoystickConnected())
            {
                //  Try/catch block around the joystick .Poll() function to catch an exception thrown when the device is detached DURING gameplay. 
                try
                {
                    m_joystick.Acquire();
                    m_joystick.Poll();

                    m_joystick.Poll();//grab next joystick state
                    m_previousJoystickState = m_actualJoystickState;
                    m_actualJoystickState = ((Joystick)m_joystick).GetCurrentState();
                }
                catch
                {
                    m_joystickConnected = false;
                }
            }
        }
Beispiel #2
0
        public MyGuiInput()
        {
            MyWindowsMouse.SetWindow(MyMinerGame.Static.Window.NativeWindow.Handle);

            InitDevicePluginHandlerCallBack();

            m_mouseXIsInverted = IsMouseXInvertedDefault;
            m_mouseYIsInverted = IsMouseYInvertedDefault;
            m_mouseSensitivity = MouseSensitivityDefault;
            m_joystickInstanceName = JoystickInstanceNameDefault;
            m_joystickSensitivity = JoystickSensitivityDefault;
            m_joystickDeadzone = JoystickDeadzoneDefault;
            m_joystickExponent = JoystickExponentDefault;

            // Fill list of deprecated controls
            //m_deprecatedGameControls.Add(MyGameControlEnums.COMM_AVATAR_SELECT);

            #region Digit keys only
            
            m_digitKeys.Add(Keys.D0);
            m_digitKeys.Add(Keys.D1);
            m_digitKeys.Add(Keys.D2);
            m_digitKeys.Add(Keys.D3);
            m_digitKeys.Add(Keys.D4);
            m_digitKeys.Add(Keys.D5);
            m_digitKeys.Add(Keys.D6);
            m_digitKeys.Add(Keys.D7);
            m_digitKeys.Add(Keys.D8);
            m_digitKeys.Add(Keys.D9);
            m_digitKeys.Add(Keys.NumPad0);
            m_digitKeys.Add(Keys.NumPad1);
            m_digitKeys.Add(Keys.NumPad2);
            m_digitKeys.Add(Keys.NumPad3);
            m_digitKeys.Add(Keys.NumPad4);
            m_digitKeys.Add(Keys.NumPad5);
            m_digitKeys.Add(Keys.NumPad6);
            m_digitKeys.Add(Keys.NumPad7);
            m_digitKeys.Add(Keys.NumPad8);
            m_digitKeys.Add(Keys.NumPad9);

            #endregion

            #region Lists of assignable keys and buttons

            //  List of assignable keyboard keys
            m_validKeyboardKeys.Add(Keys.A);
            m_validKeyboardKeys.Add(Keys.Add);
            m_validKeyboardKeys.Add(Keys.B);
            m_validKeyboardKeys.Add(Keys.Back);
            m_validKeyboardKeys.Add(Keys.C);
            m_validKeyboardKeys.Add(Keys.CapsLock);
            m_validKeyboardKeys.Add(Keys.D);
            m_validKeyboardKeys.Add(Keys.D0);
            m_validKeyboardKeys.Add(Keys.D1);
            m_validKeyboardKeys.Add(Keys.D2);
            m_validKeyboardKeys.Add(Keys.D3);
            m_validKeyboardKeys.Add(Keys.D4);
            m_validKeyboardKeys.Add(Keys.D5);
            m_validKeyboardKeys.Add(Keys.D6);
            m_validKeyboardKeys.Add(Keys.D7);
            m_validKeyboardKeys.Add(Keys.D8);
            m_validKeyboardKeys.Add(Keys.D9);
            m_validKeyboardKeys.Add(Keys.Decimal);
            m_validKeyboardKeys.Add(Keys.Delete);
            m_validKeyboardKeys.Add(Keys.Divide);
            m_validKeyboardKeys.Add(Keys.Down);
            m_validKeyboardKeys.Add(Keys.E);
            m_validKeyboardKeys.Add(Keys.End);
            m_validKeyboardKeys.Add(Keys.Enter);
            m_validKeyboardKeys.Add(Keys.F);
            m_validKeyboardKeys.Add(Keys.G);
            m_validKeyboardKeys.Add(Keys.H);
            m_validKeyboardKeys.Add(Keys.Home);
            m_validKeyboardKeys.Add(Keys.I);
            m_validKeyboardKeys.Add(Keys.Insert);
            m_validKeyboardKeys.Add(Keys.J);
            m_validKeyboardKeys.Add(Keys.K);
            m_validKeyboardKeys.Add(Keys.L);
            m_validKeyboardKeys.Add(Keys.Left);
            m_validKeyboardKeys.Add(Keys.LeftAlt);
            m_validKeyboardKeys.Add(Keys.LeftControl);
            m_validKeyboardKeys.Add(Keys.LeftShift);
            m_validKeyboardKeys.Add(Keys.M);
            m_validKeyboardKeys.Add(Keys.Multiply);
            m_validKeyboardKeys.Add(Keys.N);
            m_validKeyboardKeys.Add(Keys.None);
            m_validKeyboardKeys.Add(Keys.NumPad0);
            m_validKeyboardKeys.Add(Keys.NumPad1);
            m_validKeyboardKeys.Add(Keys.NumPad2);
            m_validKeyboardKeys.Add(Keys.NumPad3);
            m_validKeyboardKeys.Add(Keys.NumPad4);
            m_validKeyboardKeys.Add(Keys.NumPad5);
            m_validKeyboardKeys.Add(Keys.NumPad6);
            m_validKeyboardKeys.Add(Keys.NumPad7);
            m_validKeyboardKeys.Add(Keys.NumPad8);
            m_validKeyboardKeys.Add(Keys.NumPad9);
            m_validKeyboardKeys.Add(Keys.O);
            m_validKeyboardKeys.Add(Keys.OemCloseBrackets);
            m_validKeyboardKeys.Add(Keys.OemComma);
            m_validKeyboardKeys.Add(Keys.OemMinus);
            m_validKeyboardKeys.Add(Keys.OemOpenBrackets);
            m_validKeyboardKeys.Add(Keys.OemPeriod);
            m_validKeyboardKeys.Add(Keys.OemPipe);
            m_validKeyboardKeys.Add(Keys.OemPlus);
            m_validKeyboardKeys.Add(Keys.OemQuestion);
            m_validKeyboardKeys.Add(Keys.OemQuotes);
            m_validKeyboardKeys.Add(Keys.OemSemicolon);
            m_validKeyboardKeys.Add(Keys.OemTilde);
            m_validKeyboardKeys.Add(Keys.OemBackslash);
            m_validKeyboardKeys.Add(Keys.P);
            m_validKeyboardKeys.Add(Keys.PageDown);
            m_validKeyboardKeys.Add(Keys.PageUp);
            m_validKeyboardKeys.Add(Keys.Pause);
            m_validKeyboardKeys.Add(Keys.Q);
            m_validKeyboardKeys.Add(Keys.R);
            m_validKeyboardKeys.Add(Keys.Right);
            m_validKeyboardKeys.Add(Keys.RightAlt);
            m_validKeyboardKeys.Add(Keys.RightControl);
            m_validKeyboardKeys.Add(Keys.RightShift);
            m_validKeyboardKeys.Add(Keys.S);
            m_validKeyboardKeys.Add(Keys.Space);
            m_validKeyboardKeys.Add(Keys.Subtract);
            m_validKeyboardKeys.Add(Keys.T);
            m_validKeyboardKeys.Add(Keys.Tab);
            m_validKeyboardKeys.Add(Keys.U);
            m_validKeyboardKeys.Add(Keys.Up);
            m_validKeyboardKeys.Add(Keys.V);
            m_validKeyboardKeys.Add(Keys.W);
            m_validKeyboardKeys.Add(Keys.X);
            m_validKeyboardKeys.Add(Keys.Y);
            m_validKeyboardKeys.Add(Keys.Z);

            //  List of assignable mouse buttons
            m_validMouseButtons.Add(MyMouseButtonsEnum.Left);
            m_validMouseButtons.Add(MyMouseButtonsEnum.Middle);
            m_validMouseButtons.Add(MyMouseButtonsEnum.Right);
            m_validMouseButtons.Add(MyMouseButtonsEnum.XButton1);
            m_validMouseButtons.Add(MyMouseButtonsEnum.XButton2);
            m_validMouseButtons.Add(MyMouseButtonsEnum.None);

            //  List of assignable joystick buttons
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J01);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J02);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J03);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J04);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J05);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J06);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J07);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J08);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J09);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J10);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J11);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J12);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J13);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J14);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J15);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.J16);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.JDLeft);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.JDRight);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.JDUp);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.JDDown);
            m_validJoystickButtons.Add(MyJoystickButtonsEnum.None);

            //  List of assignable joystick axes
            m_validJoystickAxes.Add(MyJoystickAxesEnum.Xpos);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.Xneg);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.Ypos);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.Yneg);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.Zpos);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.Zneg);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.RotationXpos);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.RotationXneg);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.RotationYpos);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.RotationYneg);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.RotationZpos);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.RotationZneg);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.Slider1pos);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.Slider1neg);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.Slider2pos);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.Slider2neg);
            m_validJoystickAxes.Add(MyJoystickAxesEnum.None);

            #endregion

            //  IMPORTANT! If you add/remove a control you MUST add/remove default control list! 
            //  Default Controls list
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_PRIMARY] = new MyControl(MyGameControlEnums.FIRE_PRIMARY, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_PRIMARY).DescriptionEnum, MyGuiControlTypeEnum.Weapons, MyMouseButtonsEnum.Left, Keys.LeftControl, MyJoystickButtonsEnum.J01, null);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_SECONDARY] = new MyControl(MyGameControlEnums.FIRE_SECONDARY, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_SECONDARY).DescriptionEnum, MyGuiControlTypeEnum.Weapons, MyMouseButtonsEnum.Right, MyFakes.ALT_AS_DEBUG_KEY ? Keys.None : Keys.LeftAlt, MyJoystickButtonsEnum.J02, null);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_THIRD] = new MyControl(MyGameControlEnums.FIRE_THIRD, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_THIRD).DescriptionEnum, MyGuiControlTypeEnum.Weapons, Keys.None);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_FOURTH] = new MyControl(MyGameControlEnums.FIRE_FOURTH, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_FOURTH).DescriptionEnum, MyGuiControlTypeEnum.Weapons, Keys.None);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_FIFTH] = new MyControl(MyGameControlEnums.FIRE_FIFTH, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_FIFTH).DescriptionEnum, MyGuiControlTypeEnum.Weapons, Keys.None);
            m_defaultGameControlsList[(int)MyGameControlEnums.FORWARD] = new MyControl(MyGameControlEnums.FORWARD, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FORWARD).DescriptionEnum, MyGuiControlTypeEnum.Navigation, Keys.W);
            m_defaultGameControlsList[(int)MyGameControlEnums.REVERSE] = new MyControl(MyGameControlEnums.REVERSE, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.REVERSE).DescriptionEnum, MyGuiControlTypeEnum.Navigation, Keys.S);
            m_defaultGameControlsList[(int)MyGameControlEnums.UP_THRUST] = new MyControl(MyGameControlEnums.UP_THRUST, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.UP_THRUST).DescriptionEnum, MyGuiControlTypeEnum.Navigation, null, Keys.F, MyJoystickButtonsEnum.JDUp, null);
            m_defaultGameControlsList[(int)MyGameControlEnums.DOWN_THRUST] = new MyControl(MyGameControlEnums.DOWN_THRUST, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.DOWN_THRUST).DescriptionEnum, MyGuiControlTypeEnum.Navigation, null, Keys.C, MyJoystickButtonsEnum.JDDown, null);
            m_defaultGameControlsList[(int)MyGameControlEnums.STRAFE_LEFT] = new MyControl(MyGameControlEnums.STRAFE_LEFT, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.STRAFE_LEFT).DescriptionEnum, MyGuiControlTypeEnum.Navigation, null, Keys.A, MyJoystickButtonsEnum.JDLeft, null);
            m_defaultGameControlsList[(int)MyGameControlEnums.STRAFE_RIGHT] = new MyControl(MyGameControlEnums.STRAFE_RIGHT, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.STRAFE_RIGHT).DescriptionEnum, MyGuiControlTypeEnum.Navigation, null, Keys.D, MyJoystickButtonsEnum.JDRight, null);
            m_defaultGameControlsList[(int)MyGameControlEnums.ROLL_LEFT] = new MyControl(MyGameControlEnums.ROLL_LEFT, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.ROLL_LEFT).DescriptionEnum, MyGuiControlTypeEnum.Navigation, Keys.Q);
            m_defaultGameControlsList[(int)MyGameControlEnums.ROLL_RIGHT] = new MyControl(MyGameControlEnums.ROLL_RIGHT, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.ROLL_RIGHT).DescriptionEnum, MyGuiControlTypeEnum.Navigation, Keys.E);
            m_defaultGameControlsList[(int)MyGameControlEnums.ROTATION_LEFT] = new MyControl(MyGameControlEnums.ROTATION_LEFT, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.ROTATION_LEFT).DescriptionEnum, MyGuiControlTypeEnum.Navigation, null, Keys.Left, null, MyJoystickAxesEnum.Xneg);
            m_defaultGameControlsList[(int)MyGameControlEnums.ROTATION_RIGHT] = new MyControl(MyGameControlEnums.ROTATION_RIGHT, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.ROTATION_RIGHT).DescriptionEnum, MyGuiControlTypeEnum.Navigation, null, Keys.Right, null, MyJoystickAxesEnum.Xpos);
            m_defaultGameControlsList[(int)MyGameControlEnums.ROTATION_UP] = new MyControl(MyGameControlEnums.ROTATION_UP, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.ROTATION_UP).DescriptionEnum, MyGuiControlTypeEnum.Navigation, null, Keys.Up, null, MyJoystickAxesEnum.Yneg);
            m_defaultGameControlsList[(int)MyGameControlEnums.ROTATION_DOWN] = new MyControl(MyGameControlEnums.ROTATION_DOWN, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.ROTATION_DOWN).DescriptionEnum, MyGuiControlTypeEnum.Navigation, null, Keys.Down, null, MyJoystickAxesEnum.Ypos);
            m_defaultGameControlsList[(int)MyGameControlEnums.HEADLIGHTS] = new MyControl(MyGameControlEnums.HEADLIGHTS, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.HEADLIGHTS).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.H);
            //m_defaultGameControlsList[(int)MyGameControlEnums.ENGINE_SHUTDOWN] = new MyControl(MyGameControlEnums.ENGINE_SHUTDOWN, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.ENGINE_SHUTDOWN).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.T);
            m_defaultGameControlsList[(int)MyGameControlEnums.HARVEST] = new MyControl(MyGameControlEnums.HARVEST, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.HARVEST).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.B);
            m_defaultGameControlsList[(int)MyGameControlEnums.ZOOM_IN] = new MyControl(MyGameControlEnums.ZOOM_IN, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.ZOOM_IN).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.R);
            m_defaultGameControlsList[(int)MyGameControlEnums.ZOOM_OUT] = new MyControl(MyGameControlEnums.ZOOM_OUT, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.ZOOM_OUT).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.V);
            m_defaultGameControlsList[(int)MyGameControlEnums.QUICK_ZOOM] = new MyControl(MyGameControlEnums.QUICK_ZOOM, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.QUICK_ZOOM).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.G);
            m_defaultGameControlsList[(int)MyGameControlEnums.TRAVEL] = new MyControl(MyGameControlEnums.TRAVEL, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.TRAVEL).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.Home);
            m_defaultGameControlsList[(int)MyGameControlEnums.SELECT_AMMO_BULLET] = new MyControl(MyGameControlEnums.SELECT_AMMO_BULLET, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.SELECT_AMMO_BULLET).DescriptionEnum, MyGuiControlTypeEnum.Weapons, Keys.D1);
            m_defaultGameControlsList[(int)MyGameControlEnums.SELECT_AMMO_MISSILE] = new MyControl(MyGameControlEnums.SELECT_AMMO_MISSILE, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.SELECT_AMMO_MISSILE).DescriptionEnum, MyGuiControlTypeEnum.Weapons, Keys.D2);
            m_defaultGameControlsList[(int)MyGameControlEnums.SELECT_AMMO_CANNON] = new MyControl(MyGameControlEnums.SELECT_AMMO_CANNON, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.SELECT_AMMO_CANNON).DescriptionEnum, MyGuiControlTypeEnum.Weapons, Keys.D3);
            m_defaultGameControlsList[(int)MyGameControlEnums.SELECT_AMMO_UNIVERSAL_LAUNCHER_FRONT] = new MyControl(MyGameControlEnums.SELECT_AMMO_UNIVERSAL_LAUNCHER_FRONT, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.SELECT_AMMO_UNIVERSAL_LAUNCHER_FRONT).DescriptionEnum, MyGuiControlTypeEnum.Weapons, Keys.D4);
            m_defaultGameControlsList[(int)MyGameControlEnums.AUTO_LEVEL] = new MyControl(MyGameControlEnums.AUTO_LEVEL, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.AUTO_LEVEL).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.N);
            m_defaultGameControlsList[(int)MyGameControlEnums.DRILL] = new MyControl(MyGameControlEnums.DRILL, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.DRILL).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.M);
            m_defaultGameControlsList[(int)MyGameControlEnums.REAR_CAM] = new MyControl(MyGameControlEnums.REAR_CAM, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.REAR_CAM).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.K);
            m_defaultGameControlsList[(int)MyGameControlEnums.SELECT_AMMO_UNIVERSAL_LAUNCHER_BACK] = new MyControl(MyGameControlEnums.SELECT_AMMO_UNIVERSAL_LAUNCHER_BACK, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.SELECT_AMMO_UNIVERSAL_LAUNCHER_BACK).DescriptionEnum, MyGuiControlTypeEnum.Weapons, Keys.D5);
            //m_defaultGameControlsList[(int)MyGameControlEnums.SWITCH_RADAR_MODE] = new MyControl(MyGameControlEnums.SWITCH_RADAR_MODE, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.SWITCH_RADAR_MODE).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.OemTilde);
            m_defaultGameControlsList[(int)MyGameControlEnums.AFTERBURNER] = new MyControl(MyGameControlEnums.AFTERBURNER, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.AFTERBURNER).DescriptionEnum, MyGuiControlTypeEnum.Navigation, Keys.LeftShift);
            //m_defaultGameControlsList[(int)MyGameControlEnums.FULLSCREEN_RADAR] = new MyControl(MyGameControlEnums.FULLSCREEN_RADAR, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FULLSCREEN_RADAR).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.Tab);
            m_defaultGameControlsList[(int)MyGameControlEnums.CHANGE_DRONE_MODE] = new MyControl(MyGameControlEnums.CHANGE_DRONE_MODE, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.CHANGE_DRONE_MODE).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.End);
            //m_defaultGameControlsList[(int)MyGameControlEnums.RADAR_ZOOM_IN] = new MyControl(MyGameControlEnums.RADAR_ZOOM_IN, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.RADAR_ZOOM_IN).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.OemPlus, Keys.Add);
            //m_defaultGameControlsList[(int)MyGameControlEnums.RADAR_ZOOM_OUT] = new MyControl(MyGameControlEnums.RADAR_ZOOM_OUT, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.RADAR_ZOOM_OUT).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.OemMinus, Keys.Subtract);
            m_defaultGameControlsList[(int)MyGameControlEnums.MOVEMENT_SLOWDOWN] = new MyControl(MyGameControlEnums.MOVEMENT_SLOWDOWN, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.MOVEMENT_SLOWDOWN).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.X);
            m_defaultGameControlsList[(int)MyGameControlEnums.VIEW_MODE] = new MyControl(MyGameControlEnums.VIEW_MODE, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.VIEW_MODE).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.O);
            m_defaultGameControlsList[(int)MyGameControlEnums.WEAPON_SPECIAL] = new MyControl(MyGameControlEnums.WEAPON_SPECIAL, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.WEAPON_SPECIAL).DescriptionEnum, MyGuiControlTypeEnum.Weapons, Keys.Z);
            m_defaultGameControlsList[(int)MyGameControlEnums.WHEEL_CONTROL] = new MyControl(MyGameControlEnums.WHEEL_CONTROL, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.WHEEL_CONTROL).DescriptionEnum, MyGuiControlTypeEnum.Systems2, MyMouseButtonsEnum.Middle, Keys.Back, null, null);
            m_defaultGameControlsList[(int)MyGameControlEnums.MISSION_DIALOG] = new MyControl(MyGameControlEnums.MISSION_DIALOG, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.MISSION_DIALOG).DescriptionEnum, MyGuiControlTypeEnum.Deleted, Keys.J);
            m_defaultGameControlsList[(int)MyGameControlEnums.HEADLIGTHS_DISTANCE] = new MyControl(MyGameControlEnums.HEADLIGTHS_DISTANCE, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.HEADLIGTHS_DISTANCE).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.L);
            m_defaultGameControlsList[(int)MyGameControlEnums.GPS] = new MyControl(MyGameControlEnums.GPS, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.GPS).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.T);

            m_defaultGameControlsList[(int)MyGameControlEnums.NOTIFICATION_CONFIRMATION] = new MyControl(MyGameControlEnums.NOTIFICATION_CONFIRMATION, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.NOTIFICATION_CONFIRMATION).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.Y);
            m_defaultGameControlsList[(int)MyGameControlEnums.INVENTORY] = new MyControl(MyGameControlEnums.INVENTORY, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.INVENTORY).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.I);

            //m_defaultGameControlsList[(int)MyGameControlEnums.COMM_AVATAR_SELECT] = new MyControl(MyGameControlEnums.COMM_AVATAR_SELECT, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.COMM_AVATAR_SELECT).DescriptionEnum, MyGuiControlTypeEnum.Communications, Keys.None);

            m_defaultGameControlsList[(int)MyGameControlEnums.PREVIOUS_CAMERA] = new MyControl(MyGameControlEnums.PREVIOUS_CAMERA, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.PREVIOUS_CAMERA).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.OemOpenBrackets);
            m_defaultGameControlsList[(int)MyGameControlEnums.NEXT_CAMERA] = new MyControl(MyGameControlEnums.NEXT_CAMERA, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.NEXT_CAMERA).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.OemCloseBrackets);
            m_defaultGameControlsList[(int)MyGameControlEnums.USE] = new MyControl(MyGameControlEnums.USE, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.USE).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.Space);

            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_HOLOGRAM_FRONT   ] = new MyControl(MyGameControlEnums.FIRE_HOLOGRAM_FRONT   , MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_HOLOGRAM_FRONT   ).DescriptionEnum, MyGuiControlTypeEnum.SpecialWeapons);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_HOLOGRAM_BACK    ] = new MyControl(MyGameControlEnums.FIRE_HOLOGRAM_BACK    , MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_HOLOGRAM_BACK    ).DescriptionEnum, MyGuiControlTypeEnum.SpecialWeapons, Keys.NumPad1);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_BASIC_MINE_FRONT ] = new MyControl(MyGameControlEnums.FIRE_BASIC_MINE_FRONT , MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_BASIC_MINE_FRONT ).DescriptionEnum, MyGuiControlTypeEnum.SpecialWeapons);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_BASIC_MINE_BACK  ] = new MyControl(MyGameControlEnums.FIRE_BASIC_MINE_BACK  , MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_BASIC_MINE_BACK  ).DescriptionEnum, MyGuiControlTypeEnum.SpecialWeapons, Keys.NumPad2);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_SMART_MINE_FRONT ] = new MyControl(MyGameControlEnums.FIRE_SMART_MINE_FRONT , MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_SMART_MINE_FRONT ).DescriptionEnum, MyGuiControlTypeEnum.SpecialWeapons);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_SMART_MINE_BACK  ] = new MyControl(MyGameControlEnums.FIRE_SMART_MINE_BACK  , MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_SMART_MINE_BACK  ).DescriptionEnum, MyGuiControlTypeEnum.SpecialWeapons, Keys.NumPad3);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_FLASH_BOMB_FRONT ] = new MyControl(MyGameControlEnums.FIRE_FLASH_BOMB_FRONT , MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_FLASH_BOMB_FRONT ).DescriptionEnum, MyGuiControlTypeEnum.SpecialWeapons);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_FLASH_BOMB_BACK  ] = new MyControl(MyGameControlEnums.FIRE_FLASH_BOMB_BACK  , MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_FLASH_BOMB_BACK  ).DescriptionEnum, MyGuiControlTypeEnum.SpecialWeapons, Keys.NumPad4);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_DECOY_FLARE_FRONT] = new MyControl(MyGameControlEnums.FIRE_DECOY_FLARE_FRONT, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_DECOY_FLARE_FRONT).DescriptionEnum, MyGuiControlTypeEnum.SpecialWeapons);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_DECOY_FLARE_BACK ] = new MyControl(MyGameControlEnums.FIRE_DECOY_FLARE_BACK , MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_DECOY_FLARE_BACK ).DescriptionEnum, MyGuiControlTypeEnum.SpecialWeapons, Keys.NumPad5);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_SMOKE_BOMB_FRONT ] = new MyControl(MyGameControlEnums.FIRE_SMOKE_BOMB_FRONT , MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_SMOKE_BOMB_FRONT ).DescriptionEnum, MyGuiControlTypeEnum.SpecialWeapons, Keys.NumPad6);
            m_defaultGameControlsList[(int)MyGameControlEnums.FIRE_SMOKE_BOMB_BACK  ] = new MyControl(MyGameControlEnums.FIRE_SMOKE_BOMB_BACK  , MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.FIRE_SMOKE_BOMB_BACK  ).DescriptionEnum, MyGuiControlTypeEnum.SpecialWeapons);

            m_defaultGameControlsList[(int)MyGameControlEnums.DRONE_DEPLOY] = new MyControl(MyGameControlEnums.DRONE_DEPLOY, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.DRONE_DEPLOY).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.Insert);
            m_defaultGameControlsList[(int)MyGameControlEnums.DRONE_CONTROL] = new MyControl(MyGameControlEnums.DRONE_CONTROL, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.DRONE_CONTROL).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.Delete);
            m_defaultGameControlsList[(int)MyGameControlEnums.CONTROL_SECONDARY_CAMERA] = new MyControl(MyGameControlEnums.CONTROL_SECONDARY_CAMERA, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.CONTROL_SECONDARY_CAMERA).DescriptionEnum, MyGuiControlTypeEnum.Systems1, Keys.OemTilde);

            m_defaultGameControlsList[(int)MyGameControlEnums.PREV_TARGET] = new MyControl(MyGameControlEnums.PREV_TARGET, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.PREV_TARGET).DescriptionEnum, MyGuiControlTypeEnum.Weapons, Keys.OemComma);
            m_defaultGameControlsList[(int)MyGameControlEnums.NEXT_TARGET] = new MyControl(MyGameControlEnums.NEXT_TARGET, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.NEXT_TARGET).DescriptionEnum, MyGuiControlTypeEnum.Weapons, Keys.OemPeriod);

            m_defaultGameControlsList[(int)MyGameControlEnums.CHAT] = new MyControl(MyGameControlEnums.CHAT, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.CHAT).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.Enter);
            m_defaultGameControlsList[(int)MyGameControlEnums.SCORE] = new MyControl(MyGameControlEnums.SCORE, MyGuiGameControlsHelpers.GetGameControlHelper(MyGameControlEnums.SCORE).DescriptionEnum, MyGuiControlTypeEnum.Systems2, Keys.Tab);

            // Editor default controls
            m_defaultEditorControlsList[(int)MyEditorControlEnums.DECREASE_GRID_SCALE] = new MyControl(MyEditorControlEnums.DECREASE_GRID_SCALE, MyGuiGameControlsHelpers.GetEditorControlHelper(MyEditorControlEnums.DECREASE_GRID_SCALE).DescriptionEnum, MyGuiControlTypeEnum.Editor, Keys.OemMinus);
            m_defaultEditorControlsList[(int)MyEditorControlEnums.INCREASE_GRID_SCALE] = new MyControl(MyEditorControlEnums.INCREASE_GRID_SCALE, MyGuiGameControlsHelpers.GetEditorControlHelper(MyEditorControlEnums.INCREASE_GRID_SCALE).DescriptionEnum, MyGuiControlTypeEnum.Editor, Keys.OemPlus);
            m_defaultEditorControlsList[(int)MyEditorControlEnums.PRIMARY_ACTION_KEY] = new MyControl(MyEditorControlEnums.PRIMARY_ACTION_KEY, MyGuiGameControlsHelpers.GetEditorControlHelper(MyEditorControlEnums.PRIMARY_ACTION_KEY).DescriptionEnum, MyGuiControlTypeEnum.Editor, MyMouseButtonsEnum.Left);
            m_defaultEditorControlsList[(int)MyEditorControlEnums.SECONDARY_ACTION_KEY] = new MyControl(MyEditorControlEnums.SECONDARY_ACTION_KEY, MyGuiGameControlsHelpers.GetEditorControlHelper(MyEditorControlEnums.SECONDARY_ACTION_KEY).DescriptionEnum, MyGuiControlTypeEnum.Editor, MyMouseButtonsEnum.Right);
            m_defaultEditorControlsList[(int)MyEditorControlEnums.SWITCH_GIZMO_MODE] = new MyControl(MyEditorControlEnums.SWITCH_GIZMO_MODE, MyGuiGameControlsHelpers.GetEditorControlHelper(MyEditorControlEnums.SWITCH_GIZMO_MODE).DescriptionEnum, MyGuiControlTypeEnum.Editor, Keys.T);
            m_defaultEditorControlsList[(int)MyEditorControlEnums.SWITCH_GIZMO_SPACE] = new MyControl(MyEditorControlEnums.SWITCH_GIZMO_SPACE, MyGuiGameControlsHelpers.GetEditorControlHelper(MyEditorControlEnums.SWITCH_GIZMO_SPACE).DescriptionEnum, MyGuiControlTypeEnum.Editor, Keys.Space);
            m_defaultEditorControlsList[(int)MyEditorControlEnums.VOXEL_HAND] = new MyControl(MyEditorControlEnums.VOXEL_HAND, MyGuiGameControlsHelpers.GetEditorControlHelper(MyEditorControlEnums.VOXEL_HAND).DescriptionEnum, MyGuiControlTypeEnum.Editor, Keys.V);

            CheckValidControls(m_defaultGameControlsList);
            CheckValidControls(m_defaultEditorControlsList);

            CloneControls(m_defaultGameControlsList, m_gameControlsList);
            CloneControls(m_defaultEditorControlsList, m_editorControlsList);

            LoadControls();
            TakeSnapshot();

            //  Make sure that DirectInput has been initialized
            InitializeJoystickIfPossible();

            m_keyboardState = new MyGuiLocalizedKeyboardState();
            m_actualMouseState = MinerWars.AppCode.Toolkit.Input.MyWindowsMouse.GetCurrentState();

            if (MyVideoModeManager.IsHardwareCursorUsed())
            {
                /*
                if (MyMinerGame.Static.Window.Handle == GetForegroundWindow() && MyGuiManager.GetScreenWithFocus() != null && MyGuiManager.GetScreenWithFocus().GetDrawMouseCursor() == false)
                    SetMouseToScreenCenter();
                */
            }else
                SetMouseToScreenCenter();

            UpdateStates();
        }