Ejemplo n.º 1
0
 public void Mode3D()
 {
     if (!mode2d)
     {
         return;
     }
     Renderer2D.Finish();
     mode2d = false;
 }
        protected override void Draw(double elapsed)
        {
            Viewport.Replace(0, 0, Width, Height);
            RenderState.ClearColor = new Color4(0.2f, 0.2f, 0.2f, 1f);
            RenderState.ClearAll();
            imGui.NewFrame(elapsed);
            Renderer2D.Start(Width, Height);
            Renderer2D.DrawString("Arial", 16, "Librelancer", new Vector2(8), Color4.Black);
            Renderer2D.DrawString("Arial", 16, "Librelancer", new Vector2(6), Color4.White);
            var startY = Renderer2D.LineHeight("Arial", 16) + 8;

            Renderer2D.Finish();
            ImGui.PushFont(ImGuiHelper.Noto);
            var size = (Vector2)ImGui.GetIO().DisplaySize;

            ImGui.SetNextWindowSize(new Vector2(size.X, size.Y - startY), ImGuiCond.Always);
            ImGui.SetNextWindowPos(new Vector2(0, startY), ImGuiCond.Always, Vector2.Zero);
            bool childopened = true;

            ImGui.Begin("screen", ref childopened,
                        ImGuiWindowFlags.NoTitleBar |
                        ImGuiWindowFlags.NoSavedSettings |
                        ImGuiWindowFlags.NoBringToFrontOnFocus |
                        ImGuiWindowFlags.NoMove |
                        ImGuiWindowFlags.NoResize |
                        ImGuiWindowFlags.NoBackground);
            if (ImGui.BeginPopupModal("Error", ref openError, ImGuiWindowFlags.AlwaysAutoResize))
            {
                ImGui.Text(errorText);
                if (ImGui.Button("Ok"))
                {
                    ImGui.CloseCurrentPopup();
                }
                ImGui.EndPopup();
            }
            ImGui.AlignTextToFramePadding();
            ImGui.Text("Freelancer Directory: ");
            ImGui.SameLine();
            freelancerFolder.InputText("##folder", ImGuiInputTextFlags.None, 280);
            ImGui.SameLine();
            if (ImGui.Button("..."))
            {
                string newFolder;
                if ((newFolder = FileDialog.ChooseFolder()) != null)
                {
                    freelancerFolder.SetText(newFolder);
                }
            }
            ImGui.AlignTextToFramePadding();
            ImGui.Text("Resolution: ");
            ImGui.SameLine();
            ImGui.PushItemWidth(130);
            ImGui.InputInt("##resX", ref resolutionX, 0, 0);
            resolutionX = MathHelper.Clamp(resolutionX, 600, 16384);
            ImGui.SameLine();
            ImGui.Text("x");
            ImGui.SameLine();
            ImGui.InputInt("##resY", ref resolutionY, 0, 0);
            resolutionY = MathHelper.Clamp(resolutionY, 400, 16384);
            ImGui.PopItemWidth();
            SoundSlider("Master Volume: ", ref masterVolume);
            SoundSlider("Music Volume: ", ref musicVolume);
            SoundSlider("Sfx Volume: ", ref sfxVolume);
            ImGui.Checkbox("VSync", ref vsync);
            if (Program.introForceDisable)
            {
                ImGui.Text("Intro Movies Disabled");
            }
            else
            {
                ImGui.Checkbox("Skip Intro Movies", ref skipIntroMovies);
            }
            ImGui.Dummy(new Vector2(16));
            ImGui.Dummy(new Vector2(1));
            ImGui.SameLine(ImGui.GetWindowWidth() - 70);
            if (ImGui.Button("Launch"))
            {
                LaunchClicked();
            }
            ImGui.End();
            ImGui.PopFont();
            imGui.Render(RenderState);
        }