public void Draw(string FocusedElementKey, UIRenderer UIRendererInstance) { if (IsScrollable) { int innerHeight = 0; foreach (UIDrawCall child in ChildDrawCalls) { innerHeight += child.Height + child.Element.GetHeight().FullMargin; } int scroll = MathHelper.Clamp(Element.GetScroll(), 0, innerHeight - Height); if (scroll != Element.GetScroll()) { Element.SetScroll(scroll); } UIRendererInstance.EnableScrollingTarget(this); } Element.Draw(Width, Height, X, Y, Element.GetKey() == FocusedElementKey); foreach (UIDrawCall child in ChildDrawCalls) { child.Draw(FocusedElementKey, UIRendererInstance); } if (IsScrollable) { UIRendererInstance.FlipScrollingTarget(this); } }
private void Window(int id) { try { screenSelection.Draw(); switch (screenSelection.Selected) { case 0: logWindow.Draw(); break; case 1: modWindow.Draw(); break; case 2: debugWindow.Draw(); break; } } catch (Exception e) { logger.Log($"While drawing window UI threw {e.GetType().FullName}: {e.Message}{Environment.NewLine}{e.StackTrace}"); } }