Browse Source

Fixes PSM Samples to point to CompiledContent folder. Added Flocking demo to PSM solution. Fix Draw2D to use logo.xnb

Dominique Louis 12 năm trước cách đây
mục cha
commit
8afe2e2a32

+ 4 - 4
Aiming/Aiming.PSMobile.csproj

@@ -44,11 +44,11 @@
     <Folder Include="Content\" />
   </ItemGroup>
   <ItemGroup>
-    <Content Include="Content\cat.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    <Content Include="..\CompiledContent\Android\Content\Textures\cat.xnb">
+      <Link>Content\cat.xnb</Link>
     </Content>
-    <Content Include="Content\spotlight.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    <Content Include="..\CompiledContent\Android\Content\Textures\spotlight.xnb">
+      <Link>Content\spotlight.xnb</Link>
     </Content>
   </ItemGroup>
   <ItemGroup>

+ 8 - 8
ChaseAndEvade/ChaseAndEvade.PSMobile.csproj

@@ -40,17 +40,17 @@
     <Folder Include="Content\" />
   </ItemGroup>
   <ItemGroup>
-    <Content Include="Content\cat.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    <Content Include="..\CompiledContent\Android\Content\Textures\cat.xnb">
+      <Link>Content\cat.xnb</Link>
     </Content>
-    <Content Include="Content\mouse.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    <Content Include="..\CompiledContent\Android\Content\Textures\mouse.xnb">
+      <Link>Content\mouse.xnb</Link>
     </Content>
-    <Content Include="Content\tank.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    <Content Include="..\CompiledContent\Android\Content\Textures\tank.xnb">
+      <Link>Content\tank.xnb</Link>
     </Content>
-    <Content Include="Content\Arial.xnb">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    <Content Include="..\CompiledContent\Android\Content\Fonts\Arial.xnb">
+      <Link>Content\Arial.xnb</Link>
     </Content>
   </ItemGroup>
   <ItemGroup>

+ 0 - 3
Draw2D/Draw2D.PSMobile.csproj

@@ -45,9 +45,6 @@
     <Folder Include="Content\" />
   </ItemGroup>
   <ItemGroup>
-    <Content Include="Content\monogameicon48x48.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="..\CompiledContent\Android\Content\Fonts\Font.xnb">
       <Link>Content\Font.xnb</Link>
     </Content>

+ 1 - 1
Draw2D/Game1.cs

@@ -71,7 +71,7 @@ namespace Microsoft.Xna.Samples.Draw2D
 			spriteBatch = new SpriteBatch (GraphicsDevice);
 
 			// TODO: use this.Content to load your game content here
-			texture = Content.Load<Texture2D> ("monogameicon48x48");
+			texture = Content.Load<Texture2D> ("logo");
 			font = Content.Load<SpriteFont> ("Font");
 
 			fps = new FPSCounterComponent (this,spriteBatch,font);

+ 90 - 0
Flocking/Flocking.PSMobile.csproj

@@ -0,0 +1,90 @@
+<?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>
+    <ProductVersion>10.0.0</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{F0B32BB5-1E28-453B-B4D6-BEC0E159DFB1}</ProjectGuid>
+    <ProjectTypeGuids>{69878862-DA7D-4DC6-B0A1-50D8FAB4242F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>Flocking.PSMobile</RootNamespace>
+    <AssemblyName>Flocking.PSMobile</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;PSM</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>none</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Core" />
+    <Reference Include="Sce.PlayStation.Core" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Flock.cs" />
+    <Compile Include="FlockingSample.cs" />
+    <Compile Include="InputState.cs" />
+    <Compile Include="Main.cs" />
+    <Compile Include="Animals\Animal.cs" />
+    <Compile Include="Animals\Bird.cs" />
+    <Compile Include="Animals\Cat.cs" />
+    <Compile Include="Behaviors\AlignBehavior.cs" />
+    <Compile Include="Behaviors\Behavior.cs" />
+    <Compile Include="Behaviors\Behaviors.cs" />
+    <Compile Include="Behaviors\CohesionBehavior.cs" />
+    <Compile Include="Behaviors\FleeBehavior.cs" />
+    <Compile Include="Behaviors\SeparationBehavior.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <PsmMetadata Include="app.xml" />
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath)\Sce\Sce.Psm.CSharp.targets" />
+  <ItemGroup>
+    <ProjectReference Include="..\..\MonoGame.Framework\MonoGame.Framework.PSMobile.csproj">
+      <Project>{EA26E76F-FDFE-4A8C-B5A3-C3B5761E28F9}</Project>
+      <Name>MonoGame.Framework.PSMobile</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Content\" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="..\CompiledContent\Android\Content\Textures\cat.xnb">
+      <Link>Content\cat.xnb</Link>
+    </Content>
+    <Content Include="..\CompiledContent\Android\Content\Textures\logo.xnb">
+      <Link>Content\logo.xnb</Link>
+    </Content>
+    <Content Include="..\CompiledContent\Android\Content\Textures\mouse.xnb">
+      <Link>Content\mouse.xnb</Link>
+    </Content>
+    <Content Include="..\CompiledContent\Android\Content\Fonts\HUDFont.xnb">
+      <Link>Content\HUDFont.xnb</Link>
+    </Content>
+    <Content Include="..\CompiledContent\Android\Content\Textures\xboxControllerButtonB.xnb">
+      <Link>Content\xboxControllerButtonB.xnb</Link>
+    </Content>
+    <Content Include="..\CompiledContent\Android\Content\Textures\xboxControllerButtonX.xnb">
+      <Link>Content\xboxControllerButtonX.xnb</Link>
+    </Content>
+    <Content Include="..\CompiledContent\Android\Content\Textures\xboxControllerButtonY.xnb">
+      <Link>Content\xboxControllerButtonY.xnb</Link>
+    </Content>
+  </ItemGroup>
+</Project>

