Skip to content

Commit

Permalink
Great Samples reorganization, part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
espes committed Mar 27, 2012
1 parent c48aa26 commit 3e20546
Show file tree
Hide file tree
Showing 64 changed files with 500 additions and 263 deletions.
6 changes: 4 additions & 2 deletions BouncingBox/MonoGame.Samples.BouncingBox.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<DefineConstants>IPHONE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
Expand All @@ -33,13 +33,14 @@
<MtouchI18n />
<MtouchUseArmv7>false</MtouchUseArmv7>
<AssemblyName>BouncingBox</AssemblyName>
<DefineConstants>IPHONE;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<DefineConstants>IPHONE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
Expand All @@ -60,6 +61,7 @@
<MtouchSdkVersion>4.0</MtouchSdkVersion>
<MtouchUseArmv7>false</MtouchUseArmv7>
<AssemblyName>BouncingBox</AssemblyName>
<DefineConstants>IPHONE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>none</DebugType>
Expand Down
27 changes: 26 additions & 1 deletion BouncingBox/main.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#if MONOMAC
using MonoMac.AppKit;
using MonoMac.Foundation;
#elif IPHONE
using MonoTouch.Foundation;
using MonoTouch.UIKit;
#endif

namespace Microsoft.Xna.Samples.BouncingBox
{
#if MONOMAC
class Program
{
static void Main (string[] args)
Expand Down Expand Up @@ -35,5 +41,24 @@ public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplicat
{
return true;
}
}
}
#elif IPHONE
[Register ("AppDelegate")]
class Program : UIApplicationDelegate
{
private Game1 game;

public override void FinishedLaunching (UIApplication app)
{
// Fun begins..
game = new Game1();
game.Run();
}

static void Main (string [] args)
{
UIApplication.Main (args,null,"AppDelegate");
}
}
#endif
}
2 changes: 1 addition & 1 deletion CatapaultWars/CatapaultGame.MacOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG; MACOS</DefineConstants>
<DefineConstants>DEBUG; MONOMAC</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
Expand Down
2 changes: 1 addition & 1 deletion CatapaultWars/CatapultGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public CatapultGame()
screenManager = new ScreenManager(this);
Components.Add(screenManager);
IsMouseVisible = true;
#if !WINDOWS && !XBOX && !MACOS
#if !WINDOWS && !XBOX && !MONOMAC
//Switch to full screen for best game experience
graphics.IsFullScreen = true;
#endif
Expand Down
8 changes: 5 additions & 3 deletions CatapaultWars/MonoGame.Samples.CatapultWars.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG; IOS</DefineConstants>
<DefineConstants>DEBUG; IPHONE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
Expand Down Expand Up @@ -65,7 +65,9 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<None Include="Info.iOS.plist"><Link>Info.plist</Link></None>
<None Include="Info.iOS.plist">
<Link>Info.plist</Link>
</None>
<None Include="Content\Fonts\HUDFont.xnb">
<Link>Content\Fonts\HUDFont.xnb</Link>
</None>
Expand Down Expand Up @@ -140,7 +142,6 @@
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="CatapultGame.cs">
<Link>CatapultGame.cs</Link>
</Compile>
Expand Down Expand Up @@ -201,6 +202,7 @@
<Compile Include="Utility\AudioManager.cs">
<Link>Utility\AudioManager.cs</Link>
</Compile>
<Compile Include="Program.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down
29 changes: 28 additions & 1 deletion CatapaultWars/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

#region Using Statements
using System;

#if IPHONE
using MonoTouch.Foundation;
using MonoTouch.UIKit;
#endif

#endregion

namespace CatapultGame
Expand All @@ -27,7 +33,7 @@ static void Main(string[] args)
}
}
}
#elif MACOS
#elif MONOMAC


