示例#1
0
        private void DrawAnimStripDecoration(Canvas2D canvas)
        {
            //-----------------------------TOP-STRIP------------------------------------------
            canvas.DrawLine(0, 2, RenderRegion.Right, 2, new LineStyle(2f, LineStroke.Solid), ColorU.Black);
            canvas.DrawLine(0, 2, RenderRegion.Right, 2, new LineStyle(2f, LineStroke.Dashed), ColorU.White);
            canvas.DrawLine(0, 3, RenderRegion.Right, 3, new LineStyle(2f, LineStroke.Solid), ColorU.Black);
            canvas.DrawLine(0, 3, RenderRegion.Right, 3, new LineStyle(2f, LineStroke.Dashed), ColorU.White);
            canvas.DrawLine(0, 4, RenderRegion.Right, 4, new LineStyle(2f, LineStroke.Solid), ColorU.Black);
            canvas.DrawLine(0, 4, RenderRegion.Right, 4, new LineStyle(2f, LineStroke.Dashed), ColorU.White);
            canvas.DrawLine(0, 5, RenderRegion.Right, 5, new LineStyle(2f, LineStroke.Solid), ColorU.Black);
            canvas.DrawLine(0, 5, RenderRegion.Right, 5, new LineStyle(2f, LineStroke.Dashed), ColorU.White);

            //-----------------------------BOTTOM-STRIP----------------------------------------
            canvas.DrawLine(0, RenderRegion.Bottom - 2, RenderRegion.Right, RenderRegion.Bottom - 2,
                            new LineStyle(2f, LineStroke.Solid), ColorU.Black);
            canvas.DrawLine(0, RenderRegion.Bottom - 2, RenderRegion.Right, RenderRegion.Bottom - 2,
                            new LineStyle(2f, LineStroke.Dashed), ColorU.White);
            canvas.DrawLine(0, RenderRegion.Bottom - 3, RenderRegion.Right, RenderRegion.Bottom - 3,
                            new LineStyle(2f, LineStroke.Solid), ColorU.Black);
            canvas.DrawLine(0, RenderRegion.Bottom - 3, RenderRegion.Right, RenderRegion.Bottom - 3,
                            new LineStyle(2f, LineStroke.Dashed), ColorU.White);
            canvas.DrawLine(0, RenderRegion.Bottom - 4, RenderRegion.Right, RenderRegion.Bottom - 4,
                            new LineStyle(2f, LineStroke.Solid), ColorU.Black);
            canvas.DrawLine(0, RenderRegion.Bottom - 4, RenderRegion.Right, RenderRegion.Bottom - 4,
                            new LineStyle(2f, LineStroke.Dashed), ColorU.White);
            canvas.DrawLine(0, RenderRegion.Bottom - 5, RenderRegion.Right, RenderRegion.Bottom - 5,
                            new LineStyle(2f, LineStroke.Solid), ColorU.Black);
            canvas.DrawLine(0, RenderRegion.Bottom - 5, RenderRegion.Right, RenderRegion.Bottom - 5,
                            new LineStyle(2f, LineStroke.Dashed), ColorU.White);

            //-----------------------------BACKGROUND--------------------------------------------

            canvas.DrawFilledRect(0, 7, RenderRegion.Width, RenderRegion.Height - 13, ColorU.Black.MultiplyAlpha(0.6f));
        }
示例#2
0
        public override void DrawForeground(Canvas2D canvas)
        {
            canvas.DrawText(GameFont.Default, new Vector2(20, 20), "Hello", Color.Yellow);

            using (canvas <= new Translation(250, 100) <= new Rotation(delta))
            {

                canvas.DrawLine(new Vector2(0, 0), new Vector2(100, 0), new LineStyle(2, LineStroke.Smooth), Color.Blue);
            }

            using (canvas <= new Translation(500, 100) <= new Rotation(delta))
            {
                canvas.DrawFilledRect(new Rect(-100, -100, 100, 100), Color.Yellow);
                //canvas.DrawRect(new Rect(0, 0, 100, 100), new LineStyle(1), Color.Yellow);

            }
        }
