Exemple #1
0
        public GameOptions(Action <Page> GoTo, GameView parent)
        {
            Contract.Requires(parent != null);
            this.parent = parent;
            Goto        = GoTo;
            InitializeComponent();

            slAperature.Value = parent.config.Aperature;
            var requestedFrame = parent.Framenum;

            slAperature.ValueChanged += (_, e) => {
                if (initialized)
                {
                    parent.config.Aperature = e.NewValue;
                    if (parent.Framenum >= requestedFrame)
                    {
                        requestedFrame = parent.Framenum + 1;
                        parent.RenderOneFrame();
                    }
                }
            };
            slAperature.ValueChanged += GamePageUtil.Slider_ValueChanged;
            GamePageUtil.SetSliderText(slAperature);

            parent.changesSinceLastRender = true;
            initialized = true;
        }
Exemple #2
0
 public GameGraphicSettings(Action <Page> GoBack, GameView parent)
 {
     Contract.Requires(parent != null);
     this.parent = parent;
     this.GoBack = GoBack;
     InitializeComponent();
     slScale.Value         = parent.config.RenderScale;
     slSuper.Value         = parent.config.Supersampling;
     slDepth.Value         = parent.config.ReflectionDepth;
     slGamma.Value         = parent.config.Gamma;
     slThrads.Maximum      = Environment.ProcessorCount - 1;
     slThrads.Value        = parent.config.Threads;
     slScale.ValueChanged += (_, e) => { if (initialized)
                                         {
                                             parent.config.RenderScale = e.NewValue;
                                         }
     };
     slGamma.ValueChanged += (_, e) => { if (initialized)
                                         {
                                             parent.config.Gamma = e.NewValue;
                                         }
     };
     slSuper.ValueChanged += (_, e) => { if (initialized)
                                         {
                                             parent.config.Supersampling = (int)e.NewValue;
                                         }
     };
     slDepth.ValueChanged += (_, e) => { if (initialized)
                                         {
                                             parent.config.ReflectionDepth = (int)e.NewValue;
                                         }
     };
     slThrads.ValueChanged += (_, e) => { if (initialized)
                                          {
                                              parent.config.Threads = (int)e.NewValue;
                                          }
     };
     GamePageUtil.SetSliderText(slScale);
     GamePageUtil.SetSliderText(slGamma);
     GamePageUtil.SetSliderText(slSuper);
     GamePageUtil.SetSliderText(slDepth);
     GamePageUtil.SetSliderText(slThrads);
     slScale.ValueChanged         += GamePageUtil.Slider_ValueChanged;
     slGamma.ValueChanged         += GamePageUtil.Slider_ValueChanged;
     slSuper.ValueChanged         += GamePageUtil.SliderInt_ValueChanged;
     slDepth.ValueChanged         += GamePageUtil.SliderInt_ValueChanged;
     slThrads.ValueChanged        += GamePageUtil.SliderInt_ValueChanged;
     parent.changesSinceLastRender = true;
     initialized = true;
 }
        public GameKeybinds(Action <Page> GoBack, GameView parent)
        {
            Contract.Requires(parent != null);
            this.parent = parent;
            this.GoBack = GoBack;
            InitializeComponent();

            //slAperature.Value = parent.config.Aperature;
            slMouse.Value    = parent.config.MouseSensitivity / GameConfig.defaultMouseSensitivity;
            slMovement.Value = parent.config.MovementPerMS / GameConfig.defaultMovementPerMS;
            //slSuper.Value = parent.config.Supersampling;
            //slDepth.Value = parent.config.ReflectionDepth;
            //slGamma.Value = parent.config.Gamma;
            //slThrads.Maximum = Environment.ProcessorCount - 1;
            //slThrads.Value = parent.config.Threads;
            //slAperature.ValueChanged += (_, e) => { if (initialized) parent.config.Aperature = e.NewValue; };
            slMouse.ValueChanged += (_, e) => { if (initialized)
                                                {
                                                    parent.config.MouseSensitivity = e.NewValue * GameConfig.defaultMouseSensitivity;
                                                }
            };
            slMovement.ValueChanged += (_, e) => { if (initialized)
                                                   {
                                                       parent.config.MovementPerMS = e.NewValue * GameConfig.defaultMovementPerMS;
                                                   }
            };
            slMouse.ValueChanged    += GamePageUtil.Slider_ValueChanged;
            slMovement.ValueChanged += GamePageUtil.Slider_ValueChanged;
            //slGamma.ValueChanged += (_, e) => { if (initialized) parent.config.Gamma = e.NewValue; };
            //slSuper.ValueChanged += (_, e) => { if (initialized) parent.config.Supersampling = (int)e.NewValue; };
            //slDepth.ValueChanged += (_, e) => { if (initialized) parent.config.ReflectionDepth = (int)e.NewValue; };
            //slThrads.ValueChanged += (_, e) => { if (initialized) parent.config.Threads = (int)e.NewValue; };
            GamePageUtil.SetSliderText(slMouse);
            GamePageUtil.SetSliderText(slMovement);
            //SetSliderText(slScale);
            //SetSliderText(slGamma);
            //SetSliderText(slSuper);
            //SetSliderText(slDepth);
            //SetSliderText(slThrads);
            parent.changesSinceLastRender = true;
            initialized = true;
        }