ConsoleOnRender Method |
Namespace: DigitalRune.Game.UI.Controls
The base implementation calls Render(UIControl, UIRenderContext) to let the renderer perform the drawing. This method can be overridden in derived classes to perform custom drawing using any means.
Important: If this method changes the render states or uses a sprite batch other than the SpriteBatch of the IUIRenderer, EndBatch must be called to flush the current sprite batch before custom drawing code is executed.
public class CustomControl : UIControl { ... protected override void OnRender(RenderContext context) { // Get the renderer of the screen that owns this control. var renderer = Screen.Renderer; // The renderer batches all SpriteBatch drawing calls together. Since we want to // change the graphics device settings, we have to commit the current batch. renderer.EndBatch(); // Do custom rendering here. ... } }