Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
path: artifacts/NeonShooter-Windows/**

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

- name: Archive Platformer2D
uses: actions/upload-artifact@v6
Expand Down Expand Up @@ -187,8 +187,8 @@ jobs:

- name: Build and Package Platformer2D
run: |
dotnet build Platformer2D/Platformer2D.DesktopGL/Platformer2D.DesktopGL.csproj -c Release
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
dotnet build Platformer2D/Desktop/Platformer2D.csproj -c Release
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

- name: Archive Platformer2D Windows
uses: actions/upload-artifact@v6
Expand Down Expand Up @@ -305,13 +305,13 @@ jobs:
path: NeonShooter/NeonShooter.Android/bin/Release/net9.0-android/**/*-Signed.apk

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

- name: Archive Platformer2D Android
uses: actions/upload-artifact@v6
with:
name: Android-Platformer2D
path: Platformer2D/Platformer2D.Android/bin/Release/net9.0-android/**/*-Signed.apk
path: Platformer2D/Android/bin/Release/net9.0-android/**/*-Signed.apk

- name: Build Android Binary for DungeonSlime
run: dotnet build Tutorials/learn-monogame-2d/src/27-Conclusion/DungeonSlime/Platforms/Android/DungeonSlime.csproj -c Release
Expand Down
15 changes: 15 additions & 0 deletions Platformer2D/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.companyname.Platformer2D" android:versionCode="1" android:versionName="1.0">
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="35" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application
android:hardwareAccelerated="true"
android:icon="@drawable/icon"
android:isGame="true"
android:label="@string/app_name"
android:theme="@style/MainTheme"
/>
</manifest>
52 changes: 52 additions & 0 deletions Platformer2D/Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;

using Microsoft.Xna.Framework;

using Platformer2D.Core;

namespace Platformer2D.Android
{
/// <summary>
/// The main activity for the Android application. It initializes the game instance,
/// sets up the rendering view, and starts the game loop.
/// </summary>
/// <remarks>
/// This class is responsible for managing the Android activity lifecycle and integrating
/// with the MonoGame framework.
/// </remarks>
[Activity(
Label = "Platformer2D",
MainLauncher = true,
Icon = "@drawable/icon",
Theme = "@style/Theme.Splash",
AlwaysRetainTaskState = true,
LaunchMode = LaunchMode.SingleInstance,
ScreenOrientation = ScreenOrientation.SensorLandscape,
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden
)]
public class MainActivity : AndroidGameActivity
{
private Platformer2DGame _game;
private View _view;

/// <summary>
/// Called when the activity is first created. Initializes the game instance,
/// retrieves its rendering view, and sets it as the content view of the activity.
/// Finally, starts the game loop.
/// </summary>
/// <param name="bundle">A Bundle containing the activity's previously saved state, if any.</param>
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);

_game = new Platformer2DGame();
_view = _game.Services.GetService(typeof(View)) as View;

SetContentView(_view);
_game.Run();
}
}
}
24 changes: 24 additions & 0 deletions Platformer2D/Android/Platformer2D.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<ApplicationId>com.companyname.Platformer2D</ApplicationId>
<ApplicationVersion>1</ApplicationVersion>
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<AssemblyName>Platformer2D</AssemblyName>
<AssemblyTitle>Platformer2D</AssemblyTitle>
</PropertyGroup>
<ItemGroup>
<MonoGameContentReference Include="..\Core\Content\Platformer2D.mgcb">
<Link>Content\Platformer2D.mgcb</Link>
</MonoGameContentReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.*" />
<PackageReference Include="MonoGame.Framework.Android" Version="3.8.*" />
</ItemGroup>
</Project>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions Platformer2D/Android/Resources/values/Styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Splash" parent="android:Theme">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="MainTheme">
<!-- Set theme colors from https://aka.ms/material-colors -->
<!-- colorPrimary is used for the default action bar background -->
<!--<item name="colorPrimary">#2196F3</item>-->
<!-- colorPrimaryDark is used for the status bar -->
<!--<item name="colorPrimaryDark">#1976D2</item>-->
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<!--<item name="colorAccent">#FF4081</item>-->
</style>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#9ACEEB</color>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,40 @@ with.
<!--
CharacterRegions control what letters are available in the font. Every
character from Start to End will be built and made available for drawing. The
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
character set. The characters are ordered according to the Unicode standard.
default range is from 32, (ASCII space), to 254, ('■'), covering the basic Latin
character set as well as extended character set.
The characters are ordered according to the Unicode standard.
See the documentation for more information.
-->
<CharacterRegions>
<!-- Latin Character and Extended Set -->
<CharacterRegion>
<Start>&#32;</Start>
<End>&#126;</End>
<End>&#254;</End>
</CharacterRegion>

