Beispiel #1
0
 protected override void RenderCore(DrawBatch drawBatch)
 {
     if (Model.ShouldRenderCoreD)
         Model.RenderCore(this, drawBatch);
     else
         base.RenderCore(drawBatch);
 }
Beispiel #2
0
        protected override void LoadContent ()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            drawBatch = new DrawBatch(GraphicsDevice);

            InitializePaths();
        }
 public IntroLayer()
     : base(CCColor4B.Blue)
 {
     drawBatch = new DrawBatch();
     AddChild(drawBatch, 10);
     
 }
        public override void Draw(DrawBatch drawBatch)
        {
            float space = 30;
            float macroSpace = 50;
            float length = 200;

            CCVector2 o1 = new CCVector2(macroSpace, macroSpace);
            CCVector2 o2 = new CCVector2(macroSpace * 2 + length, macroSpace);
            CCVector2 o3 = new CCVector2(macroSpace * 2 + length, macroSpace * 2 + length);
            CCVector2 o4 = new CCVector2(macroSpace, macroSpace * 2 + length);

            drawBatch.DrawPath(new GraphicsPath(_flatPen, new List<CCVector2> { o1 + new CCVector2(0, space * 0), o1 + new CCVector2(length, space * 0) }));
            drawBatch.DrawPath(new GraphicsPath(_squarePen, new List<CCVector2> { o1 + new CCVector2(0, space * 1), o1 + new CCVector2(length, space * 1) }));
            drawBatch.DrawPath(new GraphicsPath(_trianglePen, new List<CCVector2> { o1 + new CCVector2(0, space * 2), o1 + new CCVector2(length, space * 2) }));
            drawBatch.DrawPath(new GraphicsPath(_invTrianglePen, new List<CCVector2> { o1 + new CCVector2(0, space * 3), o1 + new CCVector2(length, space * 3) }));
            drawBatch.DrawPath(new GraphicsPath(_arrowPen, new List<CCVector2> { o1 + new CCVector2(0, space * 4), o1 + new CCVector2(length, space * 4) }));

            drawBatch.DrawPath(new GraphicsPath(_flatPen, new List<CCVector2> { o2 + new CCVector2(space * 0, 0), o2 + new CCVector2(space * 0, length) }));
            drawBatch.DrawPath(new GraphicsPath(_squarePen, new List<CCVector2> { o2 + new CCVector2(space * 1, 0), o2 + new CCVector2(space * 1, length) }));
            drawBatch.DrawPath(new GraphicsPath(_trianglePen, new List<CCVector2> { o2 + new CCVector2(space * 2, 0), o2 + new CCVector2(space * 2, length) }));
            drawBatch.DrawPath(new GraphicsPath(_invTrianglePen, new List<CCVector2> { o2 + new CCVector2(space * 3, 0), o2 + new CCVector2(space * 3, length) }));
            drawBatch.DrawPath(new GraphicsPath(_arrowPen, new List<CCVector2> { o2 + new CCVector2(space * 4, 0), o2 + new CCVector2(space * 4, length) }));

            drawBatch.DrawPath(new GraphicsPath(_flatPen, new List<CCVector2> { o3 + new CCVector2(length, space * 0), o3 + new CCVector2(0, space * 0) }));
            drawBatch.DrawPath(new GraphicsPath(_squarePen, new List<CCVector2> { o3 + new CCVector2(length, space * 1), o3 + new CCVector2(0, space * 1) }));
            drawBatch.DrawPath(new GraphicsPath(_trianglePen, new List<CCVector2> { o3 + new CCVector2(length, space * 2), o3 + new CCVector2(0, space * 2) }));
            drawBatch.DrawPath(new GraphicsPath(_invTrianglePen, new List<CCVector2> { o3 + new CCVector2(length, space * 3), o3 + new CCVector2(0, space * 3) }));
            drawBatch.DrawPath(new GraphicsPath(_arrowPen, new List<CCVector2> { o3 + new CCVector2(length, space * 4), o3 + new CCVector2(0, space * 4) }));

            drawBatch.DrawPath(new GraphicsPath(_flatPen, new List<CCVector2> { o4 + new CCVector2(space * 0, length), o4 + new CCVector2(space * 0, 0) }));
            drawBatch.DrawPath(new GraphicsPath(_squarePen, new List<CCVector2> { o4 + new CCVector2(space * 1, length), o4 + new CCVector2(space * 1, 0) }));
            drawBatch.DrawPath(new GraphicsPath(_trianglePen, new List<CCVector2> { o4 + new CCVector2(space * 2, length), o4 + new CCVector2(space * 2, 0) }));
            drawBatch.DrawPath(new GraphicsPath(_invTrianglePen, new List<CCVector2> { o4 + new CCVector2(space * 3, length), o4 + new CCVector2(space * 3, 0) }));
            drawBatch.DrawPath(new GraphicsPath(_arrowPen, new List<CCVector2> { o4 + new CCVector2(space * 4, length), o4 + new CCVector2(space * 4, 0) }));
        }
        public override void Render(DrawBatch drawBatch, float zoomFactor)
        {
            if (IsDisposed)
                return;

            InitializeResources(drawBatch.GraphicsDevice);

            Vector2 center = new Vector2((int)(_data.Center.X * zoomFactor), (int)(_data.Center.Y * zoomFactor));
            float size = _data.Size;

            Rectangle rect = new Rectangle((int)(center.X - size), (int)(center.Y - size), (int)(size * 2), (int)(size * 2));

            if (FillGlow != null)
                drawBatch.FillRectangle(FillGlow, new Rectangle(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2));
            if (Fill != null)
                drawBatch.FillRectangle(Fill, rect);
            if (OutlineGlow != null)
                drawBatch.DrawRectangle(OutlineGlow, rect);
            if (Outline != null) {
                if (Outline is PrimitivePen)
                    drawBatch.DrawPrimitiveRectangle(Outline, rect);
                else
                    drawBatch.DrawRectangle(Outline, rect);
            }
        }
        public override void Draw(DrawBatch drawBatch)
        {
            drawBatch.FillArc(Brush.Blue, new CCVector2(100, 100), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Segment);
            drawBatch.FillArc(Brush.Blue, new CCVector2(100, 125), 50, 0, -(float)Math.PI, ArcType.Segment);
            drawBatch.FillArc(Brush.Blue, new CCVector2(100, 200), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Segment);

            drawBatch.FillArc(Brush.Blue, new CCVector2(250, 100), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Segment, 16);
            drawBatch.FillArc(Brush.Blue, new CCVector2(250, 125), 50, 0, -(float)Math.PI, ArcType.Segment, 16);
            drawBatch.FillArc(Brush.Blue, new CCVector2(250, 200), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Segment, 16);

            drawBatch.FillArc(Brush.Blue, new CCVector2(400, 100), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Segment, 4);
            drawBatch.FillArc(Brush.Blue, new CCVector2(400, 125), 50, 0, -(float)Math.PI, ArcType.Segment, 4);
            drawBatch.FillArc(Brush.Blue, new CCVector2(400, 200), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Segment, 4);

            drawBatch.FillArc(Brush.Blue, new CCVector2(100, 335), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Sector);
            drawBatch.FillArc(Brush.Blue, new CCVector2(100, 410), 50, 0, -(float)Math.PI, ArcType.Sector);
            drawBatch.FillArc(Brush.Blue, new CCVector2(100, 480), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Sector);

            drawBatch.FillArc(Brush.Blue, new CCVector2(250, 335), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Sector, 16);
            drawBatch.FillArc(Brush.Blue, new CCVector2(250, 410), 50, 0, -(float)Math.PI, ArcType.Sector, 16);
            drawBatch.FillArc(Brush.Blue, new CCVector2(250, 480), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Sector, 16);

            drawBatch.FillArc(Brush.Blue, new CCVector2(400, 335), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Sector, 4);
            drawBatch.FillArc(Brush.Blue, new CCVector2(400, 410), 50, 0, -(float)Math.PI, ArcType.Sector, 4);
            drawBatch.FillArc(Brush.Blue, new CCVector2(400, 480), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Sector, 4);
        }
        public override void Render(DrawBatch drawBatch, float zoomFactor)
        {
            if (IsDisposed)
                return;

            InitializeResources(drawBatch.GraphicsDevice);

            Rectangle rect = new Rectangle(
                (int)(Math.Min(_data.Start.X, _data.End.X) * zoomFactor),
                (int)(Math.Min(_data.Start.Y, _data.End.Y) * zoomFactor),
                (int)(Math.Abs(_data.End.X - _data.Start.X) * zoomFactor),
                (int)(Math.Abs(_data.End.Y - _data.Start.Y) * zoomFactor)
                );

            if (FillGlow != null)
                drawBatch.FillRectangle(FillGlow, new Rectangle(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2));
            if (Fill != null)
                drawBatch.FillRectangle(Fill, rect);
            if (OutlineGlow != null)
                drawBatch.DrawRectangle(OutlineGlow, rect);
            if (Outline != null) {
                if (Outline is PrimitivePen)
                    drawBatch.DrawPrimitiveRectangle(Outline, rect);
                else
                    drawBatch.DrawRectangle(Outline, rect);
            }
        }
