MainActivity.cs 952 B

12345678910111213141516171819202122232425262728293031323334
  1. using Android.App;
  2. using Android.Content.PM;
  3. using Android.OS;
  4. using Android.Views;
  5. using Microsoft.Xna.Framework;
  6. namespace LensFlare
  7. {
  8. [Activity(
  9. Label = "LensFlare",
  10. MainLauncher = true,
  11. AlwaysRetainTaskState = true,
  12. LaunchMode = LaunchMode.SingleInstance,
  13. ScreenOrientation = ScreenOrientation.FullUser,
  14. ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize
  15. )]
  16. public class MainActivity : AndroidGameActivity
  17. {
  18. private LensFlareGame? _game;
  19. private View? _view;
  20. protected override void OnCreate(Bundle bundle)
  21. {
  22. base.OnCreate(bundle);
  23. _game = new LensFlareGame();
  24. _view = _game.Services.GetService(typeof(View)) as View;
  25. if (_view != null)
  26. SetContentView(_view);
  27. _game.Run();
  28. }
  29. }
  30. }