<!-- Hiragana (U+3040 - U+309F) -->
<CharacterRegion>
<Start>&#12352;</Start>
<End>&#12447;</End>
</CharacterRegion>

<!-- Katakana (U+30A0 - U+30FF) -->
<CharacterRegion>
<Start>&#12448;</Start>
<End>&#12543;</End>
</CharacterRegion>

<!-- Common Kanji (CJK Unified Ideographs - typically U+4E00 to U+9FFF) -->
<CharacterRegion>
<Start>&#19968;</Start>
<End>&#40879;</End>
</CharacterRegion>

<!-- Cyrillic Character Set -->
<CharacterRegion>
<Start>&#1040;</Start>
<End>&#1103;</End>
</CharacterRegion>
</CharacterRegions>
</Asset>
Expand Down
Binary file added Platformer2D/Core/Content/Icon.bmp
Binary file not shown.
Binary file added Platformer2D/Core/Content/Icon.ico
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
....................
....................
....................
...............2....
..............###...
....................
....................
....................
.........GGG........
.........###........
....................
....GGG.......GGG...
....###.......###...
.....1..............
....#;#.............
....................
.1................X.
........P.......X...
####################
15 changes: 15 additions & 0 deletions Platformer2D/Core/Content/Levels/01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
....................
....................
............X.......
......########......
..2.................
####............####
....................
....................
.......------.......
...--...........--..
.1................1.
#;##............####
....................
.P..................
####################
15 changes: 15 additions & 0 deletions Platformer2D/Core/Content/Levels/02.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
........................................
#..................#....................
...##1........1##.........########......
...###2......2###.......##........##....
..#####3....3#####....##............--..
...##.##....##.##....#...2..............
...##..#3.DX#..##....#...#..............
#..##...####...##..#.#........#######-..
P..##..........##...#.##..........##...#
...##..........##.......##1....A##....#.
..###....121...###........###;###....#..
........#;##........................#...
...................................#....
...4....A.......B.......................
###########..############..######..#####
15 changes: 15 additions & 0 deletions Platformer2D/Core/Content/Levels/03.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
....................
P...................
......########......
....##........##....
..##............--..
.#...2..............
.#...#....X.........
.#........#######-..
#.##..........##...#
....##1....A##....#.
......###;###....#..
................#...
....................
....................
####################
15 changes: 15 additions & 0 deletions Platformer2D/Core/Content/Levels/04.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
....................
......P.....A3......
.....#########......
....#.........#2....
...#.....3.....#1...
..#.....---.....#...
..#..B......C...#...
#.#######;#######..#
..#.............#...
..#.............#...
.-#........X....#-..
.......#####........
#.................##
....B........A......
####################
15 changes: 15 additions & 0 deletions Platformer2D/Core/Content/Levels/05.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
....................
#..................#
...##1........1##...
...###2......2###...
..#####3....3#####..
...##.##....##.##...
...##..#3.DX#..##...
#..##...####...##..#
P..##..........##...
...##..........##...
..###....121...###..
........####........
....................
........A.......B...
####################
15 changes: 15 additions & 0 deletions Platformer2D/Core/Content/Levels/06.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
....................
........12221.......
#..##############...
...##...............
...##...............
P..##A..B..3.C..D...
..###############...
...##...............
...##...............
...##.1..1..1..1....
#..##############...
...................X
...................#
....B.........C.....
#########.##########
Loading