Skip to content

Commit

Permalink
Merge pull request #3 from migueldeicaza/master
Browse files Browse the repository at this point in the history
Solution to run Artemis with MonoTouch on iPhone/iPad on iOS.
  • Loading branch information
thelinuxlich committed Apr 26, 2012
2 parents 380c7ad + abc7679 commit 2b89ac3
Show file tree
Hide file tree
Showing 7 changed files with 261 additions and 9 deletions.
46 changes: 46 additions & 0 deletions Artemis_MonoTouch/ArtemisTests/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;

using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.NUnit.UI;

namespace ArtemisTests
{
// 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
{
// class-level declarations
UIWindow window;
TouchRunner runner;

//
// 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 bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
runner = new TouchRunner (window);

// register every tests included in the main application/assembly
runner.Add (System.Reflection.Assembly.GetExecutingAssembly ());

window.RootViewController = new UINavigationController (runner.GetViewController ());

// make the window visible
window.MakeKeyAndVisible ();

return true;
}
}
}

40 changes: 40 additions & 0 deletions Artemis_MonoTouch/ArtemisTests/ArtemisTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

using System;
using NUnit.Framework;

namespace ArtemisTest
{
[TestFixture]
public class ProxyTests
{
[Test]
public void MultiTest ()
{
Test.multi ();
}

[Test]
public void MultiSystemTest ()
{
Test.multsystem();
}

[Test]
public void QueueSystemTest ()
{
Test.QueueSystemTeste();
}

[Test]
public void HybridQueueSystemTest ()
{
Test.HybridQueueSystemTeste();
}

[Test]
public void SystemCommunicationTest ()
{
Test.SystemComunicationTeste();
}
}
}
121 changes: 121 additions & 0 deletions Artemis_MonoTouch/ArtemisTests/ArtemisTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?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>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{36AFD51D-F977-4A9F-BF80-24152AC7BCC2}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>ArtemisTests</RootNamespace>
<AssemblyName>ArtemisTests</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;MONOTOUCH</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchDebug>true</MtouchDebug>
<MtouchProfiling>true</MtouchProfiling>
<MtouchLink>None</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchLink>None</MtouchLink>
<DefineConstants>MONOTOUCH</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;MONOTOUCH</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<MtouchProfiling>true</MtouchProfiling>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<DefineConstants>MONOTOUCH</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
<Reference Include="MonoTouch.NUnitLite" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\DummyCommunicationSystem.cs">
<Link>DummyCommunicationSystem.cs</Link>
</Compile>
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\DummySystem.cs">
<Link>DummySystem.cs</Link>
</Compile>
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\DummySystem2.cs">
<Link>DummySystem2.cs</Link>
</Compile>
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\DummySystem3.cs">
<Link>DummySystem3.cs</Link>
</Compile>
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\Health.cs">
<Link>Health.cs</Link>
</Compile>
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\HybridQueueSystemTest.cs">
<Link>HybridQueueSystemTest.cs</Link>
</Compile>
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\MultHealthBarRenderSystem.cs">
<Link>MultHealthBarRenderSystem.cs</Link>
</Compile>
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\QueueSystemProcessingThreadSafe.cs">
<Link>QueueSystemProcessingThreadSafe.cs</Link>
</Compile>
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\QueueSystemTest.cs">
<Link>QueueSystemTest.cs</Link>
</Compile>
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\QueueSystemTest2.cs">
<Link>QueueSystemTest2.cs</Link>
</Compile>
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\SingleHealthBarRenderSystem.cs">
<Link>SingleHealthBarRenderSystem.cs</Link>
</Compile>
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\SingleHEAVYHealthBarRenderSystem.cs">
<Link>SingleHEAVYHealthBarRenderSystem.cs</Link>
</Compile>
<Compile Include="..\..\Artemis_XNA_INDEPENDENT\ArtemisTest\Test.cs">
<Link>Test.cs</Link>
</Compile>
<Compile Include="ArtemisTests.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\Artemis_MonoTouch.csproj">
<Project>{9F973E74-5CD0-4359-9FA1-FFF1D68F9930}</Project>
<Name>Artemis_MonoTouch</Name>
</ProjectReference>
</ItemGroup>
</Project>
24 changes: 24 additions & 0 deletions Artemis_MonoTouch/ArtemisTests/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</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>
</dict>
</plist>
20 changes: 20 additions & 0 deletions Artemis_MonoTouch/ArtemisTests/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;

using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace ArtemisTests
{
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");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public QueueManager()
ReleaseLock();
}

public void AquireLock()
public void AcquireLock()
{
Monitor.Enter(lockobj);
}
Expand Down
17 changes: 9 additions & 8 deletions Artemis_XNA_INDEPENDENT/ArtemisTest/Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private static void RemovedEntity(Entity e)
}


static void multi()
public static void multi()
{
healthBag.Add(new Health());
healthBag.Add(new Health());
Expand Down Expand Up @@ -75,7 +75,7 @@ static void multi()

}

static void multsystem()
public static void multsystem()
{
healthBag.Clear();
componentPool.Clear();
Expand Down Expand Up @@ -129,15 +129,16 @@ static void multsystem()
//}
}


#if !MONOTOUCH
static void Main(String[] args)
{
multi();
multsystem();
QueueSystemTeste();
HybridQueueSystemTeste();
SystemComunicationTeste();
multi();
multsystem();
QueueSystemTeste();
HybridQueueSystemTeste();
SystemComunicationTeste();
}
#endif

public static void SystemComunicationTeste()
{
Expand Down

0 comments on commit 2b89ac3

Please sign in to comment.