public override void Draw(Batcher batcher, float parentAlpha) { //https://www.reddit.com/r/gamedev/comments/435dkp/how_to_add_pixel_shaders_to_monogame/ //https://mysteriousspace.com/2019/01/05/pixel-shaders-in-monogame-a-tutorial-of-sorts-for-2019/ batcher.End(); batcher.Begin(effect); base.Draw(batcher, parentAlpha); batcher.End(); batcher.Begin(); }
public override void Draw(GameTime gameTime) { Batcher.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, null); //background Batcher.Draw(WhiteTexture, Window, BackgroundColor); //cursor int textY = Window.Y + Window.Height - font.LineSpacing; if (Activated) { Batcher.Draw(WhiteTexture, new Rectangle(Window.X + (int)font.MeasureString(line.ToString().Substring(0, CursorPosition)).X, textY, 2, font.LineSpacing), Color.White); } //command line Batcher.DrawString(font, line, new Vector2(Window.X, textY), Color.White); //output foreach (var outputLine in output.Lines.Reverse()) { textY -= font.LineSpacing; if (textY < Window.Y) { break; } Batcher.DrawString(font, outputLine, new Vector2(Window.X, textY), Color.White); } Batcher.End(); base.Draw(gameTime); }
protected virtual void SceneFinalRender(Batcher batch, RenderTarget2D frame, RectangleF finalDestination) { Core.GraphicsDevice.SetRenderTarget(null); Core.GraphicsDevice.Clear(BackColor); batch.Begin(BlendState.Opaque, SamplerState.PointClamp, null, null); batch.Draw(frame, finalDestination); batch.End(); }
/// <summary> /// Draw the scene. /// Execute <see cref="Node.Visit(SpriteBatch, Matrix2D)"/> /// on each node, start from root node - <see cref="World"/>. /// </summary> public void Draw() { /// Fill background with black color. App.GraphicsDevice.Clear(Color.Black); Batcher.Begin(); var transform = Camera.Transform; World.Visit(Batcher, transform); Batcher.End(); }
/// <summary> /// Restores the batch transform to what it was before {@link #applyTransform(Batch, Matrix4)}. Note this causes the batch to /// be flushed /// </summary> /// <param name="batch">Batch.</param> protected void ResetTransform(Batcher batcher) { batcher.End(); batcher.Begin(_previousBatcherTransform); }
/// <summary> /// Set the batch's transformation matrix, often with the result of {@link #computeTransform()}. Note this causes the batch to /// be flushed. {@link #resetTransform(Batch)} will restore the transform to what it was before this call. /// </summary> /// <param name="batcher">Batcher.</param> /// <param name="transform">Transform.</param> protected void ApplyTransform(Batcher batcher, Matrix transform) { _previousBatcherTransform = batcher.TransformMatrix; batcher.End(); batcher.Begin(transform); }