示例#1
0
        public Sprite2D Clone()
        {
            var result = new Sprite2D();
            result.size = size;
            result.position = position;
            result.Texture = Texture;
            result.Color = Color;

            result.leftBottom = leftBottom;
            result.rightTop = rightTop;
            result.TexCoordLeftBottom = TexCoordLeftBottom;
            result.TexCoordRightTop = TexCoordRightTop;

            return result;
        }
示例#2
0
        public Sprite2D Clone()
        {
            var result = new Sprite2D();

            result.size     = size;
            result.position = position;
            result.Texture  = Texture;
            result.Color    = Color;

            result.leftBottom         = leftBottom;
            result.rightTop           = rightTop;
            result.TexCoordLeftBottom = TexCoordLeftBottom;
            result.TexCoordRightTop   = TexCoordRightTop;

            return(result);
        }
        private void InitializeProfileSprites()
        {
            profilePointSprites.Clear();

            var spriteTexturePath = Path.Combine(Application.StartupPath, "sprite.png");
            var spriteTexture = GetTexture(spriteTexturePath);

            for (var i = 0; i < 4; i++)
            {
                var sprite = new Sprite2D();
                sprite.Texture = spriteTexture;
                sprite.Size = new Vector2(1.5f, 1.5f);

                switch (i)
                {
                    case 0:         // это единичка)
                        sprite.TexCoordLeftBottom = new Vector2(0.5f, 0.5f);
                        sprite.TexCoordRightTop = Vector2.Zero;
                        break;
                    case 1:
                        sprite.TexCoordLeftBottom = new Vector2(1.0f, 0.5f);
                        sprite.TexCoordRightTop = new Vector2(0.5f, 0f);
                        break;
                    case 2:
                        sprite.TexCoordLeftBottom = new Vector2(0.5f, 1.0f);
                        sprite.TexCoordRightTop = new Vector2(0f, 0.5f);
                        break;
                    case 3:
                        sprite.TexCoordLeftBottom = new Vector2(1.0f, 1.0f);
                        sprite.TexCoordRightTop = new Vector2(0.5f, 0.5f);
                        break;
                }

                profilePointSprites.Add(sprite);
            }
        }
        private void InitializeCustomBaseSprites()
        {
            //customBasePointsSprites.Clear();
            if (customBasePointsSprites.Count > 0)
                return;

            var spriteTexturePath = Path.Combine(Application.StartupPath, "sprite.png");
            var spriteTexture = GetTexture(spriteTexturePath);

            for (var i = 0; i < 4; i++)
            {
                var sprite = new Sprite2D();
                sprite.Texture = spriteTexture;
                sprite.Size = new Vector2(1.5f, 1.5f);

                switch (i)
                {
                    case 0:
                        sprite.TexCoordLeftBottom = new Vector2(0.5f, 0.5f);
                        sprite.TexCoordRightTop = Vector2.Zero;
                        break;
                    case 1:
                        sprite.TexCoordLeftBottom = new Vector2(1.0f, 1.0f);
                        sprite.TexCoordRightTop = new Vector2(0.5f, 0.5f);
                        break;
                    case 2:
                        sprite.TexCoordLeftBottom = new Vector2(0.5f, 1.0f);
                        sprite.TexCoordRightTop = new Vector2(0f, 0.5f);
                        break;
                    case 3:
                        sprite.TexCoordLeftBottom = new Vector2(1.0f, 0.5f);
                        sprite.TexCoordRightTop = new Vector2(0.5f, 0f);
                        break;
                }

                customBasePointsSprites.Add(sprite);
            }
        }