MainActivity.cs 838 B

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