using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;
using Microsoft.Xna.Framework;
using MonoGameBlank2dStartKit.Core;
namespace MonoGameBlank2dStartKit.Android
{
///
/// The main activity for the Android application. It initializes the game instance,
/// sets up the rendering view, and starts the game loop.
///
///
/// This class is responsible for managing the Android activity lifecycle and integrating
/// with the MonoGame framework.
///
[Activity(
Label = "MonoGameBlank2dStartKit",
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 MonoGameBlank2dStartKitGame _game;
private View _view;
///
/// 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.
///
/// A Bundle containing the activity's previously saved state, if any.
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
_game = new MonoGameBlank2dStartKitGame();
_view = _game.Services.GetService(typeof(View)) as View;
SetContentView(_view);
_game.Run();
}
}
}