public override void Render(Canvas2D canvas) { base.Render(canvas); if (CurrentAnimation != null && CurrentAnimation.Frames.Count > 0) { canvas.DrawText(Font, Vector2.Zero, string.Format("Frame: {0}/{1} | Offset: {2};{3} | Origin:{4};{5}", CurrentAnimation.CurrentFrameIndex + 1, CurrentAnimation.Frames.Count, CurrentAnimation.CurrentFrame.OffSetX, CurrentAnimation.CurrentFrame.OffSetY, (int)CurrentAnimation.CurrentFrame.OriginX, (int)CurrentAnimation.CurrentFrame.OriginY), ColorU.White); using (canvas <= Camera.Transformation) { CurrentAnimation.Draw(canvas); if (_drawFrameDebug && CurrentAnimation.Frames.Count > 0) { Frame curFrame = CurrentAnimation.CurrentFrame; canvas.DrawRect( Rect.FromBox(curFrame.OffSetX - curFrame.SpriteFrame.Width / 2f, curFrame.OffSetY - curFrame.SpriteFrame.Height / 2, curFrame.SpriteFrame.Width, curFrame.SpriteFrame.Height), ColorU.Red); canvas.DrawLine(-5, 0, 5, 0, _originMarkLineStyle, ColorU.GreenYellow); canvas.DrawLine(0, -5, 0, 5, _originMarkLineStyle, ColorU.GreenYellow); } } } guiManager.DrawControls(canvas); }
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); } }
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)); }