Fixed WalkingGameComplete to use MonoGame 3.3 and support 64 bit.

This commit is contained in:
Victor Chelaru 2015-03-18 17:06:26 -06:00
Родитель 3d143ae9d0
Коммит 2859c6759e
18 изменённых файлов: 428 добавлений и 259 удалений

Просмотреть файл

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace WalkingGame.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
private WalkingGame.MainGame game;
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override void FinishedLaunching (UIApplication application)
{
game = new WalkingGame.MainGame();
game.Run();
}
}
}

Просмотреть файл

@ -1,25 +0,0 @@
using System;
using Foundation;
using UIKit;
namespace WalkingGame.iOS
{
[Register ("AppDelegate")]
class Program : UIApplicationDelegate
{
private WalkingGame.Game1 game;
public override void FinishedLaunching (UIApplication app)
{
// Fun begins..
game = new WalkingGame.Game1();
game.Run();
}
static void Main (string [] args)
{
UIApplication.Main (args,null,"AppDelegate");
}
}
}

Просмотреть файл

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>WalkingGame.iOS</string>
<key>CFBundleIdentifier</key>
<string>com.Company.WalkingGame.iOS</string>
<string>com.your-company.WalkingGame.iOS</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
@ -13,12 +13,14 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>7.0</string>
<string>8.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
@ -36,7 +38,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIStatusBarHidden</key>
<true/>
<key>XSAppIconAssets</key>
<string>Resources/Images.xcassets/AppIcons.appiconset</string>
</dict>
</plist>

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace WalkingGame.iOS
{
public class Application
{
// This is the main entry point of the application.
static void Main (string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "AppDelegate");
}
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Просмотреть файл

@ -0,0 +1,108 @@
{
"images": [
{
"size": "29x29",
"scale": "1x",
"idiom": "iphone"
},
{
"size": "29x29",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "29x29",
"scale": "3x",
"idiom": "iphone"
},
{
"size": "40x40",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "40x40",
"scale": "3x",
"idiom": "iphone"
},
{
"size": "57x57",
"scale": "1x",
"idiom": "iphone"
},
{
"size": "57x57",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "60x60",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "60x60",
"scale": "3x",
"idiom": "iphone"
},
{
"size": "29x29",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "29x29",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "40x40",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "40x40",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "50x50",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "50x50",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "72x72",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "72x72",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "76x76",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "76x76",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "120x120",
"scale": "1x",
"idiom": "car"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

Просмотреть файл

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207" />
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1" />
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" />
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder" />
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480" />
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 vchelaru" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines"
minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21" />
<fontDescription key="fontDescription" type="system" pointSize="17" />
<color key="textColor" cocoaTouchSystemColor="darkTextColor" />
<nil key="highlightedColor" />
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="WalkingGame.iOS" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines"
minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43" />
<fontDescription key="fontDescription" type="boldSystem" pointSize="36" />
<color key="textColor" cocoaTouchSystemColor="darkTextColor" />
<nil key="highlightedColor" />
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC" />
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk" />
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l" />
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0" />
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9" />
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g" />
</constraints>
<nil key="simulatedStatusBarMetrics" />
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics" />
<point key="canvasLocation" x="548" y="455" />
</view>
</objects>
</document>

Просмотреть файл

@ -4,13 +4,11 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}</ProjectGuid>
<ProjectGuid>{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>WalkingGame.iOS</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>WalkingGameiOS</AssemblyName>
<TargetFrameworkIdentifier>Xamarin.iOS</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
<AssemblyName>WalkingGame.iOS</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
@ -21,9 +19,10 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>i386</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchProfiling>true</MtouchProfiling>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>full</DebugType>
@ -31,8 +30,9 @@
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<MtouchArch>i386</MtouchArch>
<ConsolePause>false</ConsolePause>
<MtouchLink>None</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
@ -43,14 +43,11 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchDebug>true</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchI18n>
</MtouchI18n>
<MtouchArch>ARMv7</MtouchArch>
<IpaPackageName>
</IpaPackageName>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchProfiling>true</MtouchProfiling>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>full</DebugType>
@ -58,10 +55,10 @@
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
<DebugType>full</DebugType>
@ -70,11 +67,12 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<BuildIpa>true</BuildIpa>
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<IpaIncludeArtwork>true</IpaIncludeArtwork>
<CodesignKey>iPhone Distribution</CodesignKey>
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
<BuildIpa>true</BuildIpa>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<DebugType>full</DebugType>
@ -82,44 +80,47 @@
<OutputPath>bin\iPhone\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Distribution</CodesignKey>
<ConsolePause>false</ConsolePause>
<CodesignProvision>Automatic:AppStore</CodesignProvision>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignProvision>Automatic:AppStore</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Lidgren.Network">
<HintPath>Libraries\Lidgren.Network.dll</HintPath>
</Reference>
<Reference Include="Xamarin.iOS" />
<Reference Include="MonoGame.Framework">
<HintPath>Libraries\MonoGame.Framework.dll</HintPath>
<HintPath>..\packages\MonoGame.Framework.iOS.3.3.0.0\lib\XamariniOS\MonoGame.Framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\Default-568h%402x.png" />
<BundleResource Include="Content\charactersheet.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\Contents.json" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Resources\LaunchScreen.xib" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
<None Include="Libraries\MonoGame.Framework.dll" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="GameMain.cs" />
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\WalkingGame\WalkingGame.csproj">
<Project>{54D38409-0B81-4782-85F8-9CAF5EED8417}</Project>
<Project>{2AE1BAD2-85EB-4560-A852-732A844F1846}</Project>
<Name>WalkingGame</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Content\" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
<BundleResource Include="Content\charactersheet.png" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MonoGame.Framework.iOS" version="3.3.0.0" targetFramework="xamarinios10" />
</packages>

Просмотреть файл

@ -1,9 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WalkingGame.iOS", "WalkingGame.iOS\WalkingGame.iOS.csproj", "{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WalkingGame.iOS", "WalkingGame.iOS\WalkingGame.iOS.csproj", "{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WalkingGame", "WalkingGame\WalkingGame.csproj", "{54D38409-0B81-4782-85F8-9CAF5EED8417}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WalkingGame", "WalkingGame\WalkingGame.csproj", "{2AE1BAD2-85EB-4560-A852-732A844F1846}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -15,32 +15,29 @@ Global
AppStore|iPhone = AppStore|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{54D38409-0B81-4782-85F8-9CAF5EED8417}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{54D38409-0B81-4782-85F8-9CAF5EED8417}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
{54D38409-0B81-4782-85F8-9CAF5EED8417}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{54D38409-0B81-4782-85F8-9CAF5EED8417}.AppStore|iPhone.Build.0 = Release|Any CPU
{54D38409-0B81-4782-85F8-9CAF5EED8417}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{54D38409-0B81-4782-85F8-9CAF5EED8417}.Debug|iPhone.Build.0 = Debug|Any CPU
{54D38409-0B81-4782-85F8-9CAF5EED8417}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{54D38409-0B81-4782-85F8-9CAF5EED8417}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{54D38409-0B81-4782-85F8-9CAF5EED8417}.Release|iPhone.ActiveCfg = Release|Any CPU
{54D38409-0B81-4782-85F8-9CAF5EED8417}.Release|iPhone.Build.0 = Release|Any CPU
{54D38409-0B81-4782-85F8-9CAF5EED8417}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{54D38409-0B81-4782-85F8-9CAF5EED8417}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}.AppStore|iPhone.Build.0 = AppStore|iPhone
{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}.Debug|iPhone.ActiveCfg = Debug|iPhone
{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}.Debug|iPhone.Build.0 = Debug|iPhone
{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}.Release|iPhone.ActiveCfg = Release|iPhone
{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}.Release|iPhone.Build.0 = Release|iPhone
{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = WalkingGame.iOS\WalkingGame.iOS.csproj
{2AE1BAD2-85EB-4560-A852-732A844F1846}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{2AE1BAD2-85EB-4560-A852-732A844F1846}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
{2AE1BAD2-85EB-4560-A852-732A844F1846}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{2AE1BAD2-85EB-4560-A852-732A844F1846}.AppStore|iPhone.Build.0 = Release|Any CPU
{2AE1BAD2-85EB-4560-A852-732A844F1846}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{2AE1BAD2-85EB-4560-A852-732A844F1846}.Debug|iPhone.Build.0 = Debug|Any CPU
{2AE1BAD2-85EB-4560-A852-732A844F1846}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{2AE1BAD2-85EB-4560-A852-732A844F1846}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{2AE1BAD2-85EB-4560-A852-732A844F1846}.Release|iPhone.ActiveCfg = Release|Any CPU
{2AE1BAD2-85EB-4560-A852-732A844F1846}.Release|iPhone.Build.0 = Release|Any CPU
{2AE1BAD2-85EB-4560-A852-732A844F1846}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{2AE1BAD2-85EB-4560-A852-732A844F1846}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}.AppStore|iPhone.Build.0 = AppStore|iPhone
{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}.Debug|iPhone.ActiveCfg = Debug|iPhone
{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}.Debug|iPhone.Build.0 = Debug|iPhone
{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}.Release|iPhone.ActiveCfg = Release|iPhone
{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}.Release|iPhone.Build.0 = Release|iPhone
{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{A879BBF3-2AE5-4DBB-9A02-E5710CE6DC8F}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
EndGlobal

Просмотреть файл

@ -7,9 +7,13 @@ namespace WalkingGame
{
public class Animation
{
List<AnimationFrame> frames = new List<AnimationFrame>();
// The frames in this animation
List<AnimationFrame> frames = new List<AnimationFrame> ();
// The amount of time into the animation
TimeSpan timeIntoAnimation;
// The length of the entire animation
TimeSpan Duration
{
get
@ -24,28 +28,6 @@ namespace WalkingGame
}
}
public void AddFrame(Rectangle rectangle, TimeSpan duration)
{
AnimationFrame newFrame = new AnimationFrame()
{
SourceRectangle = rectangle,
Duration = duration
};
frames.Add(newFrame);
}
public void Update(GameTime gameTime)
{
double secondsIntoAnimation =
timeIntoAnimation.TotalSeconds + gameTime.ElapsedGameTime.TotalSeconds;
double remainder = secondsIntoAnimation % Duration.TotalSeconds;
timeIntoAnimation = TimeSpan.FromSeconds (remainder);
}
public Rectangle CurrentRectangle
{
get
@ -54,7 +36,7 @@ namespace WalkingGame
// See if we can find the frame
TimeSpan accumulatedTime;
foreach(var frame in frames)
foreach (var frame in frames)
{
if (accumulatedTime + frame.Duration >= timeIntoAnimation)
{
@ -85,7 +67,30 @@ namespace WalkingGame
return Rectangle.Empty;
}
}
}
}
// Adds a single frame to this animation.
public void AddFrame (Rectangle rectangle, TimeSpan duration)
{
AnimationFrame newFrame = new AnimationFrame () {
SourceRectangle = rectangle,
Duration = duration
};
frames.Add (newFrame);
}
// Increases the timeIntoAnimation value according to the
// frame time as obtained from gameTime
public void Update (GameTime gameTime)
{
double secondsIntoAnimation =
timeIntoAnimation.TotalSeconds + gameTime.ElapsedGameTime.TotalSeconds;
double remainder = secondsIntoAnimation % Duration.TotalSeconds;
timeIntoAnimation = TimeSpan.FromSeconds (remainder);
}
}
}
}

Просмотреть файл

@ -1,8 +1,7 @@
using System;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Input.Touch;
namespace WalkingGame
{
@ -22,7 +21,6 @@ namespace WalkingGame
Animation currentAnimation;
public float X
{
get;
@ -81,22 +79,54 @@ namespace WalkingGame
standRight = new Animation ();
standRight.AddFrame (new Rectangle (96, 0, 16, 16), TimeSpan.FromSeconds (.25));
}
}
Vector2 GetDesiredVelocityFromInput ()
{
Vector2 desiredVelocity = new Vector2 ();
TouchCollection touchCollection = TouchPanel.GetState ();
if (touchCollection.Count > 0)
{
desiredVelocity.X = touchCollection [0].Position.X - this.X;
desiredVelocity.Y = touchCollection [0].Position.Y - this.Y;
if (desiredVelocity.X != 0 || desiredVelocity.Y != 0)
{
desiredVelocity.Normalize ();
const float desiredSpeed = 200;
desiredVelocity *= desiredSpeed;
}
}
return desiredVelocity;
}
public void Update(GameTime gameTime)
public void Update (GameTime gameTime)
{
var velocity = GetDesiredVelocityFromInput ();
this.X += velocity.X * (float)gameTime.ElapsedGameTime.TotalSeconds;
this.Y += velocity.Y * (float)gameTime.ElapsedGameTime.TotalSeconds;
if (velocity != Vector2.Zero)
// We can use the velocity variable to determine if the
// character is moving or standing still
bool isMoving = velocity != Vector2.Zero;
if (isMoving)
{
bool movingHorizontally = Math.Abs (velocity.X) > Math.Abs (velocity.Y);
if (movingHorizontally)
// If the absolute value of the X component
// is larger than the absolute value of the Y
// component, then that means the character is
// moving horizontally:
bool isMovingHorizontally = Math.Abs (velocity.X) > Math.Abs (velocity.Y);
if (isMovingHorizontally)
{
// No that we know the character is moving horizontally
// we can check if the velocity is positive (moving right)
// or negative (moving left)
if (velocity.X > 0)
{
currentAnimation = walkRight;
@ -108,6 +138,12 @@ namespace WalkingGame
}
else
{
// If the character is not moving horizontally
// then it must be moving vertically. The SpriteBatch
// class treats positive Y as down, so this defines the
// coordinate system for our game. Therefore if
// Y is positive then the character is moving down.
// Otherwise, the character is moving up.
if (velocity.Y > 0)
{
currentAnimation = walkDown;
@ -120,8 +156,14 @@ namespace WalkingGame
}
else
{
// If the character was walking, we can set the standing animation
// according to the walking animation that is playing:
// This else statement contains logic for if the
// character is standing still.
// First we are going to check if the character
// is currently playing any walking animations.
// If so, then we want to switch to a standing animation.
// We want to preserve the direction that the character
// is facing so we'll set the corresponding standing
// animation according to the walking animation being played.
if (currentAnimation == walkRight)
{
currentAnimation = standRight;
@ -138,51 +180,24 @@ namespace WalkingGame
{
currentAnimation = standDown;
}
// If the character is standing still but is not showing
// any animation at all then we'll default to facing down.
else if (currentAnimation == null)
{
currentAnimation = standDown;
}
// if none of the above code hit then the character
// is already standing, so no need to change the animation.
}
currentAnimation.Update (gameTime);
}
}
public void Draw(SpriteBatch spriteBatch)
public void Draw (SpriteBatch spriteBatch)
{
Vector2 topLeftOfSprite = new Vector2 (this.X, this.Y);
Color tintColor = Color.White;
var sourceRectangle = currentAnimation.CurrentRectangle;
spriteBatch.Draw(characterSheetTexture, topLeftOfSprite, sourceRectangle, Color.White);
}
Vector2 GetDesiredVelocityFromInput()
{
Vector2 desiredVelocity = new Vector2 ();
TouchCollection touchCollection = TouchPanel.GetState();
if (touchCollection.Count > 0)
{
desiredVelocity.X = touchCollection [0].Position.X - this.X;
desiredVelocity.Y = touchCollection [0].Position.Y - this.Y;
if (desiredVelocity.X != 0 || desiredVelocity.Y != 0)
{
desiredVelocity.Normalize();
const float desiredSpeed = 200;
desiredVelocity *= desiredSpeed;
}
}
return desiredVelocity;
}
spriteBatch.Draw (characterSheetTexture, topLeftOfSprite, sourceRectangle, Color.White);
}
}
}
}

Просмотреть файл

@ -1,93 +0,0 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace WalkingGame
{
/// <summary>
/// This is the main type for your game
/// </summary>
public class Game1 : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
CharacterEntity character;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
graphics.IsFullScreen = true;
Content.RootDirectory = "Content";
}
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
character = new CharacterEntity (this.GraphicsDevice);
base.Initialize();
}
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
}
/// <summary>
/// UnloadContent will be called once per game and is the place to unload
/// all content.
/// </summary>
protected override void UnloadContent()
{
// TODO: Unload any non ContentManager content here
}
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
character.Update (gameTime);
base.Update(gameTime);
}
/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// We'll start all of our drawing here:
spriteBatch.Begin ();
// Now we can do any entity rendering:
character.Draw(spriteBatch);
// End renders all sprites to the screen:
spriteBatch.End ();
base.Draw(gameTime);
}
}
}

