MainActivity.cs 969 B

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