MainActivity.cs 960 B

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