diff options
author | Ian C <ianc@noddybox.co.uk> | 2012-06-20 23:16:18 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2012-06-20 23:16:18 +0000 |
commit | ac1b032fa034d6650e1c52cf963e38a6d39a444e (patch) | |
tree | 4eec9769cc6551d9a97cf8c97c562365e49d1497 | |
parent | 3031fa3787c9d0faf53880f360084c4504dcff91 (diff) |
Added Poke Memory page
-rw-r--r-- | wpspec/wpspec/GamePage.xaml.cs | 4 | ||||
-rw-r--r-- | wpspec/wpspec/PokeMemoryPage.xaml | 72 | ||||
-rw-r--r-- | wpspec/wpspec/PokeMemoryPage.xaml.cs | 65 | ||||
-rw-r--r-- | wpspec/wpspec/Resources/Strings.Designer.cs | 36 | ||||
-rw-r--r-- | wpspec/wpspec/Resources/Strings.resx | 12 | ||||
-rw-r--r-- | wpspec/wpspec/wpspec.csproj | 7 |
6 files changed, 193 insertions, 3 deletions
diff --git a/wpspec/wpspec/GamePage.xaml.cs b/wpspec/wpspec/GamePage.xaml.cs index 6932bdd..5e483d5 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, 10,
+ locationZoomed = new Rectangle(SharedGraphicsDeviceManager.Current.GraphicsDevice.DisplayMode.Width / 2 - Shared.Spectrum.Width * 100 / 120, -20,
Shared.Spectrum.Height * 100 / 60, Shared.Spectrum.Width * 100 / 60);
// Reset settings
@@ -232,8 +232,6 @@ namespace wpspec {
Shared.Spectrum.Run();
Shared.Spectrum.Run();
- Shared.Spectrum.Run();
- Shared.Spectrum.Run();
}
}
diff --git a/wpspec/wpspec/PokeMemoryPage.xaml b/wpspec/wpspec/PokeMemoryPage.xaml new file mode 100644 index 0000000..2e95083 --- /dev/null +++ b/wpspec/wpspec/PokeMemoryPage.xaml @@ -0,0 +1,72 @@ +<phone:PhoneApplicationPage
+ x:Class="wpspec.PokeMemoryPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
+ xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:res="clr-namespace:wpspec.Resources"
+ FontFamily="{StaticResource PhoneFontFamilyNormal}"
+ FontSize="{StaticResource PhoneFontSizeNormal}"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+ SupportedOrientations="Portrait" Orientation="Portrait"
+ mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480"
+ shell:SystemTray.IsVisible="False">
+
+ <phone:PhoneApplicationPage.Resources>
+ <res:Strings x:Key="Strings" />
+ </phone:PhoneApplicationPage.Resources>
+
+ <!--LayoutRoot is the root grid where all page content is placed-->
+ <Grid x:Name="LayoutRoot" Background="Transparent">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="*"/>
+ </Grid.RowDefinitions>
+
+ <!--TitlePanel contains the name of the application and page title-->
+ <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
+ <TextBlock x:Name="ApplicationTitle"
+ Text="{Binding AppTitle, Source={StaticResource Strings}}"
+ Style="{StaticResource PhoneTextNormalStyle}"/>
+ <TextBlock x:Name="PageTitle"
+ Text="{Binding PokeMemoryTitleText, Source={StaticResource Strings}}"
+ Margin="9,-7,0,0"
+ Style="{StaticResource PhoneTextTitle1Style}"/>
+ </StackPanel>
+
+ <!--ContentPanel - place additional content here-->
+ <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0" VerticalAlignment="Top">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="auto" />
+ <RowDefinition Height="auto" />
+ <RowDefinition Height="auto" />
+ </Grid.RowDefinitions>
+
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="1*" />
+ <ColumnDefinition Width="1*" />
+ </Grid.ColumnDefinitions>
+
+ <TextBlock Text="{Binding PokeMemoryAddressText, Source={StaticResource Strings}}"
+ Grid.Row="0" Grid.Column="0" />
+ <TextBlock Text="{Binding PokeMemoryValueText, Source={StaticResource Strings}}"
+ Grid.Row="0" Grid.Column="1" />
+
+ <TextBox x:Name="addressText" MaxLength="5" InputScope="Number"
+ Grid.Row="1" Grid.Column="0" />
+ <TextBox x:Name="valueText" MaxLength="5" InputScope="Number"
+ Grid.Row="1" Grid.Column="1" />
+
+ <Button Height="120"
+ Content="{Binding PokeMemoryPokeButton, Source={StaticResource Strings}}"
+ Grid.Row="2" Grid.ColumnSpan="2"
+ Background="Black"
+ Click="PokeClick">
+ </Button>
+
+ </Grid>
+ </Grid>
+
+</phone:PhoneApplicationPage>
diff --git a/wpspec/wpspec/PokeMemoryPage.xaml.cs b/wpspec/wpspec/PokeMemoryPage.xaml.cs new file mode 100644 index 0000000..33b5a9d --- /dev/null +++ b/wpspec/wpspec/PokeMemoryPage.xaml.cs @@ -0,0 +1,65 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using Microsoft.Phone.Controls;
+using Noddybox.Emulation.EightBit;
+
+namespace wpspec
+{
+ public partial class PokeMemoryPage : PhoneApplicationPage
+ {
+ public PokeMemoryPage()
+ {
+ InitializeComponent();
+ }
+
+ private void PokeClick(object sender, RoutedEventArgs e)
+ {
+ int address;
+ int value;
+ bool ok = true;
+
+ if (int.TryParse(addressText.Text, out address) && (address >= 0) && (address < 0x10000))
+ {
+ addressText.Background = (SolidColorBrush)Resources["PhoneTextBoxBrush"];
+ }
+ else
+ {
+ addressText.Background = (SolidColorBrush)Resources["PhoneAccentBrush"];
+ ok = false;
+ }
+
+ if (int.TryParse(valueText.Text, out value) && (value >= 0) && (value < 0x100))
+ {
+ valueText.Background = (SolidColorBrush)Resources["PhoneTextBoxBrush"];
+ }
+ else
+ {
+ valueText.Background = (SolidColorBrush)Resources["PhoneAccentBrush"];
+ ok = false;
+ }
+
+ if (!ok)
+ {
+ return;
+ }
+
+ IMemory memory = Shared.Spectrum;
+
+ memory.Write((ushort)address, (byte)value);
+
+ address = (address+1) % 0x10000;
+
+ addressText.Text = address.ToString();
+ }
+
+ }
+}
\ No newline at end of file diff --git a/wpspec/wpspec/Resources/Strings.Designer.cs b/wpspec/wpspec/Resources/Strings.Designer.cs index 26f924b..bd74210 100644 --- a/wpspec/wpspec/Resources/Strings.Designer.cs +++ b/wpspec/wpspec/Resources/Strings.Designer.cs @@ -263,6 +263,15 @@ namespace wpspec.Resources { }
/// <summary>
+ /// Looks up a localized string similar to Address.
+ /// </summary>
+ public static string PokeMemoryAddressText {
+ get {
+ return ResourceManager.GetString("PokeMemoryAddressText", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Poke Memory.
/// </summary>
public static string PokeMemoryButtonText {
@@ -272,6 +281,33 @@ namespace wpspec.Resources { }
/// <summary>
+ /// Looks up a localized string similar to Poke!.
+ /// </summary>
+ public static string PokeMemoryPokeButton {
+ get {
+ return ResourceManager.GetString("PokeMemoryPokeButton", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Poke Memory.
+ /// </summary>
+ public static string PokeMemoryTitleText {
+ get {
+ return ResourceManager.GetString("PokeMemoryTitleText", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Value.
+ /// </summary>
+ public static string PokeMemoryValueText {
+ get {
+ return ResourceManager.GetString("PokeMemoryValueText", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Failed to fetch tape; got error - "{0}".
/// </summary>
public static string RemoteTapeFetchFailed {
diff --git a/wpspec/wpspec/Resources/Strings.resx b/wpspec/wpspec/Resources/Strings.resx index 3c5cbe0..9c58111 100644 --- a/wpspec/wpspec/Resources/Strings.resx +++ b/wpspec/wpspec/Resources/Strings.resx @@ -292,4 +292,16 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY <data name="SettingsKeyUp" xml:space="preserve">
<value>Up</value>
</data>
+ <data name="PokeMemoryAddressText" xml:space="preserve">
+ <value>Address</value>
+ </data>
+ <data name="PokeMemoryPokeButton" xml:space="preserve">
+ <value>Poke!</value>
+ </data>
+ <data name="PokeMemoryTitleText" xml:space="preserve">
+ <value>Poke Memory</value>
+ </data>
+ <data name="PokeMemoryValueText" xml:space="preserve">
+ <value>Value</value>
+ </data>
</root>
\ No newline at end of file diff --git a/wpspec/wpspec/wpspec.csproj b/wpspec/wpspec/wpspec.csproj index 88e1790..0e53113 100644 --- a/wpspec/wpspec/wpspec.csproj +++ b/wpspec/wpspec/wpspec.csproj @@ -100,6 +100,9 @@ <Compile Include="OpenRemoteTapePage.xaml.cs">
<DependentUpon>OpenRemoteTapePage.xaml</DependentUpon>
</Compile>
+ <Compile Include="PokeMemoryPage.xaml.cs">
+ <DependentUpon>PokeMemoryPage.xaml</DependentUpon>
+ </Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="GamePage.xaml.cs">
<DependentUpon>GamePage.xaml</DependentUpon>
@@ -168,6 +171,10 @@ <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="PokeMemoryPage.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="SaveLocalTapePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
|