Skip to content

E2A82597

Marcel Härtel edited this page Sep 4, 2019 · 18 revisions

GFXService.BeginRenderTarget Method

Everything between BeginRenderTarget() and EndRenderTarget() will be drawn to the RenderTarget2D.

Namespace: MonoGame.Forms.Services
Assembly: MonoGame.Forms.DX (in MonoGame.Forms.DX.dll) Version: 2.4.0.0 (2.4.0.0)

Syntax

C#

public void BeginRenderTarget(
	string key,
	bool clearGraphics = true,
	Nullable<Color> clearColor = null
)

Parameters

 

key
Type: System.String
Please enter a previously set key of the RenderTarget2D you want to begin with.
clearGraphics (Optional)
Type: System.Boolean
false if you don't want to to call graphics.Clear() after setting the RenderTarget2D.
clearColor (Optional)
Type: System.Nullable(Color)
The Color to be used to clear the graphics after setting the RenderTarget2D.

Examples

protected override void Draw()
{
   base.Draw();

   Editor.BeginRenderTarget("MyRenderTarget");

   Editor.spriteBatch.Begin();

   //Your drawings

   Editor.spriteBatch.End();

   Editor.EndRenderTarget("MyRenderTarget", false);
}

See Also

Reference

GFXService Class
MonoGame.Forms.Services Namespace

Clone this wiki locally
You can’t perform that action at this time.