コード例 #1
0
        public void DrawXButton(bool DrawGlow, float BarMult, float XMult)
        {
            Vector3 Position3 = Game1.graphicsDevice.Viewport.Project(
                new Vector3(this.Position.X(), Y, this.Position.Y()), StarshipScene.CurrentCamera.ProjectionMatrix,
                StarshipScene.CurrentCamera.ViewMatrix, Matrix.Identity);

            Vector3 Size3 = Game1.graphicsDevice.Viewport.Project(
                new Vector3(this.Position.X() + this.Size.X(), Y, this.Position.Y()), StarshipScene.CurrentCamera.ProjectionMatrix,
                StarshipScene.CurrentCamera.ViewMatrix, Matrix.Identity);

            Vector2 Position = new Vector2(Position3.X, Position3.Y) - Render.CurrentView.Position;
            float   Size     = Vector2.Distance(Position, new Vector2(Size3.X, Size3.Y) - Render.CurrentView.Position) / 1.6f;

            Position.Y -= Size;

            Render.DrawSprite(DrawGlow ? ControllerLoader.XButtonGlow : ControllerLoader.XButton, Position, new Vector2(Size), 0);
            if (BarMult > 0)
            {
                Render.DrawBar(Position - new Vector2(Size / 2, 10), Position + new Vector2(Size / 2, 0), BarMult, Color.Black, Color.White);
            }
            if (XMult > 0)
            {
                Render.DrawSprite(PlayerProfile.XTexture, Position, new Vector2(Size) * 2, 0, Color.White * XMult);
            }
        }