Activity1.cs 871 B

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