зеркало из https://github.com/xamarin/ios-samples.git
Adding WalkingGame MonoGame samples.
This commit is contained in:
Родитель
2e6892b3aa
Коммит
3bc212180f
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<SampleMetadata>
|
||||
<ID>2b89f18d-2da1-4ff5-b810-1f01d22180be</ID>
|
||||
<IsFullApplication>false</IsFullApplication>
|
||||
<Level>Beginning</Level>
|
||||
<LicenseRequirement>Indie</LicenseRequirement>
|
||||
<Tags>Getting Started, Games</Tags>
|
||||
<Gallery>false</Gallery>
|
||||
</SampleMetadata>
|
|
@ -0,0 +1,13 @@
|
|||
MonoGame WalkingGame Project for iOS
|
||||
====================================
|
||||
|
||||
This is a small demo game using MonoGame for iOS. It is the result of working through the the entire Introduction to Monogame walkthrough.
|
||||
|
||||
This single solution contains two projects: one for iOS and one cross-platform portable class library.
|
||||
|
||||
The demo can be played by touching the screen to move the character around the screen.
|
||||
|
||||
Author
|
||||
------
|
||||
|
||||
Victor Chelaru
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 5.1 KiB |
|
@ -0,0 +1,6 @@
|
|||
<?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>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.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");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?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.your-company.WalkingGame.iOS</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>7.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 2.2 KiB |
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<ProjectGuid>{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>WalkingGame.iOS</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>WalkingGameiOS</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<BuildIpa>true</BuildIpa>
|
||||
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\AppStore</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignProvision>Automatic:AppStore</CodesignProvision>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="monotouch" />
|
||||
<Reference Include="Lidgren.Network">
|
||||
<HintPath>..\packages\MonoGame.Binaries.3.2.0\build\MonoTouch\Lidgren.Network.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MonoGame.Framework">
|
||||
<HintPath>..\packages\MonoGame.Binaries.3.2.0\build\MonoTouch\MonoGame.Framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\Default-568h%402x.png" />
|
||||
<BundleResource Include="Content\charactersheet.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GameMain.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
|
||||
<Import Project="..\packages\MonoGame.Binaries.3.2.0\build\MonoTouch\MonoGame.Binaries.targets" Condition="Exists('..\packages\MonoGame.Binaries.3.2.0\build\MonoTouch\MonoGame.Binaries.targets')" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WalkingGame\WalkingGame.csproj">
|
||||
<Project>{54D38409-0B81-4782-85F8-9CAF5EED8417}</Project>
|
||||
<Name>WalkingGame</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Content\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MonoGame" version="3.2.2" targetFramework="MonoTouch10" />
|
||||
<package id="MonoGame.Binaries" version="3.2.0" targetFramework="MonoTouch10" />
|
||||
</packages>
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
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}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WalkingGame", "WalkingGame\WalkingGame.csproj", "{54D38409-0B81-4782-85F8-9CAF5EED8417}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
Debug|iPhone = Debug|iPhone
|
||||
Release|iPhone = Release|iPhone
|
||||
Ad-Hoc|iPhone = Ad-Hoc|iPhone
|
||||
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
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,91 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace WalkingGame
|
||||
{
|
||||
public class Animation
|
||||
{
|
||||
List<AnimationFrame> frames = new List<AnimationFrame>();
|
||||
TimeSpan timeIntoAnimation;
|
||||
|
||||
TimeSpan Duration
|
||||
{
|
||||
get
|
||||
{
|
||||
double totalSeconds = 0;
|
||||
foreach (var frame in frames)
|
||||
{
|
||||
totalSeconds += frame.Duration.TotalSeconds;
|
||||
}
|
||||
|
||||
return TimeSpan.FromSeconds (totalSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
AnimationFrame currentFrame = null;
|
||||
|
||||
// See if we can find the frame
|
||||
TimeSpan accumulatedTime;
|
||||
foreach(var frame in frames)
|
||||
{
|
||||
if (accumulatedTime + frame.Duration >= timeIntoAnimation)
|
||||
{
|
||||
currentFrame = frame;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
accumulatedTime += frame.Duration;
|
||||
}
|
||||
}
|
||||
|
||||
// If no frame was found, then try the last frame,
|
||||
// just in case timeIntoAnimation somehow exceeds Duration
|
||||
if (currentFrame == null)
|
||||
{
|
||||
currentFrame = frames.LastOrDefault ();
|
||||
}
|
||||
|
||||
// If we found a frame, return its rectangle, otherwise
|
||||
// return an empty rectangle (one with no width or height)
|
||||
if (currentFrame != null)
|
||||
{
|
||||
return currentFrame.SourceRectangle;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Rectangle.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace WalkingGame
|
||||
{
|
||||
public class AnimationFrame
|
||||
{
|
||||
public Rectangle SourceRectangle { get; set; }
|
||||
public TimeSpan Duration { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,188 @@
|
|||
using System;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Input.Touch;
|
||||
|
||||
|
||||
namespace WalkingGame
|
||||
{
|
||||
public class CharacterEntity
|
||||
{
|
||||
static Texture2D characterSheetTexture;
|
||||
|
||||
Animation walkDown;
|
||||
Animation walkUp;
|
||||
Animation walkLeft;
|
||||
Animation walkRight;
|
||||
|
||||
Animation standDown;
|
||||
Animation standUp;
|
||||
Animation standLeft;
|
||||
Animation standRight;
|
||||
|
||||
Animation currentAnimation;
|
||||
|
||||
|
||||
public float X
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float Y
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public CharacterEntity (GraphicsDevice graphicsDevice)
|
||||
{
|
||||
if (characterSheetTexture == null)
|
||||
{
|
||||
using (var stream = TitleContainer.OpenStream ("Content/charactersheet.png"))
|
||||
{
|
||||
characterSheetTexture = Texture2D.FromStream (graphicsDevice, stream);
|
||||
}
|
||||
}
|
||||
|
||||
walkDown = new Animation ();
|
||||
walkDown.AddFrame (new Rectangle (0, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
walkDown.AddFrame (new Rectangle (16, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
walkDown.AddFrame (new Rectangle (0, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
walkDown.AddFrame (new Rectangle (32, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
|
||||
walkUp = new Animation ();
|
||||
walkUp.AddFrame (new Rectangle (144, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
walkUp.AddFrame (new Rectangle (160, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
walkUp.AddFrame (new Rectangle (144, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
walkUp.AddFrame (new Rectangle (176, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
|
||||
walkLeft = new Animation ();
|
||||
walkLeft.AddFrame (new Rectangle (48, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
walkLeft.AddFrame (new Rectangle (64, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
walkLeft.AddFrame (new Rectangle (48, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
walkLeft.AddFrame (new Rectangle (80, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
|
||||
walkRight = new Animation ();
|
||||
walkRight.AddFrame (new Rectangle (96, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
walkRight.AddFrame (new Rectangle (112, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
walkRight.AddFrame (new Rectangle (96, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
walkRight.AddFrame (new Rectangle (128, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
|
||||
// Standing animations only have a single frame of animation:
|
||||
standDown = new Animation ();
|
||||
standDown.AddFrame (new Rectangle (0, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
|
||||
standUp = new Animation ();
|
||||
standUp.AddFrame (new Rectangle (144, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
|
||||
standLeft = new Animation ();
|
||||
standLeft.AddFrame (new Rectangle (48, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
|
||||
standRight = new Animation ();
|
||||
standRight.AddFrame (new Rectangle (96, 0, 16, 16), TimeSpan.FromSeconds (.25));
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
bool movingHorizontally = Math.Abs (velocity.X) > Math.Abs (velocity.Y);
|
||||
if (movingHorizontally)
|
||||
{
|
||||
if (velocity.X > 0)
|
||||
{
|
||||
currentAnimation = walkRight;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentAnimation = walkLeft;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (velocity.Y > 0)
|
||||
{
|
||||
currentAnimation = walkDown;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentAnimation = walkUp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the character was walking, we can set the standing animation
|
||||
// according to the walking animation that is playing:
|
||||
if (currentAnimation == walkRight)
|
||||
{
|
||||
currentAnimation = standRight;
|
||||
}
|
||||
else if (currentAnimation == walkLeft)
|
||||
{
|
||||
currentAnimation = standLeft;
|
||||
}
|
||||
else if (currentAnimation == walkUp)
|
||||
{
|
||||
currentAnimation = standUp;
|
||||
}
|
||||
else if (currentAnimation == walkDown)
|
||||
{
|
||||
currentAnimation = standDown;
|
||||
}
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
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,27 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle ("WalkingGame")]
|
||||
[assembly: AssemblyDescription ("")]
|
||||
[assembly: AssemblyConfiguration ("")]
|
||||
[assembly: AssemblyCompany ("")]
|
||||
[assembly: AssemblyProduct ("")]
|
||||
[assembly: AssemblyCopyright ("vchelaru")]
|
||||
[assembly: AssemblyTrademark ("")]
|
||||
[assembly: AssemblyCulture ("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion ("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<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>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>WalkingGame</RootNamespace>
|
||||
<AssemblyName>WalkingGame</AssemblyName>
|
||||
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Game1.cs" />
|
||||
<Compile Include="CharacterEntity.cs" />
|
||||
<Compile Include="AnimationFrame.cs" />
|
||||
<Compile Include="Animation.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="MonoGame.Framework">
|
||||
<HintPath>..\packages\MonoGame-Portable.3.2.1\lib\portable-net45+wp8+win8\MonoGame.Framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MonoGame-Portable" version="3.2.1" targetFramework="portable-net45+win+wp80+MonoAndroid10+MonoTouch10" />
|
||||
</packages>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<repositories>
|
||||
<repository path="../WalkingGame.iOS/packages.config" />
|
||||
<repository path="../WalkingGame/packages.config" />
|
||||
</repositories>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<SampleMetadata>
|
||||
<ID>a96a5a5e-5b0e-479c-b7a1-3c51e456459d</ID>
|
||||
<IsFullApplication>false</IsFullApplication>
|
||||
<Level>Beginning</Level>
|
||||
<LicenseRequirement>Indie</LicenseRequirement>
|
||||
<Tags>Getting Started, Games</Tags>
|
||||
<Gallery>false</Gallery>
|
||||
</SampleMetadata>
|
|
@ -0,0 +1,13 @@
|
|||
MonoGame Empty Project for iOS
|
||||
====================================
|
||||
|
||||
This project serves as a starting-point for MonoGame iOS projects. It is the result of working through the Part 1 - Creating iOS MonoGame Project walkthrough. It is titled WalkingGame as that is the name of the project created by the full Introduction to MonoGame walkthrough.
|
||||
|
||||
This single solution contains two projects: one for iOS and one cross-platform portable class library.
|
||||
|
||||
When executed this project displays only a blue screen.
|
||||
|
||||
Author
|
||||
------
|
||||
|
||||
Victor Chelaru
|
|
@ -0,0 +1,6 @@
|
|||
<?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>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.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");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?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.your-company.WalkingGame.iOS</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>7.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 2.2 KiB |
|
@ -0,0 +1,113 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<ProjectGuid>{7CC2FF72-19DA-4AE8-9A79-EC5781A1A4A1}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>WalkingGame.iOS</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>WalkingGameiOS</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<BuildIpa>true</BuildIpa>
|
||||
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\AppStore</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignProvision>Automatic:AppStore</CodesignProvision>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="monotouch" />
|
||||
<Reference Include="Lidgren.Network">
|
||||
<HintPath>..\packages\MonoGame.Binaries.3.2.0\build\MonoTouch\Lidgren.Network.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MonoGame.Framework">
|
||||
<HintPath>..\packages\MonoGame.Binaries.3.2.0\build\MonoTouch\MonoGame.Framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\Default-568h%402x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GameMain.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
|
||||
<Import Project="..\packages\MonoGame.Binaries.3.2.0\build\MonoTouch\MonoGame.Binaries.targets" Condition="Exists('..\packages\MonoGame.Binaries.3.2.0\build\MonoTouch\MonoGame.Binaries.targets')" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WalkingGame\WalkingGame.csproj">
|
||||
<Project>{54D38409-0B81-4782-85F8-9CAF5EED8417}</Project>
|
||||
<Name>WalkingGame</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MonoGame" version="3.2.2" targetFramework="MonoTouch10" />
|
||||
<package id="MonoGame.Binaries" version="3.2.0" targetFramework="MonoTouch10" />
|
||||
</packages>
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
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}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WalkingGame", "WalkingGame\WalkingGame.csproj", "{54D38409-0B81-4782-85F8-9CAF5EED8417}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
Debug|iPhone = Debug|iPhone
|
||||
Release|iPhone = Release|iPhone
|
||||
Ad-Hoc|iPhone = Ad-Hoc|iPhone
|
||||
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
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,82 @@
|
|||
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;
|
||||
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
// TODO: Add your initialization logic here
|
||||
|
||||
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);
|
||||
|
||||
// TODO: use this.Content to load your game content here
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
// TODO: Add your update logic here
|
||||
|
||||
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);
|
||||
|
||||
// TODO: Add your drawing code here
|
||||
|
||||
base.Draw(gameTime);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle ("WalkingGame")]
|
||||
[assembly: AssemblyDescription ("")]
|
||||
[assembly: AssemblyConfiguration ("")]
|
||||
[assembly: AssemblyCompany ("")]
|
||||
[assembly: AssemblyProduct ("")]
|
||||
[assembly: AssemblyCopyright ("vchelaru")]
|
||||
[assembly: AssemblyTrademark ("")]
|
||||
[assembly: AssemblyCulture ("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion ("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<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>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>WalkingGame</RootNamespace>
|
||||
<AssemblyName>WalkingGame</AssemblyName>
|
||||
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Game1.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="MonoGame.Framework">
|
||||
<HintPath>..\packages\MonoGame-Portable.3.2.1\lib\portable-net45+wp8+win8\MonoGame.Framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MonoGame-Portable" version="3.2.1" targetFramework="portable-net45+win+wp80+MonoAndroid10+MonoTouch10" />
|
||||
</packages>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<repositories>
|
||||
<repository path="../WalkingGame.iOS/packages.config" />
|
||||
<repository path="../WalkingGame/packages.config" />
|
||||
</repositories>
|
Загрузка…
Ссылка в новой задаче