Beispiel #8
0
        public override void Draw (DrawBatch drawBatch)
        {
            drawBatch.DrawClosedArc(_thickPen, new Vector2(100, 100), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Segment);
            drawBatch.DrawClosedArc(_thickPen, new Vector2(100, 125), 50, 0, -(float)Math.PI, ArcType.Segment);
            drawBatch.DrawClosedArc(_thickPen, new Vector2(100, 200), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Segment);

            drawBatch.DrawClosedArc(_thickPen, new Vector2(250, 100), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Segment, 16);
            drawBatch.DrawClosedArc(_thickPen, new Vector2(250, 125), 50, 0, -(float)Math.PI, ArcType.Segment, 16);
            drawBatch.DrawClosedArc(_thickPen, new Vector2(250, 200), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Segment, 16);

            drawBatch.DrawClosedArc(_thickPen, new Vector2(400, 100), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Segment, 4);
            drawBatch.DrawClosedArc(_thickPen, new Vector2(400, 125), 50, 0, -(float)Math.PI, ArcType.Segment, 4);
            drawBatch.DrawClosedArc(_thickPen, new Vector2(400, 200), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Segment, 4);

            drawBatch.DrawClosedArc(_thickPen, new Vector2(100, 335), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Sector);
            drawBatch.DrawClosedArc(_thickPen, new Vector2(100, 410), 50, 0, -(float)Math.PI, ArcType.Sector);
            drawBatch.DrawClosedArc(_thickPen, new Vector2(100, 480), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Sector);

            drawBatch.DrawClosedArc(_thickPen, new Vector2(250, 335), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Sector, 16);
            drawBatch.DrawClosedArc(_thickPen, new Vector2(250, 410), 50, 0, -(float)Math.PI, ArcType.Sector, 16);
            drawBatch.DrawClosedArc(_thickPen, new Vector2(250, 480), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Sector, 16);

            drawBatch.DrawClosedArc(_thickPen, new Vector2(400, 335), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Sector, 4);
            drawBatch.DrawClosedArc(_thickPen, new Vector2(400, 410), 50, 0, -(float)Math.PI, ArcType.Sector, 4);
            drawBatch.DrawClosedArc(_thickPen, new Vector2(400, 480), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Sector, 4);
        }
