Add power start from one

This commit is contained in:
Jacob Palecki 2021-09-16 18:33:30 -07:00 committed by a1xd
parent 9cdad754cc
commit 1fd8881608
20 changed files with 381 additions and 14 deletions

View file

@ -23,7 +23,7 @@ namespace rawaccel {
power(const accel_args& args)
{
// Note that cap types may overwrite this below.
// Note that cap types may overwrite scale below.
scale = args.scale;
switch (args.cap_mode){
@ -65,7 +65,12 @@ namespace rawaccel {
double operator()(double speed, const accel_args& args) const
{
return minsd(base_fn(speed, scale, args), cap);
if (args.powerStartFromOne) {
return minsd(maxsd(base_fn(speed, scale, args), 1), cap);
}
else {
return minsd(base_fn(speed, scale, args), cap);
}
}
double static scale_from_sens_point(double sens, double input, double power)
@ -79,6 +84,7 @@ namespace rawaccel {
vec2d cap = { DBL_MAX, DBL_MAX };
double constant = 0;
double scale = 0;
vec2d startFromOne{ 0, 0 };
power(const accel_args& args)
{
@ -102,12 +108,8 @@ namespace rawaccel {
args.cap.x,
args.exponent_power,
scale);
constant = integration_constant(
cap.x,
cap.y,
base_fn(cap.x, scale, args));
}
break;
case classic_cap_mode::io:
if (args.cap.x > 0 &&
args.cap.y > 1) {
@ -117,12 +119,8 @@ namespace rawaccel {
args.cap.x,
args.cap.y,
args.exponent_power);
constant = integration_constant(
cap.x,
cap.y,
base_fn(cap.x, scale, args));
}
break;
case classic_cap_mode::out:
default:
if (args.cap.y > 1) {
@ -131,26 +129,77 @@ namespace rawaccel {
args.cap.y,
args.exponent_power,
scale);
}
break;
}
if (args.powerStartFromOne)
{
startFromOne.x = gain_inverse(
1,
args.exponent_power,
scale);
startFromOne.y = -1 * integration_constant(startFromOne.x,
1,
base_fn(startFromOne.x, scale, args));
}
if (cap.x < DBL_MAX && cap.y < DBL_MAX)
{
if (args.powerStartFromOne) {
constant = integration_constant(
cap.x,
cap.y,
startFromOneOutput(
startFromOne,
cap.x,
scale,
args));
}
else {
constant = integration_constant(
cap.x,
cap.y,
base_fn(cap.x, scale, args));
}
break;
}
}
double operator()(double speed, const accel_args& args) const
{
if (speed < cap.x) {
return base_fn(speed, scale, args);
if (args.powerStartFromOne) {
return startFromOneOutput(
startFromOne,
speed,
scale,
args);
}
else {
return base_fn(speed, scale, args);
}
}
else {
return cap.y + constant / speed;
}
}
double static startFromOneOutput(
const vec2d& startFromOne,
double speed,
double scale,
const accel_args& args)
{
if (speed > startFromOne.x) {
return base_fn(speed, scale, args) + startFromOne.y / speed;
}
else
{
return 1;
}
}
double static gain_inverse(double gain, double power, double scale)
{
return pow(gain / (power + 1), 1 / power) / scale;

View file

@ -53,6 +53,7 @@ namespace rawaccel {
double limit = 1.5;
double midpoint = 5;
double smooth = 0.5;
bool powerStartFromOne = true;
vec2d cap = { 15, 1.5 };
classic_cap_mode cap_mode = classic_cap_mode::out;

View file

@ -71,6 +71,12 @@ namespace grapher
System.Windows.Forms.DataVisualization.Charting.Title title6 = new System.Windows.Forms.DataVisualization.Charting.Title();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RawAcceleration));
this.optionsPanel = new System.Windows.Forms.Panel();
this.powerStartsFromOneBoxY = new System.Windows.Forms.CheckBox();
this.powerStartsFromZeroBoxY = new System.Windows.Forms.CheckBox();
this.powerStartsFromOneBoxX = new System.Windows.Forms.CheckBox();
this.powerStartsFromZeroBoxX = new System.Windows.Forms.CheckBox();
this.powerStartFromLabelY = new System.Windows.Forms.Label();
this.powerStartFromLabelX = new System.Windows.Forms.Label();
this.OutCapActiveYLabelPower = new System.Windows.Forms.Label();
this.InCapActiveYLabelPower = new System.Windows.Forms.Label();
this.OutCapActiveXLabelPower = new System.Windows.Forms.Label();
@ -248,6 +254,8 @@ namespace grapher
this.GainChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.VelocityChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.AccelerationChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.powerStartFromActiveLabelX = new System.Windows.Forms.Label();
this.powerStartFromActiveLabelY = new System.Windows.Forms.Label();
this.optionsPanel.SuspendLayout();
this.DirectionalityPanel.SuspendLayout();
this.menuStrip1.SuspendLayout();
@ -263,6 +271,14 @@ namespace grapher
// optionsPanel
//
this.optionsPanel.AutoSize = true;
this.optionsPanel.Controls.Add(this.powerStartFromActiveLabelY);
this.optionsPanel.Controls.Add(this.powerStartFromActiveLabelX);
this.optionsPanel.Controls.Add(this.powerStartsFromOneBoxY);
this.optionsPanel.Controls.Add(this.powerStartsFromZeroBoxY);
this.optionsPanel.Controls.Add(this.powerStartsFromOneBoxX);
this.optionsPanel.Controls.Add(this.powerStartsFromZeroBoxX);
this.optionsPanel.Controls.Add(this.powerStartFromLabelY);
this.optionsPanel.Controls.Add(this.powerStartFromLabelX);
this.optionsPanel.Controls.Add(this.OutCapActiveYLabelPower);
this.optionsPanel.Controls.Add(this.InCapActiveYLabelPower);
this.optionsPanel.Controls.Add(this.OutCapActiveXLabelPower);
@ -408,6 +424,58 @@ namespace grapher
this.optionsPanel.Size = new System.Drawing.Size(483, 956);
this.optionsPanel.TabIndex = 34;
//
// powerStartsFromOneBoxY
//
this.powerStartsFromOneBoxY.Location = new System.Drawing.Point(363, 220);
this.powerStartsFromOneBoxY.Name = "powerStartsFromOneBoxY";
this.powerStartsFromOneBoxY.Size = new System.Drawing.Size(32, 17);
this.powerStartsFromOneBoxY.TabIndex = 0;
this.powerStartsFromOneBoxY.Text = "1";
this.powerStartsFromOneBoxY.UseVisualStyleBackColor = true;
//
// powerStartsFromZeroBoxY
//
this.powerStartsFromZeroBoxY.Location = new System.Drawing.Point(332, 220);
this.powerStartsFromZeroBoxY.Name = "powerStartsFromZeroBoxY";
this.powerStartsFromZeroBoxY.Size = new System.Drawing.Size(32, 17);
this.powerStartsFromZeroBoxY.TabIndex = 0;
this.powerStartsFromZeroBoxY.Text = "0";
this.powerStartsFromZeroBoxY.UseVisualStyleBackColor = true;
//
// powerStartsFromOneBoxX
//
this.powerStartsFromOneBoxX.Location = new System.Drawing.Point(136, 220);
this.powerStartsFromOneBoxX.Name = "powerStartsFromOneBoxX";
this.powerStartsFromOneBoxX.Size = new System.Drawing.Size(32, 17);
this.powerStartsFromOneBoxX.TabIndex = 0;
this.powerStartsFromOneBoxX.Text = "1";
this.powerStartsFromOneBoxX.UseVisualStyleBackColor = true;
//
// powerStartsFromZeroBoxX
//
this.powerStartsFromZeroBoxX.Location = new System.Drawing.Point(106, 220);
this.powerStartsFromZeroBoxX.Name = "powerStartsFromZeroBoxX";
this.powerStartsFromZeroBoxX.Size = new System.Drawing.Size(32, 17);
this.powerStartsFromZeroBoxX.TabIndex = 0;
this.powerStartsFromZeroBoxX.Text = "0";
this.powerStartsFromZeroBoxX.UseVisualStyleBackColor = true;
//
// powerStartFromLabelY
//
this.powerStartFromLabelY.Location = new System.Drawing.Point(266, 220);
this.powerStartFromLabelY.Name = "powerStartFromLabelY";
this.powerStartFromLabelY.Size = new System.Drawing.Size(52, 13);
this.powerStartFromLabelY.TabIndex = 0;
this.powerStartFromLabelY.Text = "Start from";
//
// powerStartFromLabelX
//
this.powerStartFromLabelX.Location = new System.Drawing.Point(38, 220);
this.powerStartFromLabelX.Name = "powerStartFromLabelX";
this.powerStartFromLabelX.Size = new System.Drawing.Size(55, 13);
this.powerStartFromLabelX.TabIndex = 0;
this.powerStartFromLabelX.Text = "Start from";
//
// OutCapActiveYLabelPower
//
this.OutCapActiveYLabelPower.AutoSize = true;
@ -2138,6 +2206,24 @@ namespace grapher
title6.Text = "Sensitivity";
this.AccelerationChart.Titles.Add(title6);
//
// powerStartFromActiveLabelX
//
this.powerStartFromActiveLabelX.AutoSize = true;
this.powerStartFromActiveLabelX.Location = new System.Drawing.Point(197, 220);
this.powerStartFromActiveLabelX.Name = "powerStartFromActiveLabelX";
this.powerStartFromActiveLabelX.Size = new System.Drawing.Size(13, 13);
this.powerStartFromActiveLabelX.TabIndex = 225;
this.powerStartFromActiveLabelX.Text = "0";
//
// powerStartFromActiveLabelY
//
this.powerStartFromActiveLabelY.AutoSize = true;
this.powerStartFromActiveLabelY.Location = new System.Drawing.Point(414, 221);
this.powerStartFromActiveLabelY.Name = "powerStartFromActiveLabelY";
this.powerStartFromActiveLabelY.Size = new System.Drawing.Size(13, 13);
this.powerStartFromActiveLabelY.TabIndex = 226;
this.powerStartFromActiveLabelY.Text = "0";
//
// RawAcceleration
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -2345,6 +2431,14 @@ namespace grapher
private System.Windows.Forms.TextBox outCapBoxXPower;
private System.Windows.Forms.TextBox inCapBoxYPower;
private System.Windows.Forms.TextBox inCapBoxXPower;
private System.Windows.Forms.CheckBox powerStartsFromOneBoxY;
private System.Windows.Forms.CheckBox powerStartsFromZeroBoxY;
private System.Windows.Forms.CheckBox powerStartsFromOneBoxX;
private System.Windows.Forms.CheckBox powerStartsFromZeroBoxX;
private System.Windows.Forms.Label powerStartFromLabelY;
private System.Windows.Forms.Label powerStartFromLabelX;
private System.Windows.Forms.Label powerStartFromActiveLabelX;
private System.Windows.Forms.Label powerStartFromActiveLabelY;
}
}

View file

@ -114,6 +114,10 @@ namespace grapher
ByComponentCheckBox,
gainSwitchX,
gainSwitchY,
powerStartsFromZeroBoxX,
powerStartsFromOneBoxX,
powerStartsFromZeroBoxY,
powerStartsFromOneBoxY,
XLutActiveValuesBox,
YLutActiveValuesBox,
XLutPointsBox,
@ -152,6 +156,8 @@ namespace grapher
powerLabelY,
expLabelX,
expLabelY,
powerStartFromLabelX,
powerStartFromLabelY,
LUTTextLabelX,
LUTTextLabelY,
constantThreeLabelX,
@ -191,6 +197,8 @@ namespace grapher
PowerClassicActiveYLabel,
ExpActiveXLabel,
ExpActiveYLabel,
powerStartFromActiveLabelX,
powerStartFromActiveLabelY,
MidpointActiveXLabel,
MidpointActiveYLabel,
AccelTypeActiveLabelX,

View file

@ -20,6 +20,7 @@ namespace grapher.Layouts
LimitLayout = new OptionLayout(false, string.Empty);
PowerClassicLayout = new OptionLayout(true, PowerClassic);
ExponentLayout = new OptionLayout(false, string.Empty);
PowerStartsFromLayout = new OptionLayout(false, string.Empty);
MidpointLayout = new OptionLayout(false, string.Empty);
LutTextLayout = new OptionLayout(false, string.Empty);
LutPanelLayout = new OptionLayout(false, string.Empty);

View file

@ -21,6 +21,7 @@ namespace grapher.Layouts
LimitLayout = new OptionLayout(true, Limit);
PowerClassicLayout = new OptionLayout(true, PowerClassic);
ExponentLayout = new OptionLayout(true, Exponent);
PowerStartsFromLayout = new OptionLayout(false, string.Empty);
MidpointLayout = new OptionLayout(true, Midpoint);
LutTextLayout = new OptionLayout(false, string.Empty);
LutPanelLayout = new OptionLayout(false, string.Empty);

View file

@ -21,6 +21,7 @@ namespace grapher.Layouts
LimitLayout = new OptionLayout(false, Limit);
PowerClassicLayout = new OptionLayout(false, string.Empty);
ExponentLayout = new OptionLayout(false, string.Empty);
PowerStartsFromLayout = new OptionLayout(false, string.Empty);
MidpointLayout = new OptionLayout(false, string.Empty);
LutTextLayout = new OptionLayout(false, string.Empty);
LutPanelLayout = new OptionLayout(false, string.Empty);

View file

@ -28,6 +28,7 @@ namespace grapher.Layouts
OffsetLayout = new OptionLayout(false, Offset);
LimitLayout = new OptionLayout(false, string.Empty);
PowerClassicLayout = new OptionLayout(false, string.Empty);
PowerStartsFromLayout = new OptionLayout(false, string.Empty);
ExponentLayout = new OptionLayout(false, Exponent);
MidpointLayout = new OptionLayout(false, string.Empty);
LutTextLayout = new OptionLayout(true, string.Empty);

View file

@ -9,6 +9,7 @@ namespace grapher.Layouts
public const string DecayRate = "Decay Rate";
public const string Scale = "Scale";
public const string Exponent = "Exponent";
public const string StartsFrom = "Start from";
public const string PowerClassic = "Power";
public const string Limit = "Limit";
public const string Midpoint = "Midpoint";
@ -30,6 +31,7 @@ namespace grapher.Layouts
LimitLayout = new OptionLayout(false, string.Empty);
PowerClassicLayout = new OptionLayout(false, string.Empty);
ExponentLayout = new OptionLayout(false, string.Empty);
PowerStartsFromLayout = new OptionLayout(false, string.Empty);
MidpointLayout = new OptionLayout(false, string.Empty);
LutTextLayout = new OptionLayout(false, string.Empty);
LutPanelLayout = new OptionLayout(false, string.Empty);
@ -65,6 +67,8 @@ namespace grapher.Layouts
protected OptionLayout ExponentLayout { get; set; }
protected OptionLayout PowerStartsFromLayout { get; set; }
protected OptionLayout MidpointLayout { get; set; }
protected OptionLayout LutTextLayout { get; set; }
@ -91,6 +95,7 @@ namespace grapher.Layouts
IOption limitOption,
IOption powerClassicOption,
IOption expOption,
IOption startsFromOption,
IOption midpointOption,
IOption lutTextOption,
IOption lutPanelOption,
@ -111,6 +116,7 @@ namespace grapher.Layouts
(LimitLayout, limitOption),
(PowerClassicLayout, powerClassicOption),
(ExponentLayout, expOption),
(PowerStartsFromLayout, startsFromOption),
(MidpointLayout, midpointOption),
(LutTextLayout, lutTextOption),
(LutPanelLayout, lutPanelOption),
@ -145,6 +151,7 @@ namespace grapher.Layouts
IOption limitOption,
IOption powerClassicOption,
IOption expOption,
IOption startsFromOption,
IOption midpointOption,
IOption lutTextOption,
IOption lutPanelOption,
@ -160,6 +167,7 @@ namespace grapher.Layouts
limitOption,
powerClassicOption,
expOption,
startsFromOption,
midpointOption,
lutTextOption,
lutPanelOption,

View file

@ -21,6 +21,7 @@ namespace grapher.Layouts
OffsetLayout = new OptionLayout(true, Offset);
LimitLayout = new OptionLayout(false, string.Empty);
PowerClassicLayout = new OptionLayout(false, string.Empty);
PowerStartsFromLayout = new OptionLayout(false, string.Empty);
ExponentLayout = new OptionLayout(false, string.Empty);
MidpointLayout = new OptionLayout(false, string.Empty);
LutTextLayout = new OptionLayout(false, string.Empty);

View file

@ -26,6 +26,7 @@ namespace grapher.Layouts
LimitLayout = new OptionLayout(true, Motivity);
PowerClassicLayout = new OptionLayout(false, string.Empty);
ExponentLayout = new OptionLayout(false, string.Empty);
PowerStartsFromLayout = new OptionLayout(false, string.Empty);
MidpointLayout = new OptionLayout(true, Midpoint);
LutTextLayout = new OptionLayout(false, string.Empty);
LutPanelLayout = new OptionLayout(false, string.Empty);

View file

@ -21,6 +21,7 @@ namespace grapher.Layouts
LimitLayout = new OptionLayout(true, Limit);
PowerClassicLayout = new OptionLayout(false, string.Empty);
ExponentLayout = new OptionLayout(false, string.Empty);
PowerStartsFromLayout = new OptionLayout(false, string.Empty);
MidpointLayout = new OptionLayout(false, string.Empty);
LutTextLayout = new OptionLayout(false, string.Empty);
LutPanelLayout = new OptionLayout(false, string.Empty);

View file

@ -21,6 +21,7 @@ namespace grapher.Layouts
LimitLayout = new OptionLayout(false, string.Empty);
PowerClassicLayout = new OptionLayout(false, string.Empty);
ExponentLayout = new OptionLayout(false, string.Empty);
PowerStartsFromLayout = new OptionLayout(false, string.Empty);
MidpointLayout = new OptionLayout(false, string.Empty);
LutTextLayout = new OptionLayout(false, string.Empty);
LutPanelLayout = new OptionLayout(false, string.Empty);

View file

@ -19,6 +19,7 @@
LimitLayout = new OptionLayout(false, string.Empty);
PowerClassicLayout = new OptionLayout(false, string.Empty);
ExponentLayout = new OptionLayout(true, Exponent);
PowerStartsFromLayout = new OptionLayout(true, StartsFrom);
MidpointLayout = new OptionLayout(false, string.Empty);
LutTextLayout = new OptionLayout(false, string.Empty);
LutPanelLayout = new OptionLayout(false, string.Empty);

View file

@ -26,6 +26,7 @@ namespace grapher.Layouts
LimitLayout = new OptionLayout(false, string.Empty);
PowerClassicLayout = new OptionLayout(false, string.Empty);
ExponentLayout = new OptionLayout(false, Exponent);
PowerStartsFromLayout = new OptionLayout(false, string.Empty);
MidpointLayout = new OptionLayout(false, string.Empty);
LutTextLayout = new OptionLayout(true, LUTLayoutText);
LutPanelLayout = new OptionLayout(false, string.Empty);

View file

@ -86,6 +86,10 @@ namespace grapher.Models
CheckBox byComponentCheckBox,
CheckBox gainSwitchX,
CheckBox gainSwitchY,
CheckBox powerStartsFromZeroBoxX,
CheckBox powerStartsFromOneBoxX,
CheckBox powerStartsFromZeroBoxY,
CheckBox powerStartsFromOneBoxY,
RichTextBox xLutActiveValuesBox,
RichTextBox yLutActiveValuesBox,
RichTextBox xLutPointsBox,
@ -124,6 +128,8 @@ namespace grapher.Models
Label powerClassicLabelY,
Label expLabelX,
Label expLabelY,
Label powerStartsFromLabelX,
Label powerStartsFromLabelY,
Label lutTextLabelX,
Label lutTextLabelY,
Label constantThreeLabelX,
@ -163,6 +169,8 @@ namespace grapher.Models
Label powerClassicActiveLabelY,
Label expActiveLabelX,
Label expActiveLabelY,
Label powerStartsFromActiveLabelX,
Label powerStartsFromActiveLabelY,
Label midpointActiveLabelX,
Label midpointActiveLabelY,
Label accelTypeActiveLabelX,
@ -487,6 +495,20 @@ namespace grapher.Models
outCapYPower,
scaleY);
var powerStartsFromX = new SwitchOption(
powerStartsFromLabelX,
powerStartsFromZeroBoxX,
powerStartsFromOneBoxX,
new ActiveValueLabel(powerStartsFromActiveLabelX, activeValueTitleX),
0);
var powerStartsFromY = new SwitchOption(
powerStartsFromLabelY,
powerStartsFromZeroBoxY,
powerStartsFromOneBoxY,
new ActiveValueLabel(powerStartsFromActiveLabelY, activeValueTitleY),
optionSetYLeft);
var lpNorm = new Option(
new Field(lpNormBox, form, 2),
lpNormLabel,
@ -532,6 +554,7 @@ namespace grapher.Models
gainSwitchOptionX,
classicCapOptionsX,
powerCapOptionsX,
powerStartsFromX,
decayRateX,
growthRateX,
smoothX,
@ -554,6 +577,7 @@ namespace grapher.Models
gainSwitchOptionY,
classicCapOptionsY,
powerCapOptionsY,
powerStartsFromY,
decayRateY,
growthRateY,
smoothY,

View file

@ -29,6 +29,7 @@ namespace grapher
CheckBoxOption gainSwitch,
CapOptions classicCap,
CapOptions powerCap,
SwitchOption powerStartsFrom,
Option decayRate,
Option growthRate,
Option smooth,
@ -70,6 +71,7 @@ namespace grapher
Limit = limit;
PowerClassic = powerClassic;
Exponent = exponent;
PowerStartsFrom = powerStartsFrom;
Midpoint = midpoint;
WriteButton = writeButton;
AccelTypeActiveValue = accelTypeActiveValue;
@ -112,6 +114,8 @@ namespace grapher
public CapOptions PowerCap { get; }
public SwitchOption PowerStartsFrom { get; }
public Option Offset { get; }
public Option Limit { get; }
@ -223,6 +227,7 @@ namespace grapher
Smooth.Hide();
ClassicCap.Hide();
PowerCap.Hide();
PowerStartsFrom.Hide();
Offset.Hide();
Limit.Hide();
PowerClassic.Hide();
@ -260,6 +265,7 @@ namespace grapher
args.cap.x,
args.cap.y,
args.capMode);
PowerStartsFrom.SetActiveValue(!args.powerStartFromOne);
Offset.SetActiveValue(args.offset);
DecayRate.SetActiveValue(args.decayRate);
GrowthRate.SetActiveValue(args.growthRate);
@ -322,6 +328,7 @@ namespace grapher
args.cap.y = PowerCap.Out.Field.Data;
args.capMode = PowerCap.CapTypeOptions.GetSelectedCapMode();
}
if (PowerStartsFrom.Visible) args.powerStartFromOne = PowerStartsFrom.Second.Checked;
if (Limit.Visible)
{
if (args.mode == AccelMode.motivity)
@ -362,6 +369,7 @@ namespace grapher
Smooth.AlignActiveValues();
ClassicCap.AlignActiveValues();
PowerCap.AlignActiveValues();
PowerStartsFrom.AlignActiveValues();
Offset.AlignActiveValues();
Limit.AlignActiveValues();
PowerClassic.AlignActiveValues();
@ -403,6 +411,7 @@ namespace grapher
Limit,
PowerClassic,
Exponent,
PowerStartsFrom,
Midpoint,
LutText,
LutPanel,

View file

@ -0,0 +1,162 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace grapher.Models.Options
{
public class SwitchOption : OptionBase
{
#region Constructors
public SwitchOption(
Label label,
CheckBox firstCheckBox,
CheckBox secondCheckBox,
ActiveValueLabel activeValueLabel,
int left)
{
Label = label;
First = firstCheckBox;
Second = secondCheckBox;
ActiveValueLabel = activeValueLabel;
Left = left;
label.AutoSize = false;
label.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
label.Width = First.Left - left - Constants.OptionLabelBoxSeperation;
label.Height = First.Height;
ActiveValueLabel.Height = First.Height;
First.CheckedChanged += OnFirstCheckedChange;
Second.CheckedChanged += OnSecondCheckedChange;
First.Checked = true;
Second.Left = First.Left + First.Width + Constants.OptionLabelBoxSeperation;
Show(string.Empty);
}
#endregion Constructors
#region Properties
public Label Label { get; }
public CheckBox First { get; }
public CheckBox Second { get; }
public ActiveValueLabel ActiveValueLabel { get; }
public override int Height
{
get => Label.Height;
}
public override int Left
{
get => Label.Left;
set
{
Label.Left = value;
}
}
public override bool Visible
{
get => ShouldShow;
}
public override int Width
{
get => Second.Left + Second.Width - Label.Left;
set
{
}
}
public override int Top
{
get => Label.Top;
set
{
Label.Top = value;
First.Top = value;
Second.Top = value;
ActiveValueLabel.Top = value;
}
}
private bool ShouldShow { get; set; }
#endregion Properties
#region Methods
public override void AlignActiveValues()
{
ActiveValueLabel.Align();
}
public override void Hide()
{
ShouldShow = false;
Label.Hide();
First.Hide();
Second.Hide();
ActiveValueLabel.Hide();
}
public override void Show(string name)
{
ShouldShow = true;
if (!string.IsNullOrWhiteSpace(name))
{
Label.Text = name;
}
Label.Show();
First.Show();
Second.Show();
ActiveValueLabel.Show();
}
public void SetActiveValue(bool shouldFirstBeChecked)
{
if (shouldFirstBeChecked)
{
First.Checked = true;
ActiveValueLabel.SetValue(First.Text);
}
else
{
Second.Checked = true;
ActiveValueLabel.SetValue(Second.Text);
}
}
private void OnFirstCheckedChange(object sender, EventArgs e)
{
if (First.Checked)
{
Second.Checked = false;
}
}
private void OnSecondCheckedChange(object sender, EventArgs e)
{
if (Second.Checked)
{
First.Checked = false;
}
}
#endregion Methods
}
}

View file

@ -145,6 +145,7 @@
<Compile Include="Layouts\OptionLayout.cs" />
<Compile Include="Models\Options\OptionBase.cs" />
<Compile Include="Models\Options\OptionXY.cs" />
<Compile Include="Models\Options\SwitchOption.cs" />
<Compile Include="Models\Options\TextOption.cs" />
<Compile Include="Models\Serialized\GUISettings.cs" />
<Compile Include="Models\Serialized\SettingsManager.cs" />

View file

@ -75,6 +75,7 @@ public value struct AccelArgs
double limit;
double midpoint;
double smooth;
bool powerStartFromOne;
[JsonProperty("Cap / Jump")]
Vec2<double> cap;