示例#3
0
        public virtual void Render(Canvas2D canvas)
        {
            canvas.Clear(Configuration.BackgroundColor);


            if (TransparentBack)
            {
                var boxWidth = (int)(0.01f * Target.Width);
                var qtdeX    = (int)Math.Ceiling((double)RenderRegion.Width / boxWidth);
                var qtdeY    = (int)Math.Ceiling((double)RenderRegion.Height / boxWidth);

                var color1 = ColorU.White;
                var color2 = ColorU.LightGray;

                for (var i = 0; i < qtdeX; i++)
                {
                    for (var j = 0; j < qtdeY; j++)
                    {
                        var curColor = i % 2 == j % 2 ? color1 : color2;
                        canvas.DrawFilledRect(i * boxWidth, j * boxWidth, boxWidth, boxWidth, curColor);
                    }
                }
            }
        }
示例#4
0
            public void Draw(Canvas2D canvas, SpriteFont font)
            {
                var drawRect = new Rect(new PointF(X, Y), Size);

                ColorU color;

                if (Highlighted && !Selected)
                {
                    color = ColorU.Red;
                }
                else if (Selected)
                {
                    color = ColorU.Yellow;
                }
                else
                {
                    color = ColorU.WhiteSmoke;
                }

                //-------------------EXTERNAL-BORDER------------------------------------------------------------
                canvas.DrawRect(drawRect.Left - LineStyleExternalRect.Width,
                                drawRect.Top - LineStyleExternalRect.Width,
                                drawRect.Width + LineStyleExternalRect.Width * 2,
                                drawRect.Height + LineStyleExternalRect.Width * 2,
                                LineStyleExternalRect,
                                color);

                //------------------INTERNAL-BORDER-------------------------------------------------------------
                canvas.DrawRect(drawRect, LineStyleInternalRect, ColorU.Black);

                //------------------BACKGROUND------------------------------------------------------------------
                canvas.DrawFilledRect(drawRect, ColorU.Black.MultiplyAlpha(0.5f));


                var frameLabelRect = new Rect(new PointF(drawRect.Left,
                                                         drawRect.Top + drawRect.Height + LineStyleExternalRect.Width +
                                                         LineStyleInternalRect.Width), new SizeF(drawRect.Width, 20f));

                //------------------LABEL------------------------------------------------------------------------
                canvas.DrawFilledRect(frameLabelRect, ColorU.Black.MultiplyAlpha(0.5f));


                //------------------SPRITE-----------------------------------------------------------------------
                if (Frame != null)
                {
                    //using (canvas[0] <= new SamplerState(Configuration.TextureFilterMode, ColorU.White))
                    //{
                    canvas.DrawText(font, new Vector2(frameLabelRect.Left + 5f, frameLabelRect.Top),
                                    string.Format("{0}", Frame.Num), ColorU.AliceBlue);
                    canvas.DrawText(font, new Vector2(frameLabelRect.Left + 30f, frameLabelRect.Top),
                                    string.Format("FrameRate: {0}", 1f / Frame.FrameDuration), ColorU.Red);
                    if (!Dragged)
                    {
                        canvas.DrawSprite(drawRect.CenterX, drawRect.CenterY, Frame.SpriteFrame.Width * Scale.X,
                                          Frame.SpriteFrame.Height * Scale.Y, Frame.SpriteFrame.Sprite, ColorU.White);
                    }
                    else
                    {
                        canvas.DrawSprite(FrameDrawPos.X, FrameDrawPos.Y, Frame.SpriteFrame.Width * Scale.X,
                                          Frame.SpriteFrame.Height * Scale.Y, Frame.SpriteFrame.Sprite,
                                          ColorU.White);
                    }

                    //}
                }
            }