Beispiel #9
0
        public override void Draw(DrawBatch drawBatch)
        {
            drawBatch.DrawArc(_thickPen, new CCVector2(100, 125), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5));
            drawBatch.DrawArc(_thickPen, new CCVector2(100, 125), 50, 0, -(float)Math.PI);
            drawBatch.DrawArc(_thickPen, new CCVector2(100, 175), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5));

            drawBatch.DrawArc(_thickPen, new CCVector2(100, 275), 50, -(float)(Math.PI * 0.25), (float)(Math.PI * 1.5));
            drawBatch.DrawArc(_thickPen, new CCVector2(100, 325), 50, 0, (float)Math.PI);
            drawBatch.DrawArc(_thickPen, new CCVector2(100, 325), 75, (float)(Math.PI * 0.25), (float)(Math.PI * 0.5));

            drawBatch.DrawArc(_thickPen, new CCVector2(250, 125), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), 16);
            drawBatch.DrawArc(_thickPen, new CCVector2(250, 125), 50, 0, -(float)Math.PI, 16);
            drawBatch.DrawArc(_thickPen, new CCVector2(250, 175), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), 16);

            drawBatch.DrawArc(_thickPen, new CCVector2(250, 275), 50, -(float)(Math.PI * 0.25), (float)(Math.PI * 1.5), 16);
            drawBatch.DrawArc(_thickPen, new CCVector2(250, 325), 50, 0, (float)Math.PI, 16);
            drawBatch.DrawArc(_thickPen, new CCVector2(250, 325), 75, (float)(Math.PI * 0.25), (float)(Math.PI * 0.5), 16);

            drawBatch.DrawArc(_thickPen, new CCVector2(400, 125), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), 4);
            drawBatch.DrawArc(_thickPen, new CCVector2(400, 125), 50, 0, -(float)Math.PI, 4);
            drawBatch.DrawArc(_thickPen, new CCVector2(400, 175), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), 4);

            drawBatch.DrawArc(_thickPen, new CCVector2(400, 275), 50, -(float)(Math.PI * 0.25), (float)(Math.PI * 1.5), 4);
            drawBatch.DrawArc(_thickPen, new CCVector2(400, 325), 50, 0, (float)Math.PI, 4);
            drawBatch.DrawArc(_thickPen, new CCVector2(400, 325), 75, (float)(Math.PI * 0.25), (float)(Math.PI * 0.5), 4);
        }
 public override void Draw(DrawBatch drawBatch)
 {
     drawBatch.DrawPath(_gpathf);
     drawBatch.DrawPath(_gpathr);
     drawBatch.DrawPath(_gpath2f);
     drawBatch.DrawPath(_gpath2r);
 }
