【发布时间】:2014-03-08 19:57:15
【问题描述】:
我有一个用这段代码创建的矩阵:
screenscalex = (float)_graphics.GraphicsDevice.Viewport.Width / 1920f;
screenscaley = (float)_graphics.GraphicsDevice.Viewport.Height / 1920f;
ScalingFactor = new Vector3(screenscalex, screenscaley, 1);
Global.SpriteScale = Matrix.CreateScale(ScalingFactor);
但我不知道如何使用矩阵来缩小我的精灵这是我目前用来缩小它们的代码:
batch.End();
batch.Begin(SpriteSortMode.Immediate,null, null, null, null, null, Global.SpriteScale);
//This is where the background gets drawn
backgroundsprite = new Sprite(background, Vector2.Zero);
backgroundsprite.Draw(batch);
//ive tried this too below
//batch.Draw(background, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White);
【问题讨论】: