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