本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Sprite.CenterOrigin方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.CenterOrigin方法的具体用法?C# Sprite.CenterOrigin怎么用?C# Sprite.CenterOrigin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.Sprite
的用法示例。
在下文中一共展示了Sprite.CenterOrigin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BackgroundObject
public BackgroundObject(Texture2D texture, Vector2 position, float rotation, float size, Strategy strategy)
{
_sprite = new Sprite(texture);
Position = position;
_sprite.Position = position;
_sprite.Scale = new Vector2(size);
_sprite.Color = ColorFromSize(size);
_sprite.CenterOrigin();
_rotation = rotation;
_strategy = strategy;
}
示例2: LevelSelectWindow
public LevelSelectWindow(WindowHandler windowHandler)
{
_windowHandler = windowHandler;
GraphicsDevice graphicsDevice = _windowHandler.Game.GraphicsDevice;
_spriteBatch = new SpriteBatch(graphicsDevice);
_camera = new Camera2D(graphicsDevice);
_spriteList = new List<Sprite>();
_background = new Sprite(Game1.contentManager.Load<Texture2D>(@"Images\LevelSelectMan"));
float windowScaleRatio = graphicsDevice.Viewport.Height / _background.OriginalSize.Y;
_background.Scale = new Vector2(windowScaleRatio / START_ZOOM);
_background.CenterOrigin();
_background.Position = Utils.GetScreenCenter(graphicsDevice);
_dot = new Sprite(Game1.contentManager.Load<Texture2D>(@"Images\Dot"));
_dot.CenterOrigin();
_dot.Color = Color.DarkRed;
_spriteList.Add(_background);
Vector2 imageScaledSize = _background.ScaledSize / 2;
HEART_POSITION = Utils.GetScreenCenter(graphicsDevice);
KNEE_POSITION = Utils.GetScreenCenter(graphicsDevice);
NECK_POSITION = Utils.GetScreenCenter(graphicsDevice);
BRAIN_POSITION = Utils.GetScreenCenter(graphicsDevice);
HEART_POSITION.X += imageScaledSize.X * -0.005f;
HEART_POSITION.Y += imageScaledSize.Y * -0.41f;
KNEE_POSITION.X += imageScaledSize.X * 0.06f;
KNEE_POSITION.Y += imageScaledSize.Y * 0.43f;
NECK_POSITION.X += imageScaledSize.X * -0.01f;
NECK_POSITION.Y += imageScaledSize.Y * -0.65f;
BRAIN_POSITION.X += imageScaledSize.X * -0.01f;
BRAIN_POSITION.Y += imageScaledSize.Y * -0.85f;
BodyPartPositions[BodyPartType.BRAIN] = BRAIN_POSITION;
BodyPartPositions[BodyPartType.HEART] = HEART_POSITION;
BodyPartPositions[BodyPartType.NECK] = NECK_POSITION;
BodyPartPositions[BodyPartType.KNEE] = KNEE_POSITION;
}
示例3: Init
private void Init()
{
InitCellTextures();
Sprite = new Sprite(_sadTexture);
Sprite.CenterOrigin();
Sprite.Scale = new Vector2(0.14f);
_virusResistance = 5;
CreateBody();
Body.LinearDamping = 1;
}
示例4: init
private void init()
{
Strategy.Owner = this;
_virusType = Shared.Random.Next(4);
_virusType = 0;
InitCellTextures();
Sprite = new Sprite(_virusTexture);
Sprite.CenterOrigin();
Sprite.Scale = new Vector2(0.08f);
CreateBody();
Body.UserData = this;
}