コード例 #1
0
ファイル: Overlay.cs プロジェクト: wubin-ericsson/mogre
 /// <summary>
 /// Destroys the Overlay.
 /// </summary>
 protected override void DestroyElement()
 {
     if (this.Sprite != null)
     {
         this.Sprite.RemoveFromRenderer();
         this.Sprite = null;
     }
 }
コード例 #2
0
        private void CreateSprite(Pen pen, params Primitive[] primitives)
        {
            var sprite = new TwoDSprite(this.SpriteRenderer, primitives)
            {
                ZOrder = this.sprites.Count
            };

            pen.Apply(sprite);

            this.sprites.Add(sprite);
        }
コード例 #3
0
        /// <summary>
        /// Updates the Element.
        /// </summary>
        public override void Update()
        {
            if (this.mapNeedsUpdate)
            {
                this.DestroyElement();
                this.mapNeedsUpdate = false;

                var point        = this.location;
                var viewportSize = this.ViewportSize;
                foreach (var row in this.Map)
                {
                    for (int index = 0; index < row.Length; index++)
                    {
                        var quad   = new Quad(new Rectangle(point, this.tileSize).ToScreenCoordinates(viewportSize));
                        var sprite = new TwoDSprite(this.Layer.SpriteRenderer, quad)
                        {
                            Opacity = 1f,
                            Visible = true
                        };

                        this.sprites.Add(sprite);

                        point += new Point(this.tileSize.Width, 0);
                    }

                    point = new Point(this.location.X, point.Y + this.tileSize.Height);
                }
            }

            int i = 0;

            for (int rowIndex = 0; rowIndex < this.Map.Length; rowIndex++)
            {
                var row = this.Map[rowIndex];
                for (int cellIndex = 0; cellIndex < row.Length; cellIndex++)
                {
                    var cell  = row[cellIndex];
                    var frame = this.textures[cell].GetFrameFromTime(this.textureAnimationTime);
                    this.sprites[i].SetTexture(frame.FileName);
                    this.sprites[i].SetUV(frame.UV.GetPoints());
                    i++;
                }
            }

            this.textureAnimationTime += this.Layer.TwoDManager.MiyagiSystem.TimeSinceLastUpdate;
        }
コード例 #4
0
ファイル: SolidBrush.cs プロジェクト: wubin-ericsson/mogre
 /// <summary>
 /// Applies the brush to the specified sprite.
 /// </summary>
 /// <param name="sprite">The sprite.</param>
 public void Apply(TwoDSprite sprite)
 {
     sprite.SetColour(this.colour);
     sprite.TextureHandle = RenderManager.OpaqueTextureHandle;
 }
コード例 #5
0
ファイル: Pen.cs プロジェクト: wubin-ericsson/mogre
 /// <summary>
 /// Applies the specified sprite.
 /// </summary>
 /// <param name="sprite">The sprite.</param>
 public void Apply(TwoDSprite sprite)
 {
     this.Brush.Apply(sprite);
     sprite.Visible = true;
     sprite.Opacity = this.Opacity;
 }
コード例 #6
0
ファイル: TexturedBrush.cs プロジェクト: wubin-ericsson/mogre
 /// <summary>
 /// Applies the brush to the specified sprite.
 /// </summary>
 /// <param name="sprite">The sprite.</param>
 public void Apply(TwoDSprite sprite)
 {
     sprite.SetTexture(this.texture);
     sprite.SetColour(Colours.White);
 }