Skip to content

Commit 9209917

Browse files
authored
Update Platformer2D (#106)
* Replace with current 2D Platformer template version. * Add Desktop Info.plist and *.icns files
1 parent 3f86c49 commit 9209917

File tree

209 files changed

+9033
-2662
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+9033
-2662
lines changed

.github/workflows/dotnet.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
path: artifacts/NeonShooter-Windows/**
6464

6565
- name: Build Windows Binary for Platformer2D
66-
run: dotnet publish Platformer2D/Platformer2D.WindowsDX/Platformer2D.WindowsDX.csproj -c Release -r win-x64 --self-contained true -o ./artifacts/Platformer2D-Windows
66+
run: dotnet publish Platformer2D/Windows/Platformer2D.csproj -c Release -r win-x64 --self-contained true -o ./artifacts/Platformer2D-Windows
6767

6868
- name: Archive Platformer2D
6969
uses: actions/upload-artifact@v6
@@ -187,8 +187,8 @@ jobs:
187187

188188
- name: Build and Package Platformer2D
189189
run: |
190-
dotnet build Platformer2D/Platformer2D.DesktopGL/Platformer2D.DesktopGL.csproj -c Release
191-
monopack -p Platformer2D/Platformer2D.DesktopGL/Platformer2D.DesktopGL.csproj -o ./artifacts/Platformer2D -rids win-x64,linux-x64,osx-x64,osx-arm64 -i Platformer2D/Platformer2D.DesktopGL/Info.plist -c Platformer2D/Platformer2D.DesktopGL/Platformer2D.DesktopGL.icns -v --macos-universal
190+
dotnet build Platformer2D/Desktop/Platformer2D.csproj -c Release
191+
monopack -p Platformer2D/Desktop/Platformer2D.csproj -o ./artifacts/Platformer2D -rids win-x64,linux-x64,osx-x64,osx-arm64 -i Platformer2D/Desktop/Info.plist -c Platformer2D/Desktop/Platformer2D.icns -v --macos-universal
192192
193193
- name: Archive Platformer2D Windows
194194
uses: actions/upload-artifact@v6
@@ -305,13 +305,13 @@ jobs:
305305
path: NeonShooter/NeonShooter.Android/bin/Release/net9.0-android/**/*-Signed.apk
306306

307307
- name: Build Android Binary for Platformer2D
308-
run: dotnet build Platformer2D/Platformer2D.Android/Platformer2D.Android.csproj -c Release
308+
run: dotnet build Platformer2D/Android/Platformer2D.csproj -c Release
309309

310310
- name: Archive Platformer2D Android
311311
uses: actions/upload-artifact@v6
312312
with:
313313
name: Android-Platformer2D
314-
path: Platformer2D/Platformer2D.Android/bin/Release/net9.0-android/**/*-Signed.apk
314+
path: Platformer2D/Android/bin/Release/net9.0-android/**/*-Signed.apk
315315

316316
- name: Build Android Binary for DungeonSlime
317317
run: dotnet build Tutorials/learn-monogame-2d/src/27-Conclusion/DungeonSlime/Platforms/Android/DungeonSlime.csproj -c Release
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.companyname.Platformer2D" android:versionCode="1" android:versionName="1.0">
3+
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
4+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="35" />
5+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6+
<uses-permission android:name="android.permission.INTERNET" />
7+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
8+
<application
9+
android:hardwareAccelerated="true"
10+
android:icon="@drawable/icon"
11+
android:isGame="true"
12+
android:label="@string/app_name"
13+
android:theme="@style/MainTheme"
14+
/>
15+
</manifest>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using Android.App;
2+
using Android.Content.PM;
3+
using Android.OS;
4+
using Android.Views;
5+
6+
using Microsoft.Xna.Framework;
7+
8+
using Platformer2D.Core;
9+
10+
namespace Platformer2D.Android
11+
{
12+
/// <summary>
13+
/// The main activity for the Android application. It initializes the game instance,
14+
/// sets up the rendering view, and starts the game loop.
15+
/// </summary>
16+
/// <remarks>
17+
/// This class is responsible for managing the Android activity lifecycle and integrating
18+
/// with the MonoGame framework.
19+
/// </remarks>
20+
[Activity(
21+
Label = "Platformer2D",
22+
MainLauncher = true,
23+
Icon = "@drawable/icon",
24+
Theme = "@style/Theme.Splash",
25+
AlwaysRetainTaskState = true,
26+
LaunchMode = LaunchMode.SingleInstance,
27+
ScreenOrientation = ScreenOrientation.SensorLandscape,
28+
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden
29+
)]
30+
public class MainActivity : AndroidGameActivity
31+
{
32+
private Platformer2DGame _game;
33+
private View _view;
34+
35+
/// <summary>
36+
/// Called when the activity is first created. Initializes the game instance,
37+
/// retrieves its rendering view, and sets it as the content view of the activity.
38+
/// Finally, starts the game loop.
39+
/// </summary>
40+
/// <param name="bundle">A Bundle containing the activity's previously saved state, if any.</param>
41+
protected override void OnCreate(Bundle bundle)
42+
{
43+
base.OnCreate(bundle);
44+
45+
_game = new Platformer2DGame();
46+
_view = _game.Services.GetService(typeof(View)) as View;
47+
48+
SetContentView(_view);
49+
_game.Run();
50+
}
51+
}
52+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<TargetFramework>net9.0-android</TargetFramework>
5+
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
6+
<ApplicationId>com.companyname.Platformer2D</ApplicationId>
7+
<ApplicationVersion>1</ApplicationVersion>
8+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
9+
<AssemblyName>Platformer2D</AssemblyName>
10+
<AssemblyTitle>Platformer2D</AssemblyTitle>
11+
</PropertyGroup>
12+
<ItemGroup>
13+
<MonoGameContentReference Include="..\Core\Content\Platformer2D.mgcb">
14+
<Link>Content\Platformer2D.mgcb</Link>
15+
</MonoGameContentReference>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ProjectReference Include="..\Core\Core.csproj" />
19+
</ItemGroup>
20+
<ItemGroup>
21+
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.*" />
22+
<PackageReference Include="MonoGame.Framework.Android" Version="3.8.*" />
23+
</ItemGroup>
24+
</Project>
11 KB
Loading
89.7 KB
Loading
5.94 KB
Loading
57 KB
Loading
17.2 KB
Loading
168 KB
Loading

0 commit comments

Comments
 (0)