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); }
public override bool Init() { var config = new NetPeerConfiguration("hej"); config.AutoFlushSendQueue = false; client = new NetClient(config); client.Start(); client.DiscoverLocalPeers(port); //string ip = "localhost"; //int port = 14242; //client.Connect(ip, port); InitUI(); drawBatch = new DrawBatch(device); world = new World(600, 400); Players = new Dictionary <long, Player>(); map = MapLoader.Load("Content/map/map.csv", world); MapRenderer.spritesheet = CONTENT_MANAGER.SpriteSheets["terrain"]; return(base.Init()); }
public AppResources(GraphicsDevice graphicsDevice, ContentManager pipeLine, SpriteBatch sprite, DrawBatch drawb) { GraphicsDevice = graphicsDevice; Pipeline = pipeLine; SpriteBatch = sprite; DrawBatch = drawb; }
public override void Draw(DrawBatch drawBatch) { drawBatch.DrawArc(_thickPen, new Vector2(100, 125), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5)); drawBatch.DrawArc(_thickPen, new Vector2(100, 125), 50, 0, -(float)Math.PI); drawBatch.DrawArc(_thickPen, new Vector2(100, 175), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5)); drawBatch.DrawArc(_thickPen, new Vector2(100, 275), 50, -(float)(Math.PI * 0.25), (float)(Math.PI * 1.5)); drawBatch.DrawArc(_thickPen, new Vector2(100, 325), 50, 0, (float)Math.PI); drawBatch.DrawArc(_thickPen, new Vector2(100, 325), 75, (float)(Math.PI * 0.25), (float)(Math.PI * 0.5)); drawBatch.DrawArc(_thickPen, new Vector2(250, 125), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), 16); drawBatch.DrawArc(_thickPen, new Vector2(250, 125), 50, 0, -(float)Math.PI, 16); drawBatch.DrawArc(_thickPen, new Vector2(250, 175), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), 16); drawBatch.DrawArc(_thickPen, new Vector2(250, 275), 50, -(float)(Math.PI * 0.25), (float)(Math.PI * 1.5), 16); drawBatch.DrawArc(_thickPen, new Vector2(250, 325), 50, 0, (float)Math.PI, 16); drawBatch.DrawArc(_thickPen, new Vector2(250, 325), 75, (float)(Math.PI * 0.25), (float)(Math.PI * 0.5), 16); drawBatch.DrawArc(_thickPen, new Vector2(400, 125), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), 4); drawBatch.DrawArc(_thickPen, new Vector2(400, 125), 50, 0, -(float)Math.PI, 4); drawBatch.DrawArc(_thickPen, new Vector2(400, 175), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), 4); drawBatch.DrawArc(_thickPen, new Vector2(400, 275), 50, -(float)(Math.PI * 0.25), (float)(Math.PI * 1.5), 4); drawBatch.DrawArc(_thickPen, new Vector2(400, 325), 50, 0, (float)Math.PI, 4); drawBatch.DrawArc(_thickPen, new Vector2(400, 325), 75, (float)(Math.PI * 0.25), (float)(Math.PI * 0.5), 4); }
public override void Draw(DrawBatch drawBatch) { drawBatch.DrawBezier(_bluePen, new CCVector2(50, 100), new CCVector2(50, 50), new CCVector2(100, 50)); drawBatch.DrawBezier(_bluePen, new CCVector2(50, 250), new CCVector2(50, 150), new CCVector2(100, 150)); drawBatch.DrawBeziers(_bluePen, _wavePoints1, BezierType.Quadratic); drawBatch.DrawPrimitivePath(Pen.Gray, _wavePoints1); for (int i = 0; i < _wavePoints1.Length; i++) { drawBatch.DrawPoint(_pointPen, _wavePoints1[i]); } drawBatch.DrawBeziers(_bluePen, _wavePoints2, BezierType.Quadratic); drawBatch.DrawPrimitivePath(Pen.Gray, _wavePoints2); for (int i = 0; i < _wavePoints2.Length; i++) { drawBatch.DrawPoint(_pointPen, _wavePoints2[i]); } drawBatch.DrawBeziers(_bluePen, _loopPoints, BezierType.Quadratic, PathType.Closed); drawBatch.DrawPrimitivePath(Pen.Gray, _loopPoints, PathType.Closed); for (int i = 0; i < _loopPoints.Length; i++) { drawBatch.DrawPoint(_pointPen, _loopPoints[i]); } }
public override void Render(DrawBatch spriteBatch, float zoomFactor) { if (IsDisposed) { return; } InitializeResources(spriteBatch.GraphicsDevice); if (Fill != null) { for (int y = _data.TileMinExtant.Y; y <= _data.TileMaxExtant.Y; y++) { RenderRow(spriteBatch, zoomFactor, y); } } if (Outline != null) { for (int y = _data.TileMinExtant.Y; y <= _data.TileMaxExtant.Y + 1; y++) { RenderHorizontalLine(spriteBatch, zoomFactor, y); } for (int x = _data.TileMinExtant.X; x <= _data.TileMaxExtant.X + 1; x++) { RenderVerticalLine(spriteBatch, zoomFactor, x); } } }
public void Draw(SpriteBatch drw, DrawBatch drawBatch) { var rect = GetRect(); drawBatch.DrawRectangle(Selected ? Factory.HighlightPen : Factory.NormalPen, rect); drw.Draw(Texture, rect, Color.White); }
public void DrawGlow(DrawBatch drawBatch) { if (GlowEnabled) { drawBatch.DrawCircle(glowPen, Circle.Center, Circle.Radius); } }
public override void Draw(DrawBatch drawBatch) { drawBatch.DrawPath(_gpathf); drawBatch.DrawPath(_gpathr); drawBatch.DrawPath(_gpath2f); drawBatch.DrawPath(_gpath2r); }
public void Draw(DrawBatch batch, Homing homing, Color color) { var pos1 = Math.Max(0f, Animation.CurrentValue - 0.5f); var pos2 = Math.Min(1f, Animation.CurrentValue); // D // /\ // / \ // C /....\ A // \ / // \ / // \/ // B var A = homing.Position + homing.GetCorner(0); var B = homing.Position + homing.GetCorner(1); var C = homing.Position + homing.GetCorner(2); var D = homing.Position + homing.GetCorner(3); var diag = C - A; // animation is two points moving along this line var point1 = A + diag * pos1; var point2 = A + diag * pos2; var colorBlendAmount = Animation.Progress < 0.5f ? Animation.Progress : 1 - Animation.Progress; var colorBlend = MathHelper.Lerp(1f, 0.1f, colorBlendAmount); var glowColor = Color.Lerp(BaseColor, color, colorBlend); batch.FillTriangleList(new SolidColorBrush(glowColor), new Vector2[] { point1, B, point2, D }, tris); }
public void DrawEm(SpriteBatch spriteBatch, DrawBatch drawBatch) { foreach (Card card in Cards) { card.Draw(spriteBatch, drawBatch); } }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); drawBatch = new DrawBatch(GraphicsDevice); InitializePaths(); }
public void Draw(DrawBatch batch) { if (active.Count > 0) { circle.Draw(batch); } }
public TestLayer() : base(CCColor4B.Transparent) { ClearColor = clearColor; drawBatch = new DrawBatch(); AddChild(drawBatch, 10); }
internal void Render(DrawBatch drawBatch, CCTexture2D defaultTexture) { foreach (var unit in _units) { unit.Render(drawBatch, defaultTexture); } }
public void Render(RenderContext context, Vector2 position) { DrawBatch batch = context.MainBatch; IconShaderResources shaderResources = context.ShaderResources.Icon; ViewProjection vp = context.OrthoProjection; (QuadGeometry quad, _) = QuadGeometry.Create( new SizeF(_texture.Width, _texture.Height), Matrix4x4.CreateTranslation(new Vector3(position, 0)), Vector2.Zero, Vector2.One, color: Vector4.One ); var geometry = QuadGeometryUV3.FromQuad(quad, layer: _activeFrame); Mesh <QuadVertexUV3> mesh = context.QuadsUV3 .Append(MemoryMarshal.CreateReadOnlySpan(ref geometry.TopLeft, 4)); batch.PushDraw(new Draw { Pipeline = shaderResources.Pipeline, ResourceBindings = new ResourceBindings( new ResourceSetKey(vp.ResourceLayout, vp.Buffer.VdBuffer), new ResourceSetKey( shaderResources.ResourceLayout, _texture, context.GetSampler(FilterMode.Linear) ) ), BufferBindings = new BufferBindings(mesh.Vertices.Buffer, mesh.Indices.Buffer), Params = DrawParams.Indexed(0, 0, 6) }); }
protected virtual void RenderCore(DrawBatch drawBatch) { Vector2 offset = BeginDraw(drawBatch); RenderContent(drawBatch); EndDraw(drawBatch, offset); }
public override void Draw(DrawBatch drawBatch) { drawBatch.FillArc(Brush.Blue, new Vector2(100, 100), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Segment); drawBatch.FillArc(Brush.Blue, new Vector2(100, 125), 50, 0, -(float)Math.PI, ArcType.Segment); drawBatch.FillArc(Brush.Blue, new Vector2(100, 200), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Segment); drawBatch.FillArc(Brush.Blue, new Vector2(250, 100), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Segment, 16); drawBatch.FillArc(Brush.Blue, new Vector2(250, 125), 50, 0, -(float)Math.PI, ArcType.Segment, 16); drawBatch.FillArc(Brush.Blue, new Vector2(250, 200), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Segment, 16); drawBatch.FillArc(Brush.Blue, new Vector2(400, 100), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Segment, 4); drawBatch.FillArc(Brush.Blue, new Vector2(400, 125), 50, 0, -(float)Math.PI, ArcType.Segment, 4); drawBatch.FillArc(Brush.Blue, new Vector2(400, 200), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Segment, 4); drawBatch.FillArc(Brush.Blue, new Vector2(100, 335), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Sector); drawBatch.FillArc(Brush.Blue, new Vector2(100, 410), 50, 0, -(float)Math.PI, ArcType.Sector); drawBatch.FillArc(Brush.Blue, new Vector2(100, 480), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Sector); drawBatch.FillArc(Brush.Blue, new Vector2(250, 335), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Sector, 16); drawBatch.FillArc(Brush.Blue, new Vector2(250, 410), 50, 0, -(float)Math.PI, ArcType.Sector, 16); drawBatch.FillArc(Brush.Blue, new Vector2(250, 480), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Sector, 16); drawBatch.FillArc(Brush.Blue, new Vector2(400, 335), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), ArcType.Sector, 4); drawBatch.FillArc(Brush.Blue, new Vector2(400, 410), 50, 0, -(float)Math.PI, ArcType.Sector, 4); drawBatch.FillArc(Brush.Blue, new Vector2(400, 480), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), ArcType.Sector, 4); }
public override void Draw(DrawBatch drawBatch) { drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(100, 125), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5)); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(100, 125), 50, 0, -(float)Math.PI); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(100, 175), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5)); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(100, 275), 50, -(float)(Math.PI * 0.25), (float)(Math.PI * 1.5)); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(100, 325), 50, 0, (float)Math.PI); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(100, 325), 75, (float)(Math.PI * 0.25), (float)(Math.PI * 0.5)); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(250, 125), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), 16); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(250, 125), 50, 0, -(float)Math.PI, 16); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(250, 175), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), 16); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(250, 275), 50, -(float)(Math.PI * 0.25), (float)(Math.PI * 1.5), 16); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(250, 325), 50, 0, (float)Math.PI, 16); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(250, 325), 75, (float)(Math.PI * 0.25), (float)(Math.PI * 0.5), 16); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(400, 125), 75, -(float)(Math.PI * 0.25), -(float)(Math.PI * 0.5), 4); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(400, 125), 50, 0, -(float)Math.PI, 4); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(400, 175), 50, (float)(Math.PI * 0.25), -(float)(Math.PI * 1.5), 4); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(400, 275), 50, -(float)(Math.PI * 0.25), (float)(Math.PI * 1.5), 4); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(400, 325), 50, 0, (float)Math.PI, 4); drawBatch.DrawPrimitiveArc(Pen.Blue, new CCVector2(400, 325), 75, (float)(Math.PI * 0.25), (float)(Math.PI * 0.5), 4); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { base.LoadContent(); spriteBatch = new SpriteBatch(GraphicsDevice); drawBatch = new DrawBatch(GraphicsDevice); gameState = GameState.LoadingScreen; Database.EnsureExists(); logger.Info("Generating textures"); TextureGenerator.LoadStaticAssets(GraphicsDevice, Content); Fonts.Content.Init(Content); Fonts.Init(); fpsText = new SimpleText() { Font = Fonts.Content.DebugFont, Color = Color.Gray, XOrigin = XOrigin.Right }; menuScene = new MenuScene(); InitGui(); InitScreenshotTarget(); }
public override void Draw(DrawBatch drawBatch) { drawBatch.FillCircle(new SolidColorBrush(Microsoft.Xna.Framework.Color.SkyBlue), _origin, 175); drawBatch.FillArc(new SolidColorBrush(Microsoft.Xna.Framework.Color.LimeGreen), _origin, 150, _startAngle, _arcLength, ArcType.Sector); drawBatch.DrawClosedArc(new Pen(Microsoft.Xna.Framework.Color.Green, 15), _origin, 150, _startAngle, _arcLength, ArcType.Sector); drawBatch.DrawPath(_lilyOuterFlower); drawBatch.DrawPath(_lilyInnerFlower); }
public override void Draw(DrawBatch drawBatch) { drawBatch.FillRectangle(Brush.Green, new Rectangle(50, 50, 200, 100)); drawBatch.FillCircle(Brush.Blue, new Vector2(350, 100), 50); drawBatch.FillCircle(Brush.Blue, new Vector2(500, 100), 50, 16); drawBatch.FillPath(Brush.Gray, StarPoints(new Vector2(150, 300), 8, 100, 50, 0, false)); drawBatch.FillRectangle(Brush.Green, new Rectangle(300, 250, 200, 100), (float)Math.PI / 4f); }
private void RenderPartialVerticalLine(DrawBatch drawBatch, float zoomFactor, int x, int y1, int y2) { int left = (int)((x + _data.Offset.X) * _data.TileWidth * zoomFactor); int top = (int)((y1 + _data.Offset.Y) * _data.TileHeight * zoomFactor); int bottom = (int)((y2 + _data.Offset.Y + 1) * _data.TileHeight * zoomFactor); drawBatch.DrawLine(Outline, new Vector2(left, top), new Vector2(left, bottom)); }
protected override void Initialize() { _drawBatch = new DrawBatch(GraphicsDevice); ClearColor = Color.DarkGray; Application.Idle += IdleHandler; }
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); }
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(_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); }
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 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); }