+ 1 - 1
Flocking/FlockingSample.cs

@@ -418,7 +418,7 @@ namespace Flocking
             DrawBar(barSeparationDistance, flockParams.SeparationDistance / 100f, 
                     "Separation  Distance:", gameTime, selectionNum == 1);
 
-#if WINDOWS_PHONE || IOS
+#if WINDOWS_PHONE || IOS || PSM
             DrawButton(buttonResetDistance, "Reset Distance");
             DrawButton(buttonResetFlock, "Reset Flock");
             DrawButton(buttonToggleCat, "Add/Remove Cat");

+ 57 - 1
Flocking/Main.cs

@@ -3,11 +3,51 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 
+#if MONOMAC
+using MonoMac.AppKit;
+using MonoMac.Foundation;
+#elif IPHONE
 using MonoTouch.Foundation;
 using MonoTouch.UIKit;
+#endif
 
 namespace Flocking
 {
+#if MONOMAC
+	class Program
+	{
+		static void Main (string[] args)
+		{
+			NSApplication.Init ();
+
+			using (var p = new NSAutoreleasePool ()) {
+				NSApplication.SharedApplication.Delegate = new AppDelegate ();
+
+				// Set our Application Icon
+				NSImage appIcon = NSImage.ImageNamed ("monogameicon.png");
+				NSApplication.SharedApplication.ApplicationIconImage = appIcon;
+				
+				NSApplication.Main (args);
+			}
+		}
+	}
+
+	class AppDelegate : NSApplicationDelegate
+	{
+		private FlockingSample game;
+
+		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
+		{
+			game = new FlockingSample();
+			game.Run();
+		}
+
+		public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
+		{
+			return true;
+		}
+	}
+#elif IPHONE
 	[Register("AppDelegate")]
 	class Program : UIApplicationDelegate
 	{
@@ -27,7 +67,23 @@ namespace Flocking
 		{
 			UIApplication.Main (args, null, "AppDelegate");
 		}
-	}    
+	} 
+#else
+	static class Program
+	{
+		private static FlockingSample game;
+
+		/// <summary>
+		/// The main entry point for the application.
+		/// </summary>
+		[STAThread]
+		static void Main()
+		{
+			game = new FlockingSample();
+			game.Run();
+		}
+	}
+#endif
 }
 
 

+ 10 - 0
Flocking/app.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<application project_name="*" version="1.00" default_locale="en-US">
+	<runtime_config>
+		<memory managed_heap_size="32768" resource_heap_size="65536" />
+	</runtime_config>
+	<feature_list>
+		<feature value="GamePad" />
+		<feature value="Touch" />
+	</feature_list>
+</application>

+ 6 - 0
MonoGame.Samples.PSMobile.sln

@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChaseAndEvade.PSMobile", "C
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Draw2D.PSMobile", "Draw2D\Draw2D.PSMobile.csproj", "{D46978DF-F83C-45A1-80CA-A9B578607B77}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flocking.PSMobile", "Flocking\Flocking.PSMobile.csproj", "{F0B32BB5-1E28-453B-B4D6-BEC0E159DFB1}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -37,6 +39,10 @@ Global
 		{EA26E76F-FDFE-4A8C-B5A3-C3B5761E28F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{EA26E76F-FDFE-4A8C-B5A3-C3B5761E28F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{EA26E76F-FDFE-4A8C-B5A3-C3B5761E28F9}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F0B32BB5-1E28-453B-B4D6-BEC0E159DFB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F0B32BB5-1E28-453B-B4D6-BEC0E159DFB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F0B32BB5-1E28-453B-B4D6-BEC0E159DFB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F0B32BB5-1E28-453B-B4D6-BEC0E159DFB1}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(MonoDevelopProperties) = preSolution
 		StartupItem = Aiming\Aiming.PSMobile.csproj