MainActivity.cs 896 B

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