static class Program
Expand Down Expand Up @@ -61,6 +67,27 @@ public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.Ap
return true;
}
}
#elif IPHONE
[Register ("AppDelegate")]
class Program : UIApplicationDelegate
{
private CatapultGame game;

public override void FinishedLaunching (UIApplication app)
{
// Fun begins..
game = new CatapultGame();
game.Run();
}

// 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");
}
}
#endif

}
Expand Down
2 changes: 1 addition & 1 deletion CatapaultWars/Screens/GameplayScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public GameplayScreen()
public override void LoadContent()
{
base.LoadContent();
#if ANDROID || IOS
#if ANDROID || IPHONE
LoadAssets();
#endif
// Start the game
Expand Down
18 changes: 9 additions & 9 deletions CatapaultWars/Screens/InstructionsScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
using GameStateManagement;
using Microsoft.Xna.Framework.Input.Touch;

#if MACOS
#if MONOMAC
using MonoMac.AppKit;
using MonoMac.Foundation;
#endif

#if IOS
#if IPHONE
using MonoTouch.UIKit;
using MonoTouch.Foundation;
#endif
Expand Down Expand Up @@ -81,7 +81,7 @@ public override void Update (GameTime gameTime, bool otherScreenHasFocus, bool c
public override void HandleInput (InputState input)
{
if (isLoading == true) {
#if ANDROID || IOS
#if ANDROID || IPHONE
// Exit the screen and show the gameplay screen
// with pre-loaded assets
ExitScreen ();
Expand All @@ -100,7 +100,7 @@ public override void HandleInput (InputState input)
gameplayScreen.ScreenManager = ScreenManager;

// Start loading the resources in additional thread
#if MACOS
#if MONOMAC
// create a new thread using BackgroundWorkerThread as method to execute
thread = new Thread (LoadAssetsWorkerThread as ThreadStart);
#else
Expand All @@ -118,7 +118,7 @@ public override void HandleInput (InputState input)
gameplayScreen = new GameplayScreen ();
gameplayScreen.ScreenManager = ScreenManager;

#if ANDROID || IOS
#if ANDROID || IPHONE
isLoading = true;
#else
// Start loading the resources in additional thread
Expand All @@ -136,22 +136,22 @@ public override void HandleInput (InputState input)
void LoadAssetsWorkerThread ()
{

#if MACOS || IOS
#if MONOMAC || IPHONE
// Create an Autorelease Pool or we will leak objects.
using (var pool = new NSAutoreleasePool()) {
#else

#endif
// Make sure we invoke this on the Main Thread or OpenGL will throw an error
#if MACOS
#if MONOMAC
MonoMac.AppKit.NSApplication.SharedApplication.BeginInvokeOnMainThread (delegate {
#endif
#if IOS
#if IPHONE
var invokeOnMainThredObj = new NSObject();
invokeOnMainThredObj.InvokeOnMainThread(delegate {
#endif
gameplayScreen.LoadAssets ();
#if MACOS || IOS
#if MONOMAC || IPHONE
});

}
Expand Down
2 changes: 1 addition & 1 deletion CatapultNetWars/CatapultGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public CatapultGame ()
NetworkSession.InviteAccepted += (sender, e) => NetworkSessionComponent.InviteAccepted (screenManager, e);

IsMouseVisible = true;
#if !WINDOWS && !XBOX && !MACOS && !LINUX
#if !WINDOWS && !XBOX && !MONOMAC && !LINUX
//Switch to full screen for best game experience
graphics.IsFullScreen = true;
#else
Expand Down
2 changes: 1 addition & 1 deletion CatapultNetWars/CatapultNetWars.MacOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG; MACOS</DefineConstants>
<DefineConstants>DEBUG; MONOMAC</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
Expand Down
14 changes: 9 additions & 5 deletions CatapultNetWars/MonoGame.Samples.CatapultNetWars.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;IOS</DefineConstants>
<DefineConstants>DEBUG;IPHONE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
Expand All @@ -33,13 +33,14 @@
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchLink>None</MtouchLink>
<DefineConstants>IPHONE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<DefineConstants>DEBUG;IPHONE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
Expand All @@ -55,6 +56,7 @@
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<DefineConstants>IPHONE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand All @@ -65,7 +67,9 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<None Include="Info.iOS.plist"><Link>Info.plist</Link></None>
<None Include="Info.iOS.plist">
<Link>Info.plist</Link>
</None>
<None Include="Resources.resources">
<Link>Resources.resources</Link>
</None>
Expand All @@ -74,7 +78,6 @@
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="CatapultGame.cs">
<Link>CatapultGame.cs</Link>
</Compile>
Expand Down Expand Up @@ -177,6 +180,7 @@
<Compile Include="Resources.Designer.cs">
<Link>Resources.Designer.cs</Link>
</Compile>
<Compile Include="Program.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
Expand Down Expand Up @@ -305,7 +309,7 @@
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\MonoGame.Framework\MonoGame.Framework.iOS.csproj">
<ProjectReference Include="..\..\MonoGame.Framework\MonoGame.Framework.iOS.csproj">
<Project>{DB8508BB-9849-4CC2-BC0F-8EB5DACB3C47}</Project>
<Name>MonoGame.Framework.iOS</Name>
</ProjectReference>
Expand Down
31 changes: 28 additions & 3 deletions CatapultNetWars/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@

#region Using Statements
using System;

#if IPHONE
using MonoTouch.Foundation;
using MonoTouch.UIKit;
#endif

#endregion

namespace CatapultGame
Expand All @@ -27,9 +33,7 @@ static void Main(string[] args)
}
}
}
#elif MACOS


#elif MONOMAC
static class Program
{
/// <summary>
Expand Down Expand Up @@ -60,6 +64,27 @@ public override bool ApplicationShouldTerminateAfterLastWindowClosed (MonoMac.Ap
return true;
}
}
#elif IPHONE
[Register ("AppDelegate")]
class Program : UIApplicationDelegate
{
private CatapultGame game;

public override void FinishedLaunching (UIApplication app)
{
// Fun begins..
game = new CatapultGame();
game.Run();
}

// 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");
}
}
#endif

}
Expand Down
Loading

0 comments on commit 3e20546

Please sign in to comment.