Beispiel #11
0
        public override void Draw (DrawBatch drawBatch)
        {
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(100, 125), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5));
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(100, 125), 50, 0, -(float)Math.PI);
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(100, 175), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5));

            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(100, 275), 50, -(float)(Math.PI * 0.25), (float)(Math.PI * 1.5));
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(100, 325), 50, 0, (float)Math.PI);
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(100, 325), 75, (float)(Math.PI * 0.25), (float)(Math.PI * 0.5));

            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(250, 125), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), 16);
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(250, 125), 50, 0, -(float)Math.PI, 16);
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(250, 175), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), 16);

            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(250, 275), 50, -(float)(Math.PI * 0.25), (float)(Math.PI * 1.5), 16);
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(250, 325), 50, 0, (float)Math.PI, 16);
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(250, 325), 75, (float)(Math.PI * 0.25), (float)(Math.PI * 0.5), 16);

            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(400, 125), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), 4);
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(400, 125), 50, 0, -(float)Math.PI, 4);
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(400, 175), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), 4);

            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(400, 275), 50, -(float)(Math.PI * 0.25), (float)(Math.PI * 1.5), 4);
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(400, 325), 50, 0, (float)Math.PI, 4);
            drawBatch.DrawPrimitiveArc(Pen.Blue, new Vector2(400, 325), 75, (float)(Math.PI * 0.25), (float)(Math.PI * 0.5), 4);
        }
        private void RenderPartialHorizontalLine(DrawBatch drawBatch, float zoomFactor, int x1, int x2, int y)
        {
            int top = (int)((y + _data.Offset.Y) * _data.TileHeight * zoomFactor);
            int left = (int)((x1 + _data.Offset.X) * _data.TileWidth * zoomFactor);
            int right = (int)((x2 + _data.Offset.X + 1) * _data.TileWidth * zoomFactor);

            drawBatch.DrawLine(Outline, new Vector2(left, top), new Vector2(right, top));
        }
 public override void Draw(DrawBatch drawBatch)
 {
     drawBatch.FillRectangle(Brush.Green, new CCRect(50, 50, 200, 100));
     drawBatch.FillCircle(Brush.Blue, new CCVector2(350, 100), 50);
     drawBatch.FillCircle(Brush.Blue, new CCVector2(500, 100), 50, 16);
     drawBatch.FillPath(Brush.Gray, StarPoints(new CCVector2(150, 300), 8, 100, 50, 0, false));
     drawBatch.FillRectangle(Brush.Green, new CCRect(300, 250, 200, 100), (float)Math.PI / 4f);
 }
 public TestLayer()
     : base(CCColor4B.Transparent)
 {
     ClearColor = clearColor;
     drawBatch = new DrawBatch();
     AddChild(drawBatch, 10);
     
 }
Beispiel #15
0
 public override void Draw (DrawBatch drawBatch)
 {
     drawBatch.FillCircle(new SolidColorBrush(Color.SkyBlue), _origin, 175);
     drawBatch.FillArc(new SolidColorBrush(Color.LimeGreen), _origin, 150, _startAngle, _arcLength, ArcType.Sector);
     drawBatch.DrawClosedArc(new Pen(Color.Green, 15), _origin, 150, _startAngle, _arcLength, ArcType.Sector);
     drawBatch.DrawPath(_lilyOuterFlower);
     drawBatch.DrawPath(_lilyInnerFlower);
 }
