Ver Fonte

Adds test project for Synchronous Run on MacOS

BlockingRunGame
- Just a rudimentary game implementation.  There is nothing important
  here. The interesting code is in Main.cs

Main
- Creates two BlockingRunGame instances in series.  Runs the first and
  waits for it to exit, then runs the second and waits again.
Christopher Chambers há 13 anos atrás
pai
commit
538c127bb2

+ 67 - 0
Tests/MacOS/BlockingRun/BlockingRun.csproj

@@ -0,0 +1,67 @@
+<?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>{75D4D875-093F-4C00-8EE5-C7B39D2F4C18}</ProjectGuid>
+    <ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>BlockingRun</RootNamespace>
+    <AssemblyName>BlockingRun</AssemblyName>
+  </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>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="System.Xml.Linq" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="MonoMac" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Main.cs" />
+    <Compile Include="BlockingRunGame.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Info.plist" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\..\MonoGame\MonoGame.Framework\MonoGame.Framework.MacOS.csproj">
+      <Project>{36C538E6-C32A-4A8D-A39C-566173D7118E}</Project>
+      <Name>MonoGame.Framework.MacOS</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\..\MonoGame\ThirdParty\Lidgren.Network\Lidgren.Network.MacOS.csproj">
+      <Project>{AE483C29-042E-4226-BA52-D247CE7676DA}</Project>
+      <Name>Lidgren.Network.MacOS</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Content\" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Content\SimpleFont.xnb">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+</Project>

+ 37 - 0
Tests/MacOS/BlockingRun/BlockingRunGame.cs

@@ -0,0 +1,37 @@
+using System;
+
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace BlockingRun
+{
+    public class BlockingRunGame : Game
+    {
+        public BlockingRunGame()
+        {
+            new GraphicsDeviceManager(this);
+            Content.RootDirectory = "Content";
+        }
+
+        private SpriteBatch _spriteBatch;
+        private SpriteFont _font;
+        protected override void LoadContent()
+        {
+            base.LoadContent();
+
+            _spriteBatch = new SpriteBatch(GraphicsDevice);
+            _font = Content.Load<SpriteFont>("SimpleFont");
+        }
+
+        protected override void Draw(GameTime gameTime)
+        {
+            GraphicsDevice.Clear(Color.CornflowerBlue);
+
+            base.Draw(gameTime);
+
+            _spriteBatch.Begin();
+            _spriteBatch.DrawString(_font, "A magical blocking Game.Run!", Vector2.Zero, Color.White);
+            _spriteBatch.End();
+        }
+    }
+}

BIN
Tests/MacOS/BlockingRun/Content/SimpleFont.xnb


+ 14 - 0
Tests/MacOS/BlockingRun/Info.plist

@@ -0,0 +1,14 @@
+<?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>CFBundleIdentifier</key>
+	<string>com.yourcompany.BlockingRun</string>
+	<key>CFBundleName</key>
+	<string>BlockingRun</string>
+	<key>CFBundleVersion</key>
+	<string>1</string>
+	<key>LSMinimumSystemVersion</key>
+	<string>10.6</string>
+</dict>
+</plist>

+ 34 - 0
Tests/MacOS/BlockingRun/Main.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Drawing;
+
+using Microsoft.Xna.Framework;
+
+using MonoMac.AppKit;
+using MonoMac.Foundation;
+
+namespace BlockingRun
+{
+    class MainClass
+    {
+        static void Main(string[] args)
+        {
+            NSApplication.Init();
+
+            Console.WriteLine("Starting a blocking game instance...");
+            using (var pool = new NSAutoreleasePool())
+            using (var game = new BlockingRunGame())
+            {
+                game.Run(GameRunBehavior.Synchronous);
+            }
+
+            Console.WriteLine("Starting a second blocking game instance...");
+            using (var pool = new NSAutoreleasePool())
+            using (var game = new BlockingRunGame())
+            {
+                game.Run(GameRunBehavior.Synchronous);
+            }
+
+            Console.WriteLine("Fin");
+        }
+    }
+}

+ 8 - 0
Tests/MonoGame.Tests.MacOS.sln

@@ -35,6 +35,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoundTest2_MacOs", "MacOS\S
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestImplicitOrdering", "MacOS\TestImplicitOrdering\TestImplicitOrdering.csproj", "{573AC418-8A76-4C5B-A7FE-5AC0A4C32BA1}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlockingRun", "MacOS\BlockingRun\BlockingRun.csproj", "{75D4D875-093F-4C00-8EE5-C7B39D2F4C18}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|x86 = Debug|x86
@@ -72,6 +74,12 @@ Global
 		{573AC418-8A76-4C5B-A7FE-5AC0A4C32BA1}.Distribution|Any CPU.Build.0 = Debug|x86
 		{573AC418-8A76-4C5B-A7FE-5AC0A4C32BA1}.Release|x86.ActiveCfg = Release|x86
 		{573AC418-8A76-4C5B-A7FE-5AC0A4C32BA1}.Release|x86.Build.0 = Release|x86
+		{75D4D875-093F-4C00-8EE5-C7B39D2F4C18}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{75D4D875-093F-4C00-8EE5-C7B39D2F4C18}.Debug|x86.Build.0 = Debug|Any CPU
+		{75D4D875-093F-4C00-8EE5-C7B39D2F4C18}.Distribution|Any CPU.ActiveCfg = Debug|Any CPU
+		{75D4D875-093F-4C00-8EE5-C7B39D2F4C18}.Distribution|Any CPU.Build.0 = Debug|Any CPU
+		{75D4D875-093F-4C00-8EE5-C7B39D2F4C18}.Release|x86.ActiveCfg = Release|Any CPU
+		{75D4D875-093F-4C00-8EE5-C7B39D2F4C18}.Release|x86.Build.0 = Release|Any CPU
 		{79A32C2C-0F38-4ADE-88D1-F8502C520570}.Debug|x86.ActiveCfg = Debug|x86
 		{79A32C2C-0F38-4ADE-88D1-F8502C520570}.Debug|x86.Build.0 = Debug|x86
 		{79A32C2C-0F38-4ADE-88D1-F8502C520570}.Distribution|Any CPU.ActiveCfg = Debug|x86