public override void Draw(GameTime gameTime)
        {
            var       SpriteBatch = StaticData.EngineManager.Game1.SpriteBatch;
            Texture2D Texture     = TextureManager.GetTextureByType(this.TextureType);

            SpriteBatch.Begin();
            float   angleOfRotation = AngleOfRotation;
            Vector2 scaleVector     = MathHelperModule.ScaleRectByTexture(Texture, RectangleArea);

            Visual2DPositionCenterEngine = new Vector3(RectangleArea.X + (Texture.Bounds.Width * scaleVector.X) / 2,
                                                       RectangleArea.Y + (Texture.Bounds.Height * scaleVector.Y) / 2, 0);
            Vector2 Visual2DPositionCenterEngine2D = new Vector2(Visual2DPositionCenterEngine.X, Visual2DPositionCenterEngine.Y);
            Vector2 originOfRotation = new Vector2((float)Texture.Width / 2, (float)Texture.Height / 2);

            SpriteBatch.Draw(Texture,
                             Visual2DPositionCenterEngine2D,
                             null,
                             Color.White,
                             angleOfRotation,
                             originOfRotation,
                             scaleVector,
                             SpriteEffects.None,
                             1);
            SpriteBatch.End();
        }
示例#2
0
        public virtual void Draw(GameTime gameTime, float orientation)
        {
            var       SpriteBatch = StaticData.EngineManager.Game1.SpriteBatch;
            Texture2D Texture     = TextureManager.GetTextureByType(this.TextureType);

            SpriteBatch.Begin();
            float   angleOfRotation = orientation;
            Vector2 scaleVector     = MathHelperModule.ScaleRectByTexture(Texture, RectangleArea);
            Vector2 pos             = new Vector2(this.RectangleArea.X, this.RectangleArea.Y);
            //Vector2 pos = new Vector2(RectangleArea.X + (Texture.Bounds.Width * scaleVector.X) / 2,
            //                                RectangleArea.Y + (Texture.Bounds.Height * scaleVector.Y) / 2);
            //Vector2 pos = new Vector2(RectangleArea.X, RectangleArea.Y);
            Vector2 originOfRotation = new Vector2(0, 0);//(float)RectangleArea.Width / 2, (float)RectangleArea.Height / 2);

            SpriteBatch.Draw(Texture,
                             pos,
                             null,
                             Color.White,
                             angleOfRotation,
                             originOfRotation,
                             scaleVector,
                             SpriteEffects.None,
                             0);
            SpriteBatch.End();
        }