Ejemplo n.º 1
0
        public void Render(IStateOwner pOwner, SKCanvas pRenderTarget, FieldLineActionGameState Source, GameStateSkiaDrawParameters Element)
        {
            var Bounds = Element.Bounds;


            float BlockWidth    = Bounds.Width / Source.PlayField.ColCount;
            float BlockHeight   = Bounds.Height / Source.PlayField.VisibleRows; //remember, we don't draw the top two rows- we start the drawing at row index 2, skipping 0 and 1 when drawing.
            bool  FoundAnimated = false;

            if (Source._BaseState != null)
            {
                var newElement = new GameStateSkiaDrawParameters(Element.Bounds);
                newElement.TagData = new GamePlayGameStateDataTagInfo()
                {
                    SkipParticlePaint = true
                };
                RenderingProvider.Static.DrawElement(pOwner, pRenderTarget, Source._BaseState, newElement);
            }

            if (Source.ClearRowInfo != null)
            {
                foreach (var iterate in Source.ClearRowInfo)
                {
                    int           currentRow = iterate.Key;
                    NominoBlock[] RowData    = iterate.Value;
                    for (int drawCol = 0; drawCol < RowData.Length; drawCol++)
                    {
                        float YPos     = (currentRow - Source.PlayField.HIDDENROWS) * BlockHeight;
                        float XPos     = drawCol * BlockWidth;
                        var   TetBlock = RowData[drawCol];
                        if (TetBlock != null)
                        {
                            SKRect BlockBounds = new SKRect(XPos, YPos, XPos + BlockWidth, YPos + BlockHeight);
                            TetrisBlockDrawSkiaParameters tbd = new TetrisBlockDrawSkiaParameters(pRenderTarget, BlockBounds, null, pOwner.Settings);
                            RenderingProvider.Static.DrawElement(pOwner, tbd.g, TetBlock, tbd);
                        }
                        else
                        {
                            ;
                        }
                    }
                }
            }
            //we told the main state not to paint particles, so we should paint them now.
            RenderingProvider.Static.DrawElement(pOwner, pRenderTarget, Source.GetComposite().Particles, Element);
            RenderingProvider.Static.DrawElement(pOwner, pRenderTarget, Source.GetComposite().TopParticles, Element);


            if (Source is FieldLineActionGameState linestate)
            {
                if (linestate.FlashState)
                {
                    pRenderTarget.DrawRect(Element.Bounds, FlashBrush);
                }
            }
        }
Ejemplo n.º 2
0
 public void RenderStats(IStateOwner pOwner, SKCanvas pRenderTarget, FieldLineActionGameState Source, GameStateSkiaDrawParameters Element)
 {
     base.RenderStats(pOwner, pRenderTarget, Source, Element);
 }
Ejemplo n.º 3
0
 public override void Render(IStateOwner pOwner, SKCanvas pRenderTarget, FieldActionGameState Source, GameStateSkiaDrawParameters Element)
 {
     if (Source is FieldLineActionGameState state)
     {
         this.Render(pOwner, pRenderTarget, state, Element);
     }
 }
