Browse Source

Input - Refactor to test iOs build.

Dominique Louis 1 tháng trước cách đây
mục cha
commit
403cf8d82a

+ 6 - 6
Input/.vscode/launch.json

@@ -6,7 +6,7 @@
             "type": "coreclr",
             "request": "launch",
             "preLaunchTask": "build-windows",
-            "program": "${workspaceFolder}/Platforms/Windows/bin/Debug/net8.0-windows/MonoGame.Samples.Input.Windows.exe",
+            "program": "${workspaceFolder}/Platforms/Windows/bin/Debug/net8.0-windows/InputSample.exe",
             "args": [],
             "cwd": "${workspaceFolder}/Platforms/Windows",
             "console": "internalConsole",
@@ -17,7 +17,7 @@
             "type": "coreclr",
             "request": "launch",
             "preLaunchTask": "build-desktopgl",
-            "program": "${workspaceFolder}/Platforms/Desktop/bin/Debug/net8.0/MonoGame.Samples.Input.DesktopGL.exe",
+            "program": "${workspaceFolder}/Platforms/Desktop/bin/Debug/net8.0/InputSample",
             "args": [],
             "cwd": "${workspaceFolder}/Platforms/Desktop",
             "console": "internalConsole",
@@ -28,19 +28,19 @@
             "type": "coreclr",
             "request": "launch",
             "preLaunchTask": "build-android",
