public static void Dispose() { UIWindow.Dispose(); UIWindow = null; Elements.Clear(); Shaders.Dispose(); }
public static void OnResize(int width, int height) { UI.Width = width; UI.Height = height; UIProjectionMatrix = Matrix4.CreateTranslation(new Vector3(-UI.Width / 2, -UI.Height / 2, 0)) * Matrix4.CreateOrthographic(UI.Width, UI.Height, 0, 1000); Shaders.UpdateUIProjectionMatrix(UIProjectionMatrix); if (UIWindow == null) { return; } UIWindow.Size = new Point(UI.Width, UI.Height); UIWindow.OnResize(); }
public static void InitUI(int width, int height) { if (Shaders.Init()) { Elements = new Dictionary <string, UIElement>(); // create the top level screen container UIWindow = new UIContainer(new Point(0, 0), new Point(UI.Width, UI.Height), "TopLevel"); UIWindow.RelativeTo = Corner.BottomLeft; Elements.Add("Screen", UIWindow); UIProjectionMatrix = Matrix4.CreateTranslation(new Vector3(-UI.Width / 2, -UI.Height / 2, 0)) * Matrix4.CreateOrthographic(UI.Width, UI.Height, 0, 1000); Visible = true; MainThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; OnResize(width, height); } }