/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); //spriteBatch.Draw(background, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White); spriteBatch.End(); drawBatch.Begin(DrawSortMode.Deferred); var selectedOffset = DRAW_OFFSET - (Selected.SystemPosition / SCALE); drawBatch.DrawBody(Color.SkyBlue, System, selectedOffset, SCALE); foreach (var s in System.GetAllOrbits()) { drawBatch.DrawConic(Color.LightGray, s.Conic, selectedOffset, SCALE); drawBatch.DrawBody(Color.Red, s, selectedOffset, SCALE); } drawBatch.DrawCursor(); drawBatch.End(); base.Draw(gameTime); }
void Update() { isDrawPhase = false; if (FlashResources.isPlatformReloadingEnabled) { FlashResources.reloadPendingResources(); } if (_shaderDirty) { sceneBatch.shader = shader; debugBatch.shader = shader; _shaderDirty = false; } if (_resourceDirty) { UpdateContent(); _resourceDirty = false; } isDrawPhase = true; debugBatch.Begin(GetGlobalMatrix()); root.Draw(); drawEvent.Dispatch(); debugBatch.renderQueue = sceneBatch.renderQueue + 1; debugBatch.End(); isDrawPhase = false; }
private Vector2 BeginDrawInner(DrawBatch drawBatch, SamplerState samplerState) { SetupRasterizerState(drawBatch.GraphicsDevice); Vector2 offset = GetOffset(); Matrix transform = Matrix.CreateTranslation(offset.X, offset.Y, 0); drawBatch.Begin(DrawSortMode.Deferred, BlendState.NonPremultiplied, samplerState, null, _rasterState, null, transform); return(offset); }
public static void BeginWithMySettings(this DrawBatch drawBatch, Matrix?transformMatrix, Effect effect, bool opaqueBlend = false) { drawBatch.Begin( DrawSortMode.Deferred, opaqueBlend ? BlendState.Opaque : BlendState.AlphaBlend, SamplerState.AnisotropicClamp, null, new RasterizerState { MultiSampleAntiAlias = false, CullMode = CullMode.None }, effect, transformMatrix ?? Matrix.Identity ); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.DarkSeaGreen); spriteBatch.Begin(); drawBatch.Begin(); //board.DrawEm(spriteBatch, drawBatch); //player.Draw(spriteBatch); stage.Draw(gameTime); drawBatch.End(); spriteBatch.End(); base.Draw(gameTime); }
public override void Draw(SpriteBatch spriteBatch, GameTime gameTime) { CONTENT_MANAGER.BeginSpriteBatch(spriteBatch); canvas.Draw(spriteBatch, gameTime); MapRenderer.Draw(spriteBatch, map); foreach (var player in Players.Values) { player.Draw(gameTime, spriteBatch); } CONTENT_MANAGER.EndSpriteBatch(spriteBatch); drawBatch.Begin(); world.DrawDebug(0, 0, 800, 600, DrawCell, DrawBox, DrawString); drawBatch.End(); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.White); Vector2 center = new Vector2(200, 200); drawBatch.Begin(DrawSortMode.Deferred, null, null, null, null, null, Matrix.Identity); drawBatch.FillCircle(new SolidColorBrush(Color.SkyBlue), center, 175); drawBatch.FillPath(new SolidColorBrush(Color.LimeGreen), _lilypadPath.Buffer, 0, _lilypadPath.Count); drawBatch.DrawPath(_lilypadStroke); drawBatch.DrawPath(_outerFlowerStroke); drawBatch.DrawPath(_innerFlowerStroke); drawBatch.End(); base.Draw(gameTime); }
private void DrawObjectAction(DrawBatch drawBatch) { if (_sourceImage == null) { return; } drawBatch.GraphicsDevice.ScissorRectangle = Xna.Rectangle.Empty; if (_objectBrush == null) { _objectBrush = new TextureBrush(_sourceImage.CreateTexture(_drawControl.GraphicsDevice)) { OwnsTexture = true } } ; if (_maskPen == null) { _maskPen = new Pen(new CheckerBrush(_drawControl.GraphicsDevice, Xna.Color.Black, Xna.Color.White, 4, .75f), true); } int originX = (_drawControl.Width - _sourceImage.Width) / 2; int originY = (_drawControl.Height - _sourceImage.Height) / 2; _objectBrush.Transform = Xna.Matrix.CreateTranslation(-(float)originX / _sourceImage.Width, -(float)originY / _sourceImage.Height, 0); drawBatch.Begin(); drawBatch.FillRectangle(_objectBrush, new Xna.Rectangle(originX, originY, _sourceImage.Width, _sourceImage.Height)); drawBatch.DrawRectangle(_maskPen, new Microsoft.Xna.Framework.Rectangle( originX - 1 + (_maskLeft ?? 0) + (_originX ?? 0), originY - 1 + (_maskTop ?? 0) + (_originY ?? 0), 1 + (_maskRight - _maskLeft) ?? 0, 1 + (_maskBottom - _maskTop) ?? 0)); drawBatch.FillCircle(Brush.White, new Xna.Vector2(originX + _originX ?? 0, originY + _originY ?? 0), 4, 12); drawBatch.FillCircle(Brush.Black, new Xna.Vector2(originX + _originX ?? 0, originY + _originY ?? 0), 3, 12); drawBatch.End(); }
/// <summary> /// Render the drawing onto the target. /// </summary> public void Render() { //Set data. Target.SetData(ColorCache); //Start draw batch. DrawBatch.Begin(DrawSortMode.Deferred); Vector2 origin = new Vector2(200, 200); float startAngle = (float)(Math.PI / 16) * 25; // 11:20 float arcLength = (float)(Math.PI / 16) * 30; 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); //Draw active tool. ActiveTool.Draw(); //End draw batch. DrawBatch.End(); }
public virtual void Begin(DrawBatch drawBatch) { drawBatch.Begin(DrawSortMode.Deferred, null, null, null, GetCommonRasterizerState(), null, Matrix.Identity); }