summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2012-06-23 22:58:57 +0000
committerIan C <ianc@noddybox.co.uk>2012-06-23 22:58:57 +0000
commit3184fb36c4c17f09c4187548ac7c69a9edf77aa2 (patch)
tree46319df7f2e64b72e21dfcc30567374a50fc9347
parentac1b032fa034d6650e1c52cf963e38a6d39a444e (diff)
Added setting to reverse joysticks.
-rw-r--r--wpspec/wpspec/GamePage.xaml.cs32
-rw-r--r--wpspec/wpspec/Resources/Strings.Designer.cs9
-rw-r--r--wpspec/wpspec/Resources/Strings.resx3
-rw-r--r--wpspec/wpspec/Settings.cs12
-rw-r--r--wpspec/wpspec/SettingsPage.xaml8
-rw-r--r--wpspec/wpspec/SettingsPage.xaml.cs10
-rw-r--r--wpspec/wpspec/ViewModels/SettingsViewModel.cs11
7 files changed, 64 insertions, 21 deletions
diff --git a/wpspec/wpspec/GamePage.xaml.cs b/wpspec/wpspec/GamePage.xaml.cs
index 5e483d5..0e5bb7e 100644
--- a/wpspec/wpspec/GamePage.xaml.cs
+++ b/wpspec/wpspec/GamePage.xaml.cs
@@ -111,7 +111,7 @@ namespace wpspec
// Initialise locations for normal and zoomed display
//
location = new Vector2(SharedGraphicsDeviceManager.Current.GraphicsDevice.DisplayMode.Width / 2 - Shared.Spectrum.Width / 2, 10);
- locationZoomed = new Rectangle(SharedGraphicsDeviceManager.Current.GraphicsDevice.DisplayMode.Width / 2 - Shared.Spectrum.Width * 100 / 120, -20,
+ locationZoomed = new Rectangle(SharedGraphicsDeviceManager.Current.GraphicsDevice.DisplayMode.Width / 2 - Shared.Spectrum.Width * 100 / 120, -52,
Shared.Spectrum.Height * 100 / 60, Shared.Spectrum.Width * 100 / 60);
// Reset settings
@@ -149,14 +149,28 @@ namespace wpspec
control.KeyEvent += HandleControlEvent;
- joystick = new JoystickDriver(inputManager,
- SharedGraphicsDeviceManager.Current.GraphicsDevice,
- JoystickType.Digital,
- joystickBackgroundImage, joystickImage, joystickButtonImage,
- new Vector2(0, 490),
- new Vector2(125),
- new Vector2[2] {new Vector2(280, 100), new Vector2(380, 125)},
- 20, 75);
+ if (Settings.Instance.JoystickLeftHanded)
+ {
+ joystick = new JoystickDriver(inputManager,
+ SharedGraphicsDeviceManager.Current.GraphicsDevice,
+ JoystickType.Digital,
+ joystickBackgroundImage, joystickImage, joystickButtonImage,
+ new Vector2(0, 490),
+ new Vector2(350, 125),
+ new Vector2[2] {new Vector2(150, 100), new Vector2(50, 125)},
+ 30, 75);
+ }
+ else
+ {
+ joystick = new JoystickDriver(inputManager,
+ SharedGraphicsDeviceManager.Current.GraphicsDevice,
+ JoystickType.Digital,
+ joystickBackgroundImage, joystickImage, joystickButtonImage,
+ new Vector2(0, 490),
+ new Vector2(125),
+ new Vector2[2] {new Vector2(280, 100), new Vector2(380, 125)},
+ 30, 75);
+ }
joystick.LockType = Settings.Instance.JoystickLock;
diff --git a/wpspec/wpspec/Resources/Strings.Designer.cs b/wpspec/wpspec/Resources/Strings.Designer.cs
index bd74210..8e505a0 100644
--- a/wpspec/wpspec/Resources/Strings.Designer.cs
+++ b/wpspec/wpspec/Resources/Strings.Designer.cs
@@ -452,6 +452,15 @@ namespace wpspec.Resources {
}
/// <summary>
+ /// Looks up a localized string similar to Reserve joystick/buttons.
+ /// </summary>
+ public static string SettingsJoystickLeftHanded {
+ get {
+ return ResourceManager.GetString("SettingsJoystickLeftHanded", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Joystick Lock.
/// </summary>
public static string SettingsJoystickLock {
diff --git a/wpspec/wpspec/Resources/Strings.resx b/wpspec/wpspec/Resources/Strings.resx
index 9c58111..40ec107 100644
--- a/wpspec/wpspec/Resources/Strings.resx
+++ b/wpspec/wpspec/Resources/Strings.resx
@@ -304,4 +304,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
<data name="PokeMemoryValueText" xml:space="preserve">
<value>Value</value>
</data>
+ <data name="SettingsJoystickLeftHanded" xml:space="preserve">
+ <value>Reserve joystick/buttons</value>
+ </data>
</root> \ No newline at end of file
diff --git a/wpspec/wpspec/Settings.cs b/wpspec/wpspec/Settings.cs
index 6c6a06c..e87c071 100644
--- a/wpspec/wpspec/Settings.cs
+++ b/wpspec/wpspec/Settings.cs
@@ -112,6 +112,16 @@ namespace wpspec
}
/// <summary>
+ /// Get/set whether the joystick is left handed.
+ /// </summary>
+ public bool JoystickLeftHanded
+ {
+ get {return joystickLeftHanded.Setting;}
+ set {joystickLeftHanded.Setting = value;}
+ }
+
+
+ /// <summary>
/// Get singleton instance of this class.
/// </summary>
public static Settings Instance
@@ -134,6 +144,7 @@ namespace wpspec
joystickKeyFire1 = new SettingValue<SpectrumKeySymbol>("JoystickKeyFire1", SpectrumKeySymbol.Key0);
joystickKeyFire2 = new SettingValue<SpectrumKeySymbol>("JoystickKeyFire2", SpectrumKeySymbol.Key0);
joystickLock = new SettingValue<JoystickLock>("JoystickLock", JoystickLock.EightWay);
+ joystickLeftHanded = new SettingValue<bool>("JoystickLefthanded", false);
#if DEBUG
tapeUrl = new SettingValue<string>("tapeurl", "http://noddybox.co.uk/spec");
@@ -201,6 +212,7 @@ namespace wpspec
private SettingValue<SpectrumKeySymbol> joystickKeyFire2;
private SettingValue<JoystickLock> joystickLock;
private SettingValue<string> tapeUrl;
+ private SettingValue<bool> joystickLeftHanded;
#endregion
}
diff --git a/wpspec/wpspec/SettingsPage.xaml b/wpspec/wpspec/SettingsPage.xaml
index 9ad95cb..4a3e846 100644
--- a/wpspec/wpspec/SettingsPage.xaml
+++ b/wpspec/wpspec/SettingsPage.xaml
@@ -35,15 +35,19 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
+ <RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<toolkit:ListPicker Header="{Binding SettingsJoystickLock, Source={StaticResource Strings}}"
ItemsSource="{Binding JoystickLockValues, Mode=OneWay}"
SelectedIndex="{Binding JoystickLock, Mode=TwoWay, Converter={StaticResource IntToEnum}}"
Grid.Row="0" />
+ <CheckBox IsChecked="{Binding JoystickLeftHanded, Mode=TwoWay}"
+ Content="{Binding SettingsJoystickLeftHanded, Source={StaticResource Strings}}"
+ Grid.Row="1" />
<CheckBox IsChecked="{Binding KeyboardJoystick, Mode=TwoWay}"
Content="{Binding SettingsKeyboardJoystick, Source={StaticResource Strings}}"
- Grid.Row="1" />
- <Grid Grid.Row="2" Visibility="{Binding KeyboardJoystick, Mode=OneWay, Converter={StaticResource BoolToVisibility}}">
+ Grid.Row="2" />
+ <Grid Grid.Row="3" Visibility="{Binding KeyboardJoystick, Mode=OneWay, Converter={StaticResource BoolToVisibility}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
diff --git a/wpspec/wpspec/SettingsPage.xaml.cs b/wpspec/wpspec/SettingsPage.xaml.cs
index 98854fa..29ca02d 100644
--- a/wpspec/wpspec/SettingsPage.xaml.cs
+++ b/wpspec/wpspec/SettingsPage.xaml.cs
@@ -33,15 +33,5 @@ namespace wpspec
model.JoystickKeyFire1 = SpectrumKeySymbol.Key0;
model.JoystickKeyFire2 = SpectrumKeySymbol.Key0;
}
-
- private void MinerWillyClick(object sender, RoutedEventArgs e)
- {
- model.JoystickKeyLeft = SpectrumKeySymbol.KeyQ;
- model.JoystickKeyUp = SpectrumKeySymbol.KeyEnter;
- model.JoystickKeyDown = SpectrumKeySymbol.KeyEnter;
- model.JoystickKeyRight = SpectrumKeySymbol.KeyW;
- model.JoystickKeyFire1 = SpectrumKeySymbol.KeyEnter;
- model.JoystickKeyFire2 = SpectrumKeySymbol.KeySpace;
- }
}
} \ No newline at end of file
diff --git a/wpspec/wpspec/ViewModels/SettingsViewModel.cs b/wpspec/wpspec/ViewModels/SettingsViewModel.cs
index c7df925..7fb14f8 100644
--- a/wpspec/wpspec/ViewModels/SettingsViewModel.cs
+++ b/wpspec/wpspec/ViewModels/SettingsViewModel.cs
@@ -104,6 +104,17 @@ namespace wpspec.ViewModels
private bool keyboardJoystick = Settings.Instance.KeyboardJoystick;
/// <summary>
+ /// Get/set whether the joystick is left handed.
+ /// </summary>
+ public bool JoystickLeftHanded
+ {
+ get {return joystickLeftHanded;}
+ set {SetValue(ref joystickLeftHanded, value, "JoystickLeftHanded"); Settings.Instance.JoystickLeftHanded = value;}
+ }
+
+ private bool joystickLeftHanded = Settings.Instance.JoystickLeftHanded;
+
+ /// <summary>
/// Get/set the joystick lock type.
/// </summary>
public JoystickLock JoystickLock