当前位置: 首页>>代码示例>>C#>>正文


C# Sprite.CenterOrigin方法代码示例

本文整理汇总了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;
 }
开发者ID:em-mo,项目名称:sommarhack,代码行数:11,代码来源:BackgroundObject.cs

示例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;
        }
开发者ID:em-mo,项目名称:sommarhack,代码行数:46,代码来源:LevelSelectWindow.cs

示例3: Init

 private void Init()
 {
     InitCellTextures();
     Sprite = new Sprite(_sadTexture);
     Sprite.CenterOrigin();
     Sprite.Scale = new Vector2(0.14f);
     _virusResistance = 5;
     CreateBody();
     Body.LinearDamping = 1;
 }
开发者ID:em-mo,项目名称:sommarhack,代码行数:10,代码来源:GoodCell.cs

示例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;
 }
开发者ID:em-mo,项目名称:sommarhack,代码行数:12,代码来源:Virus.cs


注:本文中的Microsoft.Xna.Framework.Graphics.Sprite.CenterOrigin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。