mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2025-02-10 14:36:09 +08:00
Added invert mouse option.
This commit is contained in:
parent
c9fb099db7
commit
4cbf85bd03
@ -190,6 +190,9 @@
|
||||
<setting name="XInputMoveSpeed" serializeAs="String">
|
||||
<value>15</value>
|
||||
</setting>
|
||||
<setting name="MouseInvert" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
</CodeWalker.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
@ -44,6 +44,7 @@ namespace CodeWalker.Forms
|
||||
int MouseY;
|
||||
System.Drawing.Point MouseDownPoint;
|
||||
System.Drawing.Point MouseLastPoint;
|
||||
bool MouseInvert = Settings.Default.MouseInvert;
|
||||
|
||||
|
||||
|
||||
@ -1051,6 +1052,11 @@ namespace CodeWalker.Forms
|
||||
int dx = e.X - MouseX;
|
||||
int dy = e.Y - MouseY;
|
||||
|
||||
if (MouseInvert)
|
||||
{
|
||||
dy = -dy;
|
||||
}
|
||||
|
||||
if (MouseLButtonDown)
|
||||
{
|
||||
camera.MouseRotate(dx, dy);
|
||||
|
12
Properties/Settings.Designer.cs
generated
12
Properties/Settings.Designer.cs
generated
@ -686,5 +686,17 @@ namespace CodeWalker.Properties {
|
||||
this["XInputMoveSpeed"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool MouseInvert {
|
||||
get {
|
||||
return ((bool)(this["MouseInvert"]));
|
||||
}
|
||||
set {
|
||||
this["MouseInvert"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,5 +180,8 @@
|
||||
<Setting Name="XInputMoveSpeed" Type="System.Single" Scope="User">
|
||||
<Value Profile="(Default)">15</Value>
|
||||
</Setting>
|
||||
<Setting Name="MouseInvert" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
18
SettingsForm.Designer.cs
generated
18
SettingsForm.Designer.cs
generated
@ -80,6 +80,7 @@
|
||||
this.SaveButton = new System.Windows.Forms.Button();
|
||||
this.ResetButton = new System.Windows.Forms.Button();
|
||||
this.FolderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.MouseInvertCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.MainTabControl.SuspendLayout();
|
||||
this.ControlsTabPage.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
@ -126,6 +127,7 @@
|
||||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Controls.Add(this.MouseInvertCheckBox);
|
||||
this.groupBox2.Controls.Add(this.label4);
|
||||
this.groupBox2.Controls.Add(this.label3);
|
||||
this.groupBox2.Controls.Add(this.label2);
|
||||
@ -141,7 +143,7 @@
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(242, 30);
|
||||
this.label4.Location = new System.Drawing.Point(237, 17);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(181, 26);
|
||||
this.label4.TabIndex = 8;
|
||||
@ -317,7 +319,7 @@
|
||||
this.AdvancedTabPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.AdvancedTabPage.Name = "AdvancedTabPage";
|
||||
this.AdvancedTabPage.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.AdvancedTabPage.Size = new System.Drawing.Size(452, 404);
|
||||
this.AdvancedTabPage.Size = new System.Drawing.Size(452, 425);
|
||||
this.AdvancedTabPage.TabIndex = 1;
|
||||
this.AdvancedTabPage.Text = "Advanced";
|
||||
this.AdvancedTabPage.UseVisualStyleBackColor = true;
|
||||
@ -783,6 +785,17 @@
|
||||
this.ResetButton.UseVisualStyleBackColor = true;
|
||||
this.ResetButton.Click += new System.EventHandler(this.ResetButton_Click);
|
||||
//
|
||||
// MouseInvertCheckBox
|
||||
//
|
||||
this.MouseInvertCheckBox.AutoSize = true;
|
||||
this.MouseInvertCheckBox.Location = new System.Drawing.Point(240, 55);
|
||||
this.MouseInvertCheckBox.Name = "MouseInvertCheckBox";
|
||||
this.MouseInvertCheckBox.Size = new System.Drawing.Size(118, 17);
|
||||
this.MouseInvertCheckBox.TabIndex = 9;
|
||||
this.MouseInvertCheckBox.Text = "Invert mouse Y axis";
|
||||
this.MouseInvertCheckBox.UseVisualStyleBackColor = true;
|
||||
this.MouseInvertCheckBox.CheckedChanged += new System.EventHandler(this.MouseInvertCheckBox_CheckedChanged);
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -871,5 +884,6 @@
|
||||
private System.Windows.Forms.Label label20;
|
||||
private System.Windows.Forms.NumericUpDown TextureCacheSizeUpDown;
|
||||
private System.Windows.Forms.Label label21;
|
||||
private System.Windows.Forms.CheckBox MouseInvertCheckBox;
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@ namespace CodeWalker
|
||||
|
||||
private float camSensitivity = Settings.Default.CameraSensitivity;
|
||||
private float camSmoothing = Settings.Default.CameraSmoothing;
|
||||
|
||||
private bool mouseinvert = Settings.Default.MouseInvert;
|
||||
|
||||
|
||||
public SettingsForm(WorldForm owner)
|
||||
@ -67,6 +67,7 @@ namespace CodeWalker
|
||||
{
|
||||
CameraSensitivityUpDown.Value = (decimal)camSensitivity * 1000;
|
||||
CameraSmoothingUpDown.Value = (decimal)camSmoothing;
|
||||
MouseInvertCheckBox.Checked = mouseinvert;
|
||||
}
|
||||
private void LoadAdvancedSettings()
|
||||
{
|
||||
@ -203,6 +204,16 @@ namespace CodeWalker
|
||||
}
|
||||
}
|
||||
|
||||
private void MouseInvertCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
mouseinvert = MouseInvertCheckBox.Checked;
|
||||
Settings.Default.MouseInvert = mouseinvert;
|
||||
if (worldForm != null)
|
||||
{
|
||||
worldForm.SetMouseInverted(mouseinvert);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
//apply and save the settings.
|
||||
|
10
WorldForm.cs
10
WorldForm.cs
@ -71,6 +71,7 @@ namespace CodeWalker
|
||||
int MouseControlWheel = 0;
|
||||
MouseButtons MouseControlButtons = MouseButtons.None;
|
||||
MouseButtons MouseControlButtonsPrev = MouseButtons.None;
|
||||
bool MouseInvert = Settings.Default.MouseInvert;
|
||||
|
||||
bool ControlFireToggle = false;
|
||||
|
||||
@ -1709,6 +1710,10 @@ namespace CodeWalker
|
||||
camera.Sensitivity = sensitivity;
|
||||
camera.Smoothness = smoothing;
|
||||
}
|
||||
public void SetMouseInverted(bool invert)
|
||||
{
|
||||
MouseInvert = invert;
|
||||
}
|
||||
|
||||
public void SetKeyBindings(KeyBindings kb)
|
||||
{
|
||||
@ -5540,6 +5545,11 @@ namespace CodeWalker
|
||||
int dx = e.X - MouseX;
|
||||
int dy = e.Y - MouseY;
|
||||
|
||||
if (MouseInvert)
|
||||
{
|
||||
dy = -dy;
|
||||
}
|
||||
|
||||
if (ControlMode == WorldControlMode.Free)
|
||||
{
|
||||
if (MouseLButtonDown)
|
||||
|
Loading…
Reference in New Issue
Block a user