| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using Android.App;
- using Android.Content.PM;
- using Android.OS;
- using Android.Views;
- using Microsoft.Xna.Framework;
- using MonoGameDistortionSample.Core;
- namespace MonoGameDistortionSample.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 = "MonoGameDistortionSample",
- 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 MonoGameDistortionSampleGame _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 MonoGameDistortionSampleGame();
- _view = _game.Services.GetService(typeof(View)) as View;
- SetContentView(_view);
- _game.Run();
- }
- }
- }
|