Exemple #1
0
        private void load(KanojoWorksConfigManager config)
        {
            scalingMode = config.GetBindable <ScalingMode>(KanojoWorksSetting.ScalingMode);
            scalingMode.ValueChanged += _ => updateSize();

            scaleBindable = config.GetBindable <float>(KanojoWorksSetting.Scale);
            scaleBindable.ValueChanged += _ => updateSize();
            scaleBindable.BindValueChanged(v => updateSize(), true);
        }
        private void load(GameHost host, KanojoWorksConfigManager configManager)
        {
            gameHost    = host;
            scalingMode = configManager.GetBindable <ScalingMode>(KanojoWorksSetting.ScalingMode);
            scalingMode.ValueChanged += _ => updateContainerSize(true);

            // Ensure Container size is updated every frame for smooth resizing.
            OnUpdate += _ => updateContainerSize();
        }
        private void load(FrameworkConfigManager config, KanojoWorksConfigManager kwConfig, GameHost host)
        {
            scalingMode       = kwConfig.GetBindable <ScalingMode>(KanojoWorksSetting.ScalingMode);
            currentWindowMode = config.GetBindable <WindowMode>(FrameworkSetting.WindowMode);
            sizeFullscreen    = config.GetBindable <Size>(FrameworkSetting.SizeFullscreen);

            if (host.Window != null)
            {
                currentDisplay.BindTo(host.Window.CurrentDisplayBindable);
                windowModes.BindTo(host.Window.SupportedWindowModes);
            }

            const int max_width = 180;

            SectionName = "VIDEO";
            Children    = new Drawable[]
            {
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Spacing      = new Vector2(5),
                    Children     = new Drawable[]
                    {
                        new SpriteText
                        {
                            Width = max_width,
                            Text  = "Resolution",
                            Font  = KanojoWorksFont.GetFont(size: 30, weight: FontWeight.Light)
                        },
                        new ResolutionDropdown
                        {
                            Width      = 200,
                            ItemSource = resolutions,
                            Current    = sizeFullscreen
                        }
                    }
                },
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Spacing      = new Vector2(5),
                    Children     = new Drawable[]
                    {
                        new SpriteText
                        {
                            Width = max_width,
                            Text  = "Window Mode",
                            Font  = KanojoWorksFont.GetFont(size: 30, weight: FontWeight.Light)
                        },
                        new KanojoWorksEnumDropdown <WindowMode>
                        {
                            Width   = 200,
                            Current = currentWindowMode
                        }
                    }
                },
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Spacing      = new Vector2(5),
                    Children     = new Drawable[]
                    {
                        new SpriteText
                        {
                            Width = max_width,
                            Text  = "Scaling Mode",
                            Font  = KanojoWorksFont.GetFont(size: 30, weight: FontWeight.Light)
                        },
                        new KanojoWorksEnumDropdown <ScalingMode>
                        {
                            Width   = 200,
                            Current = scalingMode
                        }
                    }
                },
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Spacing      = new Vector2(5),
                    Children     = new Drawable[]
                    {
                        new SpriteText
                        {
                            Width = max_width,
                            Text  = "Frame Limiter",
                            Font  = KanojoWorksFont.GetFont(size: 30, weight: FontWeight.Light)
                        },
                        new KanojoWorksEnumDropdown <FrameSync>
                        {
                            Width   = 200,
                            Current = config.GetBindable <FrameSync>(FrameworkSetting.FrameSync)
                        }
                    }
                },
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Spacing      = new Vector2(5),
                    Children     = new Drawable[]
                    {
                        new SpriteText
                        {
                            Width = max_width,
                            Text  = "Threading Mode",
                            Font  = KanojoWorksFont.GetFont(size: 30, weight: FontWeight.Light)
                        },
                        new KanojoWorksEnumDropdown <ExecutionMode>
                        {
                            Width   = 200,
                            Current = config.GetBindable <ExecutionMode>(FrameworkSetting.ExecutionMode)
                        }
                    }
                }
            };
        }