Ejemplo n.º 4
0
        public void Render(IStateOwner pOwner, SKCanvas pRenderTarget, CharParticle Source, GameStateSkiaDrawParameters Element)
        {
            var Alphause           = TranslateAlpha(Source);
            var CharPoint          = TranslatePosition(pOwner, pRenderTarget, Source.Position, Element);
            var FontSizeTranslate  = new BCPoint(1, Source.FontInfo.FontSize);
            var TranslatedFontSize = TranslatePosition(pOwner, pRenderTarget, FontSizeTranslate, Element);
            var useColor           = new SKColor(Source.Color.R, Source.Color.G, Source.Color.B, Alphause);

            SKRect Bound = new SKRect();

            skp.MeasureText(Source.Text, ref Bound);
            skp.TextSize = TranslatedFontSize.Y;
            SKPaint Foreground = new SKPaint()
            {
                Color = useColor, TextSize = TranslatedFontSize.Y, Typeface = TetrisGame.RetroFontSK
            };
            SKPaint Background = new SKPaint()
            {
                Color = new SKColor(0, 0, 0, Alphause), TextSize = TranslatedFontSize.Y, Typeface = TetrisGame.RetroFontSK
            };
            DrawTextInformationSkia skinfo = new DrawTextInformationSkia()
            {
                Text             = Source.Text,
                Position         = CharPoint,
                CharacterHandler = new DrawCharacterHandlerSkia(new VerticalWavePositionCharacterPositionCalculatorSkia()
                {
                    Height = (float)(pOwner.ScaleFactor * 6)
                }),
                ForegroundPaint = Foreground,
                ShadowPaint     = Background
            };

            skinfo.DrawFont = new SKFontInfo(TetrisGame.RetroFontSK, TranslatedFontSize.Y);
            //pRenderTarget.DrawText(Source.Text, CharPoint.X,CharPoint.Y,TetrisGame.RetroFontSK,  skp);
            //pRenderTarget.DrawTextSK(Source.Text, CharPoint, TetrisGame.RetroFontSK, useColor, skp.TextSize,1);
            SKMatrix cloned = SKMatrix.Identity;

            if (Source.Angle != 0)
            {
                cloned = pRenderTarget.TotalMatrix;
                pRenderTarget.RotateDegrees((float)Source.Angle);
            }

            pRenderTarget.DrawTextSK(skinfo);

            if (Source.Angle != 0)
            {
                pRenderTarget.SetMatrix(cloned);
            }
            //CharPoint -= new BCPoint(skp)
            //    skp.MeasureText(Source.Character);
        }
Ejemplo n.º 5
0
 public override void Render(IStateOwner pOwner, SKCanvas pRenderTarget, BaseParticle Source, GameStateSkiaDrawParameters Element)
 {
     Render(pOwner, pRenderTarget, (CharParticle)Source, Element);
 }
Ejemplo n.º 6
0
        public override void Render(IStateOwner pOwner, SKCanvas pRenderTarget, List <BaseParticle> Source, GameStateSkiaDrawParameters Element)
        {
            if (Source.Count > 0)
            {
                Debug.Print("Rendering Particle Set of " + Source.Count.ToString());
                Debug.Print("Trace:" + new StackTrace().ToString());
            }
            foreach (var iterate in Source)
            {
                //retrieve rendering handler.
                var Grabrenderer = GetProvider(iterate.GetType());
                Grabrenderer.Render(pOwner, pRenderTarget, iterate, Element);
            }
            if (Source.Count > 0)
            {
                ;
            }

            if (pOwner.CurrentState.GameProcSuspended)
            {
                ;
            }

            UpdateParticles(pOwner, Source);
        }
Ejemplo n.º 7
0
        public void Render(IStateOwner pOwner, SKCanvas pRenderTarget, BitmapParticle Source, GameStateSkiaDrawParameters Element)
        {
            var      PosX   = Source.Position.X - Source.Width / 2;
            var      PosY   = Source.Position.Y - Source.Height / 2;
            SKMatrix cloned = SKMatrix.Identity;

            if (Source.Angle != 0)
            {
                cloned = pRenderTarget.TotalMatrix;
                pRenderTarget.RotateDegrees((float)Source.Angle);
            }

            pRenderTarget.DrawImage(Source.Image, new SKRect(PosX, PosY, PosX + Source.Width, PosY + Source.Height));
            if (Source.Angle != 0)
            {
                pRenderTarget.SetMatrix(cloned);
            }
        }
Ejemplo n.º 8
0
        public void Render(IStateOwner pOwner, SKCanvas pRenderTarget, LineParticle Source, GameStateSkiaDrawParameters Element)
        {
            var PointA   = TranslatePosition(pOwner, pRenderTarget, Source.Position, Element);
            var PointB   = TranslatePosition(pOwner, pRenderTarget, Source.EndPoint, Element);
            var Alphause = TranslateAlpha(Source);

            using (SKPaint skp = new SKPaint()
            {
                Color = new SKColor(Source.Color.R, Source.Color.G, Source.Color.B, Alphause), StrokeWidth = 2
            })
            {
                pRenderTarget.DrawLine(PointA, PointB, skp);
            }
        }