public override void SetupWindow(FrameworkConfigManager config) { base.SetupWindow(config); CurrentDisplay.ValueChanged += evt => { windowDisplayIndex.Value = (DisplayIndex)evt.NewValue.Index; windowPositionX.Value = 0.5; windowPositionY.Value = 0.5; }; config.BindWith(FrameworkSetting.LastDisplayDevice, windowDisplayIndex); windowDisplayIndex.BindValueChanged(evt => CurrentDisplay.Value = Displays.ElementAtOrDefault((int)evt.NewValue) ?? PrimaryDisplay, true); sizeFullscreen.ValueChanged += evt => { if (evt.NewValue.IsEmpty || CurrentDisplay.Value == null) { return; } var mode = CurrentDisplay.Value.FindDisplayMode(evt.NewValue); if (mode.Size != System.Drawing.Size.Empty) { WindowBackend.CurrentDisplayMode = mode; } }; sizeWindowed.ValueChanged += evt => { if (evt.NewValue.IsEmpty) { return; } WindowBackend.Size = evt.NewValue; Size.Value = evt.NewValue; }; config.BindWith(FrameworkSetting.SizeFullscreen, sizeFullscreen); config.BindWith(FrameworkSetting.WindowedSize, sizeWindowed); config.BindWith(FrameworkSetting.WindowedPositionX, windowPositionX); config.BindWith(FrameworkSetting.WindowedPositionY, windowPositionY); RelativePosition = new Vector2((float)windowPositionX.Value, (float)windowPositionY.Value); config.BindWith(FrameworkSetting.WindowMode, WindowMode); WindowMode.BindValueChanged(evt => UpdateWindowMode(evt.NewValue), true); config.BindWith(FrameworkSetting.ConfineMouseMode, ConfineMouseMode); ConfineMouseMode.BindValueChanged(confineMouseModeChanged, true); Resized += onResized; Moved += onMoved; }
public override void SetupWindow(FrameworkConfigManager config) { config.BindWith(FrameworkSetting.SizeFullscreen, sizeFullscreen); sizeFullscreen.ValueChanged += e => { if (WindowState == WindowState.Fullscreen) { ChangeResolution(CurrentDisplay, e.NewValue); } }; sizeWindowed.ValueChanged += newSize => { if (WindowState == WindowState.Normal) { ClientSize = sizeWindowed.Value; } }; config.BindWith(FrameworkSetting.WindowedSize, sizeWindowed); config.BindWith(FrameworkSetting.WindowedPositionX, windowPositionX); config.BindWith(FrameworkSetting.WindowedPositionY, windowPositionY); config.BindWith(FrameworkSetting.LastDisplayDevice, windowDisplayIndex); windowDisplayIndex.BindValueChanged(windowDisplayIndexChanged, true); config.BindWith(FrameworkSetting.WindowMode, WindowMode); WindowMode.BindValueChanged(windowModeChanged, true); config.BindWith(FrameworkSetting.ConfineMouseMode, ConfineMouseMode); ConfineMouseMode.BindValueChanged(confineMouseModeChanged, true); config.BindWith(FrameworkSetting.MapAbsoluteInputToWindow, MapAbsoluteInputToWindow); Exited += onExit; }