예제 #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            _graphics.PreferredBackBufferWidth = 1024;
            _graphics.PreferredBackBufferHeight = 768;
            _graphics.PreferMultiSampling = false;
            _graphics.IsFullScreen = false;

            _controller = new GameController(Window);

            _menu = new Menu();

            _mouseCursor = new MouseCursor();

            _hitList = new HitsList();
            _userInput = new UserInput();
        }
예제 #2
0
        public void UpdateMouse(Menu menu)
        {
            _mouseState = Mouse.GetState();
            _mouse.SpritePosition.X = _mouseState.X;
            _mouse.SpritePosition.Y = _mouseState.Y;

            _mouseBox.Min = new Vector3(_mouse.SpritePosition.X, _mouse.SpritePosition.Y, 0);

            _mouseBox.Max = new Vector3(_mouse.SpritePosition.X + _mouse.SpriteTexture.Width,
                _mouse.SpritePosition.Y + _mouse.SpriteTexture.Height, 0);

            // Cursor is square
            float difX = (_mouseBox.Max.X - _mouseBox.Min.X) / 5;
            float difY = (_mouseBox.Max.Y - _mouseBox.Min.Y) / 5;

            // New box: this is small center part of all Cursor Square
            _centerBox.Min.X = _mouseBox.Min.X + 2 * difX;
            _centerBox.Max.X = _mouseBox.Max.X - 2 * difX;
            _centerBox.Min.Y = _mouseBox.Min.Y + 2 * difY;
            _centerBox.Max.Y = _mouseBox.Max.Y - 2 * difY;

            _cursorGame.Min = new Vector3(650, 400, 0);
            _cursorGame.Max = new Vector3(950, 500, 0);
        }