Răsfoiți Sursa

Added iOS demo [WIP]

vpenades 2 ani în urmă
părinte
comite
1edbf858fa

+ 10 - 0
MonoScene.sln

@@ -41,10 +41,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo5.Android", "demos\Demo
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3549110B-73B7-4471-981F-52DF2243E957}"
 	ProjectSection(SolutionItems) = preProject
+		Directory.Packages.props = Directory.Packages.props
 		NuGet.config = NuGet.config
 		README.md = README.md
 	EndProjectSection
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo5.AppleiOS", "demos\Demo5.AppleiOS\Demo5.AppleiOS.csproj", "{7A0376E9-716E-4546-8FD7-8696266B6CD2}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -105,6 +108,12 @@ Global
 		{2C14367C-43E4-40FD-90B6-F860955BF184}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{2C14367C-43E4-40FD-90B6-F860955BF184}.Release|Any CPU.Build.0 = Release|Any CPU
 		{2C14367C-43E4-40FD-90B6-F860955BF184}.Release|Any CPU.Deploy.0 = Release|Any CPU
+		{7A0376E9-716E-4546-8FD7-8696266B6CD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{7A0376E9-716E-4546-8FD7-8696266B6CD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{7A0376E9-716E-4546-8FD7-8696266B6CD2}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+		{7A0376E9-716E-4546-8FD7-8696266B6CD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{7A0376E9-716E-4546-8FD7-8696266B6CD2}.Release|Any CPU.Build.0 = Release|Any CPU
+		{7A0376E9-716E-4546-8FD7-8696266B6CD2}.Release|Any CPU.Deploy.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -123,6 +132,7 @@ Global
 		{E33A8290-FFD1-44DF-B095-FF7002BE8CFE} = {CB3349D6-3282-49BC-87BC-3EA128FAE922}
 		{CC274EDC-1D0D-4BAB-AB9B-26077CE7874B} = {D3CE88C7-E423-42EF-B869-C233AE360D89}
 		{2C14367C-43E4-40FD-90B6-F860955BF184} = {CB3349D6-3282-49BC-87BC-3EA128FAE922}
+		{7A0376E9-716E-4546-8FD7-8696266B6CD2} = {CB3349D6-3282-49BC-87BC-3EA128FAE922}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {3A93E868-4176-4EB6-864F-C1CEE03ED6A5}

+ 36 - 0
demos/Demo5.AppleiOS/.config/dotnet-tools.json

@@ -0,0 +1,36 @@
+{
+  "version": 1,
+  "isRoot": true,
+  "tools": {
+    "dotnet-mgcb": {
+      "version": "3.8.1.303",
+      "commands": [
+        "mgcb"
+      ]
+    },
+    "dotnet-mgcb-editor": {
+      "version": "3.8.1.303",
+      "commands": [
+        "mgcb-editor"
+      ]
+    },
+    "dotnet-mgcb-editor-linux": {
+      "version": "3.8.1.303",
+      "commands": [
+        "mgcb-editor-linux"
+      ]
+    },
+    "dotnet-mgcb-editor-windows": {
+      "version": "3.8.1.303",
+      "commands": [
+        "mgcb-editor-windows"
+      ]
+    },
+    "dotnet-mgcb-editor-mac": {
+      "version": "3.8.1.303",
+      "commands": [
+        "mgcb-editor-mac"
+      ]
+    }
+  }
+}

+ 13 - 0
demos/Demo5.AppleiOS/Content/Content.mgcb

@@ -0,0 +1,13 @@
+#----------------------------- Global Properties ----------------------------#
+
+/outputDir:bin/$(Platform)
+/intermediateDir:obj/$(Platform)
+/platform:iOS
+/config:
+/profile:Reach
+/compress:False
+
+#-------------------------------- References --------------------------------#
+
+
+#---------------------------------- Content ---------------------------------#

BIN
demos/Demo5.AppleiOS/Default.png


+ 24 - 0
demos/Demo5.AppleiOS/Demo5.AppleiOS.csproj

@@ -0,0 +1,24 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  
+  <PropertyGroup>
+    <TargetFramework>net6.0-ios</TargetFramework>
+    <SupportedOSPlatformVersion>11.2</SupportedOSPlatformVersion>
+    <OutputType>Exe</OutputType>    
+    <CodesignKey>iPhone Developer</CodesignKey>
+  </PropertyGroup>  
+  
+  <ItemGroup>
+    <!--
+    <PackageReference Include="MonoGame.Content.Builder.Task" />
+    -->
+    <PackageReference Include="MonoGame.Framework.iOS" />
+  </ItemGroup>
+  
+  <!--
+  <Target Name="RestoreDotnetTools" BeforeTargets="Restore">
+    <Message Text="Restoring dotnet tools" Importance="High" />
+    <Exec Command="dotnet tool restore" />
+  </Target>
+  -->
+  
+</Project>

+ 6 - 0
demos/Demo5.AppleiOS/Entitlements.plist

@@ -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>

+ 49 - 0
demos/Demo5.AppleiOS/Game1.cs

@@ -0,0 +1,49 @@
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+
+namespace Demo5.AppleiOS
+{
+    public class Game1 : Game
+    {
+        private GraphicsDeviceManager _graphics;
+        private SpriteBatch _spriteBatch;
+
+        public Game1()
+        {
+            _graphics = new GraphicsDeviceManager(this);
+            Content.RootDirectory = "Content";
+            IsMouseVisible = true;
+        }
+
+        protected override void Initialize()
+        {
+            // TODO: Add your initialization logic here
+
+            base.Initialize();
+        }
+
+        protected override void LoadContent()
+        {
+            _spriteBatch = new SpriteBatch(GraphicsDevice);
+
+            // TODO: use this.Content to load your game content here
+        }
+
+        protected override void Update(GameTime gameTime)
+        {
+            // TODO: Add your update logic here
+
+            base.Update(gameTime);
+        }
+
+        protected override void Draw(GameTime gameTime)
+        {
+            GraphicsDevice.Clear(Color.CornflowerBlue);
+
+            // TODO: Add your drawing code here
+
+            base.Draw(gameTime);
+        }
+    }
+}

BIN
demos/Demo5.AppleiOS/GameThumbnail.png


+ 33 - 0
demos/Demo5.AppleiOS/Info.plist

@@ -0,0 +1,33 @@
+<?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>Demo5.AppleiOS</string>
+	<key>CFBundleIconFiles</key>
+	<array>
+		<string>GameThumbnail.png</string>
+	</array>
+	<key>CFBundleIdentifier</key>
+	<string>project.MonoGame.Demo5.AppleiOS</string>
+	<key>MinimumOSVersion</key>
+	<string>11.2</string>
+	<key>UISupportedInterfaceOrientations</key>
+	<array>
+		<string>UIInterfaceOrientationPortrait</string>
+	</array>
+	<key>CFBundleName</key>
+	<string>Demo5.AppleiOS</string>
+	<key>UIRequiresFullScreen</key>
+	<true/>
+	<key>UIStatusBarHidden</key>
+	<true/>
+	<key>UILaunchStoryboardName</key>
+	<string>LaunchScreen</string>
+	<key>UIDeviceFamily</key>
+	<array>
+		<integer>1</integer>
+		<integer>2</integer>
+	</array>
+</dict>
+</plist>

+ 27 - 0
demos/Demo5.AppleiOS/LaunchScreen.storyboard

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
+    <dependencies>
+        <deployment identifier="iOS" />
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530" />
+    </dependencies>
+    <scenes>
+        <!--View Controller-->
+        <scene sceneID="EHf-IW-A2E">
+            <objects>
+                <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="Llm-lL-Icb" />
+                        <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok" />
+                    </layoutGuides>
+                    <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+                        <rect key="frame" x="0.0" y="0.0" width="600" height="600" />
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
+                    </view>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder" />
+            </objects>
+            <point key="canvasLocation" x="53" y="375" />
+        </scene>
+    </scenes>
+</document>

+ 33 - 0
demos/Demo5.AppleiOS/Program.cs

@@ -0,0 +1,33 @@
+using System;
+
+using Foundation;
+
+using UIKit;
+
+namespace Demo5.AppleiOS
+{
+    [Register("AppDelegate")]
+    internal class Program : UIApplicationDelegate
+    {
+        private static Game1 game;
+
+        internal static void RunGame()
+        {
+            game = new Game1();
+            game.Run();
+        }
+
+        /// <summary>
+        /// The main entry point for the application.
+        /// </summary>
+        static void Main(string[] args)
+        {
+            UIApplication.Main(args, null, typeof(Program));
+        }
+
+        public override void FinishedLaunching(UIApplication app)
+        {
+            RunGame();
+        }
+    }
+}

+ 2 - 2
src/MonoGameFramework.props

@@ -7,12 +7,12 @@
   </PropertyGroup>
 
   <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
-    <PackageReference Include="MonoGame.Framework.DesktopGL" PrivateAssets="all" />
+    <PackageReference Include="MonoGame.Framework.DesktopGL" VersionOverride="$(MonoGameNetStandardVersion)" PrivateAssets="all" />
     <PackageReference Include="System.Memory" />
   </ItemGroup>
 
   <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
-    <PackageReference Include="MonoGame.Framework.DesktopGL" PrivateAssets="all" />
+    <PackageReference Include="MonoGame.Framework.DesktopGL" VersionOverride="$(MonoGameNetStandardVersion)" PrivateAssets="all" />
   </ItemGroup>
 
   <ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">