Exemplo n.º 1
0
        public Vector2 GetMouseInScreenSpace(int Rollback = 0)
        {
            IRenderService rs         = GameService.GetService <IRenderService>();
            MouseState     mouseState = GetRolledbackMouseState(Rollback);

            return(new Vector2(
                       mouseState.Position.X / rs.GetTargetToDisplayRatioX(),
                       mouseState.Position.Y / rs.GetTargetToDisplayRatioY()
                       ));
        }
Exemplo n.º 2
0
        public Vector2 GetMouseInWorldSpace2()
        {
            IRenderService rs             = GameService.GetService <IRenderService>();
            Vector2        cameraPosition = GameService.GetService <ISceneService>().CurrentScene.Camera.GetCenterPoint();
            MouseState     mouseState     = GetCurrentMouseState();

            return(new Vector2(
                       mouseState.Position.X / rs.GetTargetToDisplayRatioX() + cameraPosition.X - rs.InternalResolutionX / 2,
                       mouseState.Position.Y / rs.GetTargetToDisplayRatioY() + cameraPosition.Y - rs.InternalResolutionY / 2
                       ));
        }