MainActivity.cs 742 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 BatteryStatusDemo
  7. {
  8. [Activity(Label = "BatteryStatus",
  9. Name = "com.cartblanche.batterystatus.MainActivity",
  10. MainLauncher = true,
  11. ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize)]
  12. public class MainActivity : AndroidGameActivity
  13. {
  14. private Game1 _game;
  15. private View _view;
  16. protected override void OnCreate(Bundle bundle)
  17. {
  18. base.OnCreate(bundle);
  19. _game = new Game1();
  20. //Game1.SetInstance(_game);
  21. _view = _game.Services.GetService(typeof(View)) as View;
  22. SetContentView(_view);
  23. _game.Run();
  24. }
  25. }
  26. }