MainActivity.cs 889 B

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