Beispiel #1
0
        // --------------

        public GuiApplication(ILifetimeScope scope) : base(WINDOW_WIDTH, WINDOW_HEIGHT, GraphicsMode.Default,
                                                           WINDOW_TITLE,
                                                           GameWindowFlags.Default, DisplayDevice.Default, GL_MAJOR_VERSION, GL_MINOR_VERSION,
                                                           GraphicsContextFlags.Default)
        {
            Instance = this;

            createControllers(scope);

            Icon = new Icon(typeof(GuiApplication), "appicon.ico");

            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.CullFace);

            _cam = new Camera();
            _cameraController.ProvideCamera(_cam);
            _cam.Transform.Translate(new Vector3(0, 0, -3));
            _fbo = new Framebuffer(WINDOW_WIDTH, WINDOW_HEIGHT, FramebufferTarget.Framebuffer);

            _proj = Matrix4.CreatePerspectiveFieldOfView(MathHelper.DegreesToRadians(60f),
                                                         (float)_fbo.Width / _fbo.Height, 0.1f, 100f);

            ImGuiRenderer.Init();

            _guiComponents = new List <ImGuiComponent>();

            ApplicationArea area = new ApplicationArea();

            TreeView <TreeNode> outlineView = new TreeView <TreeNode>();

            _treeController.SetTree(outlineView);

            area.AddChild(new Columns(2, new List <ImGuiComponent>
            {
                outlineView, new FramebufferArea(_fbo)
            }, new[] { 250f, -1 }));

            var menuBar = new MainMenuBar(_fileOpenController, _vramController, _configController, _cameraController,
                                          _exportController);

            if (string.IsNullOrWhiteSpace(_configController.Config.GameDataPath))
            {
                // show the set game data path dialog if it hasn't yet been set
                menuBar.OpenSetGameDataPath();
            }

            _updateAvailableModal = new Modal("New update available!",
                                              "Download at https://github.com/Figglewatts/LSDView/releases/latest");

            _fileExportDialog = new FileDialog(_configController.Config.GameDataPath, FileDialog.DialogType.Save);
            _configController.Config.OnGameDataPathChange += () =>
                                                             _fileExportDialog.InitialDir = _configController.Config.GameDataPath;
            _exportController.ProvideFileExportDialog(_fileExportDialog);

            _guiComponents.Add(area);
            _guiComponents.Add(menuBar);
            _guiComponents.Add(_fileExportDialog);
            _guiComponents.Add(_updateAvailableModal);

            if (_updateCheckerController.IsUpdateAvailable())
            {
                _updateAvailableModal.ShowModal();
            }
        }