示例#1
0
        public MainGameClass()
        {
            // handle for the video card and sets the
            // also defines the content folder
            //
            graphics = new GraphicsDeviceManager(this);
            config = new ConfigManager();

            /* shouldn't need this if Resolution works fine
            *
            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 600;
            graphics.IsFullScreen = false;
            */
            /*
            Resolution.Init(ref graphics);
            // Change Virtual Resolution
            Resolution.SetVirtualResolution(640, 480);
            Resolution.SetResolution(1920, 1080, false);

            // Create the screen manager component.
            screenManager = new ScreenManager(this);

            Components.Add(screenManager);

            // Activate the first screens.
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new MainMenuScreen(), null);
            */
        }
示例#2
0
        /// <summary>
        /// Constructs a new input state.
        /// </summary>
        public InputState(bool useKeyAndMouse, ConfigManager cm)
        {
            this.useKeyAndMouse = useKeyAndMouse;

            controls = cm.GetControls();

            // we only check for one player
            currKeyboardState = Keyboard.GetState();
            prevKeyboardState = Keyboard.GetState();
            currMouseState = Mouse.GetState();
            prevMouseState = Mouse.GetState();

            CurrentKeyboardStates = new KeyboardState[MaxInputs];
            CurrentGamePadStates = new GamePadState[MaxInputs];
            LastKeyboardStates = new KeyboardState[MaxInputs];
            LastGamePadStates = new GamePadState[MaxInputs];
            GamePadWasConnected = new bool[MaxInputs];

              /*if (useKeyAndMouse)
            {
                // we only check for one player
                currKeyboardState = Keyboard.GetState();
                prevKeyboardState = Keyboard.GetState();
                currMouseState = Mouse.GetState();
                prevMouseState = Mouse.GetState();
            }
                else
            {
                CurrentKeyboardStates = new KeyboardState[MaxInputs];
                CurrentGamePadStates = new GamePadState[MaxInputs];
                LastKeyboardStates = new KeyboardState[MaxInputs];
                LastGamePadStates = new GamePadState[MaxInputs];
                GamePadWasConnected = new bool[MaxInputs];
            } */
        }