Example #1
0
        /// <summary>
        /// Call HandleInput on the screen managers.
        /// </summary>
        /// <param name="elapsedGameTime">The time in seconds since the last frame</param>
        /// <param name="mousePosition">The current screen space position of the mouse</param>
        public override void HandleInput(float elapsedGameTime, Vector2 mousePosition)
        {
            base.HandleInput(elapsedGameTime, mousePosition);

            Vector2 gameMouseCoords = Camera.ScreenToGameCoords(mousePosition);

            if (ScreenUIObjects.ShouldHandleInput)
            {
                ScreenUIObjects.HandleInput(elapsedGameTime, mousePosition);
            }
            if (InGameUIObjects.ShouldHandleInput)
            {
                InGameUIObjects.HandleInput(elapsedGameTime, gameMouseCoords);
            }
            if (GameObjects.ShouldHandleInput)
            {
                GameObjects.HandleInput(elapsedGameTime, gameMouseCoords);
            }
            if (EnvironmentObjects.ShouldHandleInput)
            {
                EnvironmentObjects.HandleInput(elapsedGameTime, gameMouseCoords);
            }

            if (Modules.ShouldHandleInput)
            {
                Modules.HandleInput(elapsedGameTime, mousePosition);
            }
        }
        /// <summary>
        /// Call HandleInput on the screen managers.
        /// </summary>
        /// <param name="elapsedGameTime">The time in seconds since the last frame</param>
        /// <param name="mousePosition">The current screen space position of the mouse</param>
        public override void HandleInput(float elapsedGameTime, Vector2 mousePosition)
        {
            base.HandleInput(elapsedGameTime, mousePosition);

            Vector2 gameMouseCoords = Camera.Instance.ScreenToGameCoords(mousePosition);

            // Handle these in this order so we respect the depth elements implied here
            if (ScreenUIObjects.ShouldHandleInput)
            {
                ScreenUIObjects.HandleInput(elapsedGameTime, mousePosition);
            }
            if (InGameUIObjects.ShouldHandleInput)
            {
                InGameUIObjects.HandleInput(elapsedGameTime, gameMouseCoords);
            }
            if (GameObjects.ShouldHandleInput)
            {
                GameObjects.HandleInput(elapsedGameTime, gameMouseCoords);
            }
            if (EnvironmentObjects.ShouldHandleInput)
            {
                EnvironmentObjects.HandleInput(elapsedGameTime, gameMouseCoords);
            }

            if (Modules.ShouldHandleInput)
            {
                Modules.HandleInput(elapsedGameTime, mousePosition);
            }
        }