Beispiel #16
0
        protected override void Initialize()
        {
            _drawBatch = new DrawBatch(GraphicsDevice);

            ClearColor = Color.DarkGray;

            Application.Idle += IdleHandler;
        }
 public void Render (DrawBatch drawBatch, CCTexture2D defaultTexture)
 {
     //device.Textures[0] = _texture ?? defaultTexture;
     //device.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, _vertexBuffer, 0, _vertexBuffer.Length, _indexBuffer, 0, _indexBuffer.Length / 3);
     drawBatch.RenderBatch(PrimitiveType.TriangleList,
         0, _indexBuffer.Length, _indexBuffer,
         0, _vertexBuffer.Length, _vertexBuffer,
         _texture ?? defaultTexture);
 }
 public override void Draw(DrawBatch drawBatch)
 {
     drawBatch.DrawPath(_insetPath);
     drawBatch.DrawPrimitivePath(new Pen(Microsoft.Xna.Framework.Color.OrangeRed), _starPoints1, PathType.Closed);
     drawBatch.DrawPath(_centerPath);
     drawBatch.DrawPrimitivePath(new Pen(Microsoft.Xna.Framework.Color.OrangeRed), _starPoints2, PathType.Closed);
     drawBatch.DrawPath(_outsetPath);
     drawBatch.DrawPrimitivePath(new Pen(Microsoft.Xna.Framework.Color.OrangeRed), _starPoints3, PathType.Closed);
 }
        public override void Draw(DrawBatch drawBatch)
        {
            var center = VisibleBoundsWorldspace.Center - new CCPoint(150,150);
            
            //drawBatch.FillRectangle(Brush.Gray, new CCVector2(200, 15), 300, 300);
            drawBatch.FillRectangle(Brush.Gray, center, 300, 300);
            drawBatch.DrawCache(_cache);

        }
        protected override void RenderContent(DrawBatch drawBatch)
        {
            float zoom = 1f;
            if (LevelGeometry != null)
                zoom = LevelGeometry.ZoomFactor;

            foreach (AnnotationRenderer renderer in _annotCache.Values)
                renderer.Render(drawBatch, zoom);
        }
 public override void Draw(DrawBatch drawBatch)
 {
     drawBatch.DrawLine(_thickBlue, new CCVector2(50, 50), new CCVector2(250, 50));
     drawBatch.DrawPath(_wavyPath);
     drawBatch.DrawRectangle(_thickMagenta, new CCRect(50, 160, 200, 100));
     drawBatch.DrawCircle(_thickBlack, new CCVector2(350, 100), 50);
     drawBatch.DrawCircle(_thickDarkGray, new CCVector2(350, 225), 50, 16);
     drawBatch.DrawRectangle(_thickGreen, new CCRect(50, 350, 200, 100), (float)Math.PI / 4f);
 }
 public override void Draw(DrawBatch drawBatch)
 {
     drawBatch.DrawPrimitiveLine(Pen.Blue, new CCVector2(50, 50), new CCVector2(250, 50));
     drawBatch.DrawPrimitivePath(Pen.Red, _wavy);
     drawBatch.DrawPrimitiveRectangle(Pen.Magenta, new CCRect(50, 160, 200, 100));
     drawBatch.DrawPrimitiveCircle(Pen.Black, new CCVector2(350, 100), 50);
     drawBatch.DrawPrimitiveCircle(Pen.DarkGray, new CCVector2(350, 225), 50, 16);
     drawBatch.DrawPrimitiveRectangle(Pen.Green, new CCRect(50, 350, 200, 100), (float)Math.PI / 4f);
 }
 public override void Draw (DrawBatch drawBatch)
 {
     for (int i = 0; i < _gPaths.Length; i++) {
         GraphicsPath path = _gPaths[i];
         drawBatch.DrawPath(path);
         for (int j = 0; j < _baseCoords.Length - 1; j++)
             drawBatch.DrawLine(PrimitivePen.Black, _baseCoords[j] + Offset(i), _baseCoords[j + 1] + Offset(i));
     }
 }