-            "program": "${workspaceFolder}/Platforms/Android/bin/Debug/net8.0-android/MonoGame.Samples.Input.Android.dll",
+            "program": "${workspaceFolder}/Platforms/Android/bin/Debug/net8.0-android/InputSample.dll",
             "args": [],
             "cwd": "${workspaceFolder}/Platforms/Android",
             "console": "internalConsole",
             "stopAtEntry": false
         },
         {
-            "name": "Launch iOS",
+            "name": "Launch iOS Simulator",
             "type": "coreclr",
             "request": "launch",
             "preLaunchTask": "build-ios",
-            "program": "${workspaceFolder}/Platforms/iOS/bin/Debug/net8.0-ios/MonoGame.Samples.Input.iOS.dll",
-            "args": [],
+            "program": "/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_18.0/18.0.8324/tools/bin/mlaunch",
+            "args": ["--launchsim", "${workspaceFolder}/Platforms/iOS/bin/Debug/net8.0-ios/iossimulator-arm64/InputSample.app", "--device=:v2:udid=7383B3AD-88B2-4972-9541-9E2533F89422", "-sdk", "18.0", "--argument=-monodevelop-port", "--argument=10000", "--setenv=__XAMARIN_DEBUG_PORT__=10000", "--sdkroot", "/Applications/Xcode.app/Contents/Developer"],
             "cwd": "${workspaceFolder}/Platforms/iOS",
             "console": "internalConsole",
             "stopAtEntry": false

+ 3 - 3
Input/Core/Game1.cs → Input/Core/InputGame.cs

@@ -7,9 +7,9 @@ using Microsoft.Xna.Framework.Graphics;
 using Microsoft.Xna.Framework.Input;
 using Microsoft.Xna.Framework.Input.Touch;
 
-namespace MonoGame.Samples.Input
+namespace InputSample
 {
-    public class Game1 : Game
+    public class InputGame : Game
     {
         GraphicsDeviceManager graphics;
         SpriteBatch spriteBatch;
@@ -25,7 +25,7 @@ namespace MonoGame.Samples.Input
 
         TimeSpan lastClickTime;
 
-        public Game1()
+        public InputGame()
         {
             graphics = new GraphicsDeviceManager(this);
 

+ 0 - 31
Input/Platforms/Android/Activity1.cs

@@ -1,31 +0,0 @@
-using System;
-
-using Android.App;
-using Android.Content;
-using Android.Content.PM;
-using Android.Runtime;
-using Android.Views;
-using Android.Widget;
-using Android.OS;
-
-namespace MonoGame.Samples.Input
-{
-	[Activity (Label = "MonoGame.Samples.Input"
-	           , MainLauncher = true
-	           ,Icon = "@drawable/icon"
-	           , Theme = "@style/Theme.Splash"
-	           ,ConfigurationChanges=ConfigChanges.Orientation|ConfigChanges.Keyboard|ConfigChanges.KeyboardHidden
-	           )]
-	public class Activity1 :  Microsoft.Xna.Framework.AndroidGameActivity
-	{
-		protected override void OnCreate (Bundle bundle)
-		{
-			base.OnCreate (bundle);
-	        Game1.Activity = this;
-            var game = new Game1();
-            game.Run();
-		}
-	}
-}
-
-

+ 3 - 2
Input/Platforms/Android/Input.Android.csproj

@@ -2,10 +2,11 @@
   <PropertyGroup>
     <TargetFramework>net8.0-android</TargetFramework>
     <OutputType>Exe</OutputType>
-    <AssemblyName>MonoGame.Samples.Input.Android</AssemblyName>
-    <RootNamespace>MonoGame.Samples.Input.Android</RootNamespace>
+    <AssemblyName>InputSample.Android</AssemblyName>
+    <RootNamespace>InputSample.Android</RootNamespace>
     <AndroidManifest>AndroidManifest.xml</AndroidManifest>
     <SupportedOSPlatformVersion>28</SupportedOSPlatformVersion>
+    <AndroidApplication>True</AndroidApplication>
   </PropertyGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\Core\Input.Core.csproj" />

+ 4 - 5
Input/Platforms/Android/MainActivity.cs

@@ -8,21 +8,20 @@ using Android.Views;
 using Android.Widget;
 using Android.OS;
 
-namespace MonoGame.Samples.Input.Android
+namespace InputSample.Android
 {
-	[Activity (Label = "MonoGame.Samples.Input"
+	[Activity (Label = "InputSamples.Android"
 	           , MainLauncher = true
 	           ,Icon = "@drawable/icon"
 	           , Theme = "@style/Theme.Splash"
 	           ,ConfigurationChanges=ConfigChanges.Orientation|ConfigChanges.Keyboard|ConfigChanges.KeyboardHidden
 	           )]
-	public class Activity1 : AndroidGameActivity
+	public class MainActivity : AndroidGameActivity
 	{
 		protected override void OnCreate (Bundle bundle)
 		{
 			base.OnCreate (bundle);
-	        Game1.Activity = this;
-            var game = new Game1();
+            var game = new InputGame();
             game.Run();
 		}
 	}

+ 3 - 3
Input/Platforms/Desktop/Input.DesktopGL.csproj

@@ -1,9 +1,9 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFramework>net8.0</TargetFramework>
-    <OutputType>WinExe</OutputType>
-    <AssemblyName>MonoGame.Samples.Input.DesktopGL</AssemblyName>
-    <RootNamespace>MonoGame.Samples.Input.DesktopGL</RootNamespace>
+    <OutputType>Exe</OutputType>
+    <AssemblyName>InputSample</AssemblyName>
+    <RootNamespace>InputSample.DesktopGL</RootNamespace>
   </PropertyGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\Core\Input.Core.csproj" />

+ 2 - 2
Input/Platforms/Desktop/Program.cs

@@ -1,13 +1,13 @@
 using System;
 
-namespace MonoGame.Samples.Input.DesktopGL
+namespace InputSample.DesktopGL
 {
     public static class Program
     {
         [STAThread]
         static void Main()
         {
-            using (var game = new Game1())
+            using (var game = new InputGame())
                 game.Run();
         }
     }

+ 2 - 2
Input/Platforms/Windows/Input.Windows.csproj

@@ -3,8 +3,8 @@
     <TargetFramework>net8.0-windows</TargetFramework>
     <OutputType>WinExe</OutputType>
     <UseWindowsForms>true</UseWindowsForms>
-    <AssemblyName>MonoGame.Samples.Input.Windows</AssemblyName>
-    <RootNamespace>MonoGame.Samples.Input.Windows</RootNamespace>
+    <AssemblyName>InputSample</AssemblyName>
+    <RootNamespace>InputSample.Windows</RootNamespace>
   </PropertyGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\Core\Input.Core.csproj" />

+ 2 - 2
Input/Platforms/Windows/Program.cs

@@ -1,13 +1,13 @@
 using System;
 
-namespace MonoGame.Samples.Input.Windows
+namespace InputSamples.Windows
 {
     public static class Program
     {
         [STAThread]
         static void Main()
         {
-            using (var game = new Game1())
+            using (var game = new InputGame())
                 game.Run();
         }
     }

+ 2 - 2
Input/Platforms/iOS/Input.iOS.csproj

@@ -2,8 +2,8 @@
   <PropertyGroup>
     <TargetFramework>net8.0-ios</TargetFramework>
     <OutputType>Exe</OutputType>
-    <AssemblyName>MonoGame.Samples.Input.iOS</AssemblyName>
-    <RootNamespace>MonoGame.Samples.Input.iOS</RootNamespace>
+    <AssemblyName>InputSample</AssemblyName>
+    <RootNamespace>InputSample.iOS</RootNamespace>
     <SupportedOSPlatformVersion>11.0</SupportedOSPlatformVersion>
   </PropertyGroup>
   <ItemGroup>

+ 5 - 5
Input/Platforms/iOS/Program.cs

@@ -1,22 +1,22 @@
 using Foundation;
 using UIKit;
 
-namespace MonoGame.Samples.Input.iOS
+namespace InputSample.iOS
 {
     [Register("AppDelegate")]
-    class Program : UIApplicationDelegate
+    class AppDelegate : UIApplicationDelegate
     {
-        private Game1 game;
+        private InputGame game;
 
         public override void FinishedLaunching(UIApplication app)
         {
-            game = new Game1();
+            game = new InputGame();
             game.Run();
         }
 
         static void Main(string[] args)
         {
-            UIApplication.Main(args, null, "AppDelegate");
+            UIApplication.Main(args, null, typeof(AppDelegate));
         }
     }
 }