/// <summary> /// The main entry point for the application. /// </summary> public static void Main() { System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); Gui.GuiController.Init(); var manager = new JORManager(); while (true) { manager.Update(); Gui.GuiController.Update(manager); } }
public static void Update(JORManager manager) { if (!_window.Exists) { Environment.Exit(0); return; } InputSnapshot snapshot = _window.PumpEvents(); if (!_window.Exists) { return; } _controller.Update(1f / 60f, snapshot); SubmitUI(manager); _cl.Begin(); _cl.SetFramebuffer(_gd.MainSwapchain.Framebuffer); _cl.ClearColorTarget(0, new RgbaFloat(_clearColor.X, _clearColor.Y, _clearColor.Z, 1f)); _controller.Render(_gd, _cl); _cl.End(); _gd.SubmitCommands(_cl); _gd.SwapBuffers(_gd.MainSwapchain); }
public static void SubmitUI(JORManager manager) { ImGui.Begin("MAIN_WINDOW", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoTitleBar); var windowX = 0; ImGui.SetWindowPos(new Vector2(windowX, 0), ImGuiCond.Once); var leftPaneWidth = 350; ImGui.SetWindowSize(new Vector2(leftPaneWidth, _window.Height)); windowX += leftPaneWidth + 1; var statusTextColor = 0xFF0000FF; var statusText = "Not Connected"; if (manager.currentClient != null && manager.currentClient.IsConnected()) { var datsize = manager.jhiClient.GetUnprocessedDataSize() + 1; statusTextColor = 0xFF00FF00; statusText = $"Connected, buffer size {datsize - 1:X8}"; if (datsize == 1) { largestBufferUntil0 = 1; } else if (datsize > largestBufferUntil0) { largestBufferUntil0 = datsize; } ImGui.ProgressBar((largestBufferUntil0 - (float)datsize) / (float)largestBufferUntil0); } DrawStyledTextInstance(statusText, statusTextColor); var jorServer = manager.jorServer; if (jorServer != null) { // Sort of a hack to do this here, but go through all nodes and make sure that their controls // have translation entries. EnsureTranslation(jorServer.Root.TreeRoot); if (ImGui.Button("Request JOR Root")) { manager.jorServer.SendGetRootObjectRef(); } ImGui.Checkbox("Use Translation", ref UseTranslation); if (ImGui.Button("Request Translation")) { translationDictionary.CloudTranslate(); } ImGui.InputText("Search", ref currentSearchString, 100); ImGui.BeginChild("JorTreeContainer"); DrawTree(jorServer, jorServer.Root.TreeRoot); ImGui.EndChild(); ImGui.End(); ImGui.Begin("CONTROL_WINDOW", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoTitleBar); // Init window ImGui.SetWindowPos(new Vector2(windowX, 0), ImGuiCond.Once); ImGui.SetWindowSize(new Vector2(_window.Width - windowX, _window.Height)); var node = jorServer.CurrentNode; if (node != null && node.Status == JORNodeStatus.Valid) { if (node.Controls.Any((control) => control.Type.StartsWith("RNG"))) { if (ImGui.Button("ALL SLIDERS TO MAX")) { AllSlidersToMax(jorServer, node); } } foreach (JORControl control in node.Controls) { DrawControlContainer(jorServer, control); } } ImGui.End(); } }