Beispiel #24
0
 public override void Draw (DrawBatch drawBatch)
 {
     drawBatch.FillRectangle(_brush1, new Rectangle(50, 50, 200, 100));
     drawBatch.FillRectangle(_brush2, new Rectangle(50, 175, 200, 100));
     drawBatch.FillRectangle(_brush3, new Rectangle(50, 300, 200, 100));
     drawBatch.FillRectangle(_brush4, new Rectangle(50, 425, 200, 100));
     drawBatch.FillCircle(_brush5, new Vector2(350, 100), 50);
     drawBatch.FillCircle(_brush6, new Vector2(350, 225), 50);
 }
Beispiel #25
0
        public override void Draw (DrawBatch drawBatch)
        {
            drawBatch.DrawLine(_gradWidth, new Vector2(25, 25), new Vector2(125, 125));
            drawBatch.DrawCircle(_gradWidth, new Vector2(200, 75), 50);
            drawBatch.DrawPath(_widthStar);

            drawBatch.DrawLine(_gradLength, new Vector2(25, 150), new Vector2(125, 250));
            drawBatch.DrawCircle(_gradLength, new Vector2(200, 200), 50);
            drawBatch.DrawPath(_lengthStar);
        }
Beispiel #26
0
        protected override void Initialize ()
        {
            ClearColor = Color.GhostWhite;

            _drawBatch = new DrawBatch(GraphicsDevice);

            Application.Idle += delegate { Invalidate(); };

            _stopWatch = Stopwatch.StartNew();
            _timer = Stopwatch.StartNew();
        }
        private void RenderPartialRow(DrawBatch drawBatch, float zoomFactor, int x1, int x2, int y)
        {
            Rectangle rect = new Rectangle(
                (int)((x1 + _data.Offset.X) * _data.TileWidth * zoomFactor),
                (int)((y + _data.Offset.Y) * _data.TileHeight * zoomFactor),
                (int)((x2 - x1 + 1) * _data.TileWidth * zoomFactor),
                (int)(_data.TileHeight * zoomFactor)
                );

            drawBatch.FillRectangle(Fill, rect);
        }
        private void RenderHorizontalLine(DrawBatch spriteBatch, float zoomFactor, int y)
        {
            int xStart = Int32.MinValue;
            for (int x = _data.TileMinExtant.X; x <= _data.TileMaxExtant.X; x++) {
                if (xStart == Int32.MinValue && SingleSet(new TileCoord(x, y), new TileCoord(x, y - 1)))
                    xStart = x;

                if (xStart != Int32.MinValue && !SingleSet(new TileCoord(x + 1, y), new TileCoord(x + 1, y - 1))) {
                    RenderPartialHorizontalLine(spriteBatch, zoomFactor, xStart, x, y);
                    xStart = Int32.MinValue;
                }
            }
        }
Beispiel #29
0
        public virtual void Apply (GameTime gameTime, DrawBatch drawBatch)
        {
            if (_needsSetup) {
                ClearColor = Color.WhiteSmoke;
                Setup(drawBatch.GraphicsDevice);
                _needsSetup = false;
            }

            Update(gameTime);

            Begin(drawBatch);
            Draw(drawBatch);
            End(drawBatch);
        }
        public override void Draw(DrawBatch drawBatch)
        {
            drawBatch.DrawBezier(_bluePen, new CCVector2(50, 100), new CCVector2(50, 50), new CCVector2(150, 50), new CCVector2(150, 100));
            drawBatch.DrawBezier(_bluePen, new CCVector2(50, 250), new CCVector2(50, 150), new CCVector2(150, 150), new CCVector2(150, 250));

            drawBatch.DrawBeziers(_bluePen, _wavePoints, BezierType.Cubic);
            drawBatch.DrawPrimitivePath(Pen.Gray, _wavePoints);

            for (int i = 0; i < _wavePoints.Length; i++)
                drawBatch.DrawPoint(_pointPen, _wavePoints[i]);

            drawBatch.DrawBeziers(_bluePen, _loopPoints, BezierType.Cubic, PathType.Closed);
            drawBatch.DrawPrimitivePath(Pen.Gray, _loopPoints, PathType.Closed);

            for (int i = 0; i < _loopPoints.Length; i++)
                drawBatch.DrawPoint(_pointPen, _loopPoints[i]);
        }