public void RenderWidget(double delta) { DeltaTime = delta; if (baseWidget == null) { textFocusWidget = null; return; } if (game != null && game.Mouse.Wheel != 0) { OnMouseWheel(game.Mouse.Wheel); } textFocusWidget = null; RenderContext.DepthEnabled = false; var aspect = ViewportWidth / ViewportHeight; var desktopRect = new RectangleF(0, 0, 480 * aspect, 480); if (Visible) { baseWidget.Render(this, desktopRect); } foreach (var widget in modals) { widget.Widget.Render(this, desktopRect); } RenderContext.DepthEnabled = true; }
public void AddChild(UiWidget child) { addRemoves.Enqueue((ctx) => { child.ApplyStylesheet(ctx.Data.Stylesheet); Children.Add(child); }); }
public void SetWidget(UiWidget widget) { foreach (var m in modals) { m.Widget.Dispose(); } modals = new Stack <ModalState>(); baseWidget = widget; }
public void Update(UiWidget widget, TimeSpan globalTime, int mouseX, int mouseY, bool leftDown) { GlobalTime = globalTime; var inputRatio = 480 / ViewportHeight; MouseX = mouseX * inputRatio; MouseY = mouseY * inputRatio; MouseLeftDown = leftDown; }
public void SetWidget(UiWidget widget) { widget.ApplyStylesheet(Data.Stylesheet); foreach (var m in modals) { m.Widget.Dispose(); } modals = new List <ModalState>(); baseWidget = widget; }
public int OpenModal(UiWidget widget) { var handle = _h++; widget.ApplyStylesheet(Data.Stylesheet); modals.Add(new ModalState() { Widget = widget, Handle = handle }); return(handle); }
public void Update(UiWidget widget, double globalTime, int mouseX, int mouseY, bool leftDown) { GlobalTime = globalTime; var inputRatio = 480 / ViewportHeight; MouseX = mouseX * inputRatio; MouseY = mouseY * inputRatio; MouseLeftDown = leftDown; lua?.DoTimers(globalTime); lua?.CallEvent("Update", globalTime); }
public void SwapModal(UiWidget widget, int handle) { widget.ApplyStylesheet(Data.Stylesheet); for (int i = 0; i < modals.Count; i++) { if (modals[i].Handle == handle) { modals[i].Widget = widget; break; } } }
public UiFullState SetWidget(UiWidget widget) { foreach (var m in modals) { m.Widget.Dispose(); } modals = new Stack <ModalState>(); baseWidget = widget; fullState = new UiFullState() { Widget = baseWidget, Modals = modals }; return(fullState); }
public void RenderWidget() { if (baseWidget == null) { return; } textFocusWidget = null; RenderState.DepthEnabled = false; mode2d = false; var aspect = ViewportWidth / ViewportHeight; var desktopRect = new RectangleF(0, 0, 480 * aspect, 480); baseWidget.Render(this, desktopRect); foreach (var widget in modals.Reverse()) { widget.Widget.Render(this, desktopRect); } if (mode2d) { Renderer2D.Finish(); } RenderState.DepthEnabled = true; }
public void AddChild(UiWidget child) { Children.Add(child); }
public void RemoveChild(UiWidget child) { addRemoves.Enqueue((x) => { Children.Remove(child); }); }
public void SwapModal(UiWidget widget, int handle) => c.uiContext.SwapModal(widget, handle);
public int OpenModal(UiWidget widget) => c.uiContext.OpenModal(widget);
public void SetWidget(UiWidget widget) => c.uiContext.SetWidget(widget);
internal void SetTextFocus(UiWidget widget) => textFocusWidget = widget;
public void SetFullState(UiFullState ctx) { modals = ctx.Modals; baseWidget = ctx.Widget; fullState = ctx; }