Increase precision when tweaking axis sens./deadzone (resolves #3038)

not sure how you trigger `LargeChange` but I set a value anyway
This commit is contained in:
YoshiRulz 2022-05-07 22:29:31 +10:00
parent 5f820cc530
commit b4ca2f9de8
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 18 additions and 14 deletions

View File

@ -59,13 +59,13 @@
//
// trackBarSensitivity
//
this.trackBarSensitivity.LargeChange = 20;
this.trackBarSensitivity.LargeChange = 4;
this.trackBarSensitivity.Location = new System.Drawing.Point(267, 21);
this.trackBarSensitivity.Maximum = 20;
this.trackBarSensitivity.Minimum = -20;
this.trackBarSensitivity.Maximum = 40;
this.trackBarSensitivity.Minimum = -40;
this.trackBarSensitivity.Name = "trackBarSensitivity";
this.trackBarSensitivity.Size = new System.Drawing.Size(104, 45);
this.trackBarSensitivity.SmallChange = 10;
this.trackBarSensitivity.Size = new System.Drawing.Size(160, 45);
this.trackBarSensitivity.SmallChange = 1;
this.trackBarSensitivity.TabIndex = 2;
this.trackBarSensitivity.TickFrequency = 10;
this.trackBarSensitivity.ValueChanged += new System.EventHandler(this.TrackBarSensitivity_ValueChanged);
@ -92,11 +92,15 @@
//
// trackBarDeadzone
//
this.trackBarDeadzone.LargeChange = 5;
this.trackBarDeadzone.Location = new System.Drawing.Point(267, 51);
this.trackBarDeadzone.Maximum = 25;
this.trackBarDeadzone.Minimum = 0;
this.trackBarDeadzone.Name = "trackBarDeadzone";
this.trackBarDeadzone.Size = new System.Drawing.Size(104, 45);
this.trackBarDeadzone.Size = new System.Drawing.Size(160, 45);
this.trackBarDeadzone.SmallChange = 1;
this.trackBarDeadzone.TabIndex = 5;
this.trackBarDeadzone.TickFrequency = 2;
this.trackBarDeadzone.TickFrequency = 5;
this.trackBarDeadzone.ValueChanged += new System.EventHandler(this.TrackBarDeadzone_ValueChanged);
//
// labelDeadzone
@ -139,7 +143,7 @@
this.Controls.Add(this.labelButtonName);
this.Controls.Add(this.textBox1);
this.Name = "AnalogBindControl";
this.Size = new System.Drawing.Size(378, 99);
this.Size = new System.Drawing.Size(434, 99);
((System.ComponentModel.ISupportInitialize)(this.trackBarSensitivity)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBarDeadzone)).EndInit();
this.ResumeLayout(false);

View File

@ -18,8 +18,8 @@ namespace BizHawk.Client.EmuHawk
_bind = bind;
ButtonName = buttonName;
labelButtonName.Text = buttonName;
trackBarSensitivity.Value = (int)(bind.Mult * 10.0f);
trackBarDeadzone.Value = (int)(bind.Deadzone * 20.0f);
trackBarSensitivity.Value = (int) Math.Round(bind.Mult * 20.0);
trackBarDeadzone.Value = (int) Math.Round(bind.Deadzone * 50.0);
TrackBarSensitivity_ValueChanged(null, null);
TrackBarDeadzone_ValueChanged(null, null);
textBox1.Text = bind.Value;
@ -65,14 +65,14 @@ namespace BizHawk.Client.EmuHawk
private void TrackBarSensitivity_ValueChanged(object sender, EventArgs e)
{
_bind.Mult = trackBarSensitivity.Value / 10.0f;
labelSensitivity.Text = $"Sensitivity: {Bind.Mult * 100}%";
_bind.Mult = trackBarSensitivity.Value / 20.0f;
labelSensitivity.Text = $"Sensitivity: {_bind.Mult:P0}";
}
private void TrackBarDeadzone_ValueChanged(object sender, EventArgs e)
{
_bind.Deadzone = trackBarDeadzone.Value / 20.0f;
labelDeadzone.Text = $"Deadzone: {Bind.Deadzone * 100}%";
_bind.Deadzone = trackBarDeadzone.Value / 50.0f;
labelDeadzone.Text = $"Deadzone: {_bind.Deadzone:P0}";
}
private void ButtonFlip_Click(object sender, EventArgs e)