Просмотреть файл

@ -0,0 +1,59 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace WalkingGame
{
public class MainGame : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
CharacterEntity character;
public MainGame()
{
graphics = new GraphicsDeviceManager(this);
graphics.IsFullScreen = true;
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
character = new CharacterEntity (this.GraphicsDevice);
base.Initialize();
}
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
}
protected override void Update(GameTime gameTime)
{
character.Update (gameTime);
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// We'll start all of our drawing here:
spriteBatch.Begin ();
// Now we can do any entity rendering:
character.Draw(spriteBatch);
// End renders all sprites to the screen:
spriteBatch.End ();
base.Draw(gameTime);
}
}
}

Просмотреть файл

@ -4,7 +4,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{54D38409-0B81-4782-85F8-9CAF5EED8417}</ProjectGuid>
<ProjectGuid>{2AE1BAD2-85EB-4560-A852-732A844F1846}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>WalkingGame</RootNamespace>
<AssemblyName>WalkingGame</AssemblyName>
@ -31,10 +31,10 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Game1.cs" />
<Compile Include="CharacterEntity.cs" />
<Compile Include="AnimationFrame.cs" />
<Compile Include="MainGame.cs" />
<Compile Include="Animation.cs" />
<Compile Include="AnimationFrame.cs" />
<Compile Include="CharacterEntity.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<ItemGroup>

Просмотреть файл

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path="../WalkingGame.iOS/packages.config" />
<repository path="../WalkingGame/packages.config" />
</repositories>