Ejemplo n.º 1
0
 public void Draw(DrawingStage stage)
 {
     if (stage == DrawingStage.Colour)
     {
         renderMethod.Draw(attachments.Properties);
     }
 }
Ejemplo n.º 2
0
        public void Draw(DrawingStage stage)
        {
            particleType.PreDraw(stage);

            switch (stage)
            {
            case DrawingStage.Colour:
            {
                for (int i = 0; i < particles.Count; i++)
                {
                    particleType.Draw(particles[i].Position,
                                      properties[i].Scale, properties[i].Rotation, properties[i].Colour);
                }
            }
            break;

            default:
            {
                for (int i = 0; i < particles.Count; i++)
                {
                    particleType.Draw(particles[i].Position,
                                      properties[i].Scale, properties[i].Rotation, properties[i].EffectColour);
                }
            }
            break;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Used to draw the Skeleton.
        /// </summary>
        /// <param name="stage">The DrawingStage that defines how
        /// this Skeleton should be drawn.</param>
        public void Draw(DrawingStage stage)
        {
            for (int i = 0; i < limbs.Count; i++)
            {
                Limb limb = limbs[i];

                switch (stage)
                {
                case DrawingStage.Colour:
                    limb.CalculateBounds(Owner.World.Matrix);
                    break;
                }

                switch (stage)
                {
                case DrawingStage.Colour:
                    Common.Batch.Draw(textures[limb.Name], limb.Bounds, null, Colour,
                                      limb.Transform.Rotation, limb.RotationPoint, effect, 0);
                    break;

                case DrawingStage.Normal:
                    Common.Batch.Draw(normalMaps[limb.Name], limb.Bounds, null, Color.White,
                                      limb.Transform.Rotation, limb.RotationPoint, effect, 0);
                    break;

                case DrawingStage.Distortion:
                    Common.Batch.Draw(distortionMaps[limb.Name], limb.Bounds, null, Color.White,
                                      limb.Transform.Rotation, limb.RotationPoint, effect, 0);
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        public void Draw(DrawingStage stage)
        {
            bool renderSingle = ((MainScreen)Owner).RenderSingle;

            if (Enabled || !renderSingle)
            {
                switch (stage)
                {
                case DrawingStage.Colour:
                {
                    for (int i = 0; i < chunks.Count; i++)
                    {
                        if (CameraManager2D.CurrentCamera.IsInView(chunks[i].Bounds))
                        {
                            LayerChunk chunk = chunks[i];

                            for (int j = 0; j < chunk.Indices.Count; j++)
                            {
                                if (cells[chunk.Indices[j]].Index != -1 && cells[chunk.Indices[j]].Index < sourceRects.Count)
                                {
                                    Common.Batch.Draw(tileSheet, cells[chunk.Indices[j]].Bounds,
                                                      sourceRects[cells[chunk.Indices[j]].Index], Color.White);
                                }
                            }
                        }
                    }
                }
                break;
                }
            }
        }
Ejemplo n.º 5
0
        protected virtual void _Draw(DrawingStage stage)
        {
            Vector2 p = pos;

            if (Owner != null)
            {
                p.X += Owner.World.Translation.X;
                p.Y += Owner.World.Translation.Y;
            }

            Common.Batch.DrawString(font, text, p, colour, rot,
                                    origin, scale, SpriteEffects.None, 1);
        }
Ejemplo n.º 6
0
        public void Draw(DrawingStage stage)
        {
            if (ShouldRender())
            {
                if (stage == DrawingStage.Colour)
                {
                    renderTiles.Clear();
                }

                for (int i = 0; i < tiles.Count; i++)
                {
                    bool render = false;

                    if (stage == DrawingStage.Colour)
                    {
                        render = DrawTileColour(tiles[i]);
                    }
                    else
                    {
                        render = DrawTile(tiles[i]);
                    }

                    if (render)
                    {
                        Rectangle sourceRect = attachedTo.SourceRects[tiles[i].RefferenceNumber];

                        switch (stage)
                        {
                        case DrawingStage.Colour:
                            Common.Batch.Draw(attachedTo.TileSheet, tiles[i].Bounds, sourceRect, Color.White);
                            break;

                        case DrawingStage.Distortion:
                            if (attachedTo.DistortionMap != null)
                            {
                                Common.Batch.Draw(attachedTo.DistortionMap, tiles[i].Bounds, sourceRect, Color.White);
                            }
                            break;

                        case DrawingStage.Normal:
                            if (attachedTo.NormalMap != null)
                            {
                                Common.Batch.Draw(attachedTo.NormalMap, tiles[i].Bounds, sourceRect, Color.White);
                            }
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
        void Draw(DrawingStage stage)
        {
            Common.Device.BlendState = BlendState.AlphaBlend;

            switch (stage)
            {
            case DrawingStage.Colour:
                render.Begin();
                break;

            case DrawingStage.Distortion:
                distortionRender.Begin();
                break;

            default:
                opaqueRender.Begin();
                break;
            }

            Common.Device.Clear(Color.Transparent);

            if (CameraManager.CurrentCamera != null)
            {
                Common.Batch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp,
                                   null, null, null, CameraManager.CurrentCamera.ViewMatrix);
            }
            else
            {
                Common.Batch.Begin();
            }

            layers.Draw(stage);

            Common.Batch.End();

            switch (stage)
            {
            case DrawingStage.Colour:
                render.End();
                break;

            case DrawingStage.Distortion:
                distortionRender.End();
                break;

            default:
                opaqueRender.End();
                break;
            }
        }
Ejemplo n.º 8
0
 public void Draw(DrawingStage stage)
 {
     for (int i = 0; i < items.Count; i++)
     {
         if (items[i] is ObjectComponent)
         {
             if (((ObjectComponent)items[i]).Enabled)
             {
                 items[i].Draw(stage);
             }
         }
         else
         {
             items[i].Draw(stage);
         }
     }
 }
Ejemplo n.º 9
0
        protected override void _Draw(DrawingStage stage)
        {
            Vector2 initPos = pos;

            if (Owner != null)
            {
                initPos.X += Owner.World.Translation.X;
                initPos.Y += Owner.World.Translation.Y;
            }

            for (int i = 0; i < lines.Count; i++)
            {
                Common.Batch.DrawString(font, lines[i], initPos,
                                        colour, 0, Vector2.Zero, scale, SpriteEffects.None, 1);

                initPos.Y += spacing;
            }
        }
Ejemplo n.º 10
0
        public void Draw(DrawingStage stage)
        {
            switch (stage)
            {
            case DrawingStage.Colour:
                if (rotation != 0)
                {
                    Common.Batch.Draw(texture, rect, sourceRect, colour,
                                      rotation, GetTextureCenter(), spriteEffect, 0);
                }
                else
                {
                    Common.Batch.Draw(texture, rect, sourceRect, colour,
                                      0, Vector2.Zero, spriteEffect, 0);
                }
                break;

            case DrawingStage.Distortion:
                if (rotation != 0)
                {
                    Common.Batch.Draw(distortion, rect, sourceRect,
                                      Color.White, rotation, GetTextureCenter(), spriteEffect, 0);
                }
                else
                {
                    Common.Batch.Draw(distortion, rect, sourceRect,
                                      Color.White, 0, Vector2.Zero, spriteEffect, 0);
                }
                break;

            default:
                if (rotation != 0)
                {
                    Common.Batch.Draw(normalMap, rect, sourceRect,
                                      Color.White, rotation, GetTextureCenter(), spriteEffect, 0);
                }
                else
                {
                    Common.Batch.Draw(normalMap, rect, sourceRect,
                                      Color.White, 0, Vector2.Zero, spriteEffect, 0);
                }
                break;
            }
        }
Ejemplo n.º 11
0
        public void Draw(DrawingStage stage)
        {
            switch (stage)
            {
            case DrawingStage.Colour:
                Common.Batch.Draw(texture, rect, sourceRect, colour,
                                  rotation, GetTextureCenter(), spriteEffect, 0);
                break;

            case DrawingStage.Distortion:
                Common.Batch.Draw(distortion, rect, sourceRect,
                                  Color.White, rotation, GetTextureCenter(), spriteEffect, 0);
                break;

            default:
                Common.Batch.Draw(normalMap, rect, sourceRect,
                                  Color.White, rotation, GetTextureCenter(), spriteEffect, 0);
                break;
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Used to draw the various layers.
        /// </summary>
        /// <param name="stage">The current DrawingStage.</param>
        public void Draw(DrawingStage stage)
        {
            if (layers.Count > 0)
            {
                int layer = 0;

                while (layer <= max)
                {
                    for (int i = 0; i < layers.Count; i++)
                    {
                        if (layers[i]._drawLayer == layer)
                        {
                            layers[i].Draw(stage);
                        }
                    }

                    layer++;
                }
            }
        }
Ejemplo n.º 13
0
        public override void Draw(DrawingStage stage)
        {
            switch (stage)
            {
            case DrawingStage.Colour:
            {
                Rectangle rect = new Rectangle((int)Offset.X, (int)Offset.Y, (int)Scale.X, (int)Scale.Y);

                if (Owner != null)
                {
                    Vector3 s = Vector3.One;
                    Helpers.EonMathHelper.GetMatrixScale(Owner.World, out s);

                    rect.X      += (int)Owner.World.Translation.X;
                    rect.Y      += (int)Owner.World.Translation.Y;
                    rect.Width  *= (int)s.X;
                    rect.Height *= (int)s.Y;
                }

                Bounds = rect;

                Common.Batch.Draw(Texture, Bounds, sourceRect, Colour, Rotation, GetTextureCenter(Texture), SpriteEffect, 0);
            }
            break;

            case DrawingStage.Distortion:
            {
                Common.Batch.Draw(DistortionMap, Bounds, sourceRect, Color.White,
                                  Rotation, GetTextureCenter(DistortionMap), SpriteEffect, 0);
            }
            break;

            default:
            {
                Common.Batch.Draw(NormalMap, Bounds, sourceRect, Color.White,
                                  Rotation, GetTextureCenter(NormalMap), SpriteEffect, 0);
            }
            break;
            }
        }
Ejemplo n.º 14
0
        public virtual void Draw(DrawingStage stage)
        {
            switch (stage)
            {
            case DrawingStage.Colour:
            {
                rect = new Rectangle((int)offset.X, (int)offset.Y, (int)scale.X, (int)scale.Y);

                if (Owner != null)
                {
                    Vector3 s = Vector3.One;
                    Helpers.EonMathHelper.GetMatrixScale(Owner.World, out s);

                    rect.X      += (int)Owner.World.Translation.X;
                    rect.Y      += (int)Owner.World.Translation.Y;
                    rect.Width  *= (int)s.X;
                    rect.Height *= (int)s.Y;
                }

                Common.Batch.Draw(texture, rect, null, colour, rotation, GetTextureCenter(texture), spriteEffect, 0);
            }
            break;

            case DrawingStage.Distortion:
            {
                Common.Batch.Draw(distortionMap, rect, null, Color.White,
                                  rotation, GetTextureCenter(distortionMap), spriteEffect, 0);
            }
            break;

            default:
            {
                Common.Batch.Draw(normalMap, rect, null, Color.White,
                                  rotation, GetTextureCenter(normalMap), spriteEffect, 0);
            }
            break;
            }
        }
Ejemplo n.º 15
0
 public void Draw(DrawingStage stage)
 {
     _Draw(stage);
 }
Ejemplo n.º 16
0
 public void PreDraw(DrawingStage stage)
 {
     this.stage = stage;
     currIndex  = 0;
 }
Ejemplo n.º 17
0
 public void PreDraw(DrawingStage stage)
 {
     this.stage = stage;
 }