public override void Render() { m_renderer.BeginFrame(); m_renderer.Translate(-50, -50); m_renderer.Rotate(Time.Total * 180); m_renderer.Translate(Window.Width / 2.0f, Window.Height / 2.0f); m_renderer.FillRect(0, 0, 100, 100); m_renderer.Flush(); m_renderer.EndFrame(); }
public static void FillRectCroppedToScreenMask(this BasicSpriteRenderer r, float x, float y, float w, float h, Rect screenMask) { Rect rect = new Rect(x, y, w, h); if (rect.Left > screenMask.Right || rect.Right < screenMask.Left || rect.Top > screenMask.Bottom || rect.Bottom < screenMask.Top) { // Just don't draw anything. return; } r.FillRect(Math.Max(rect.Left, screenMask.Left), Math.Max(rect.Top, screenMask.Top), Math.Min(rect.Right, screenMask.Right) - rect.Left, Math.Min(rect.Bottom, screenMask.Bottom) - rect.Top); }