MainActivity.cs 1001 B

12345678910111213141516171819202122232425262728293031323334
  1. using Android.App;
  2. using Android.Content.PM;
  3. using Android.OS;
  4. using Android.Views;
  5. namespace FarseerPhysics
  6. {
  7. [Activity(
  8. Label = "Farseer Samples",
  9. MainLauncher = true,
  10. Icon = "@drawable/icon",
  11. Theme = "@android:style/Theme.NoTitleBar.Fullscreen",
  12. AlwaysRetainTaskState = true,
  13. LaunchMode = LaunchMode.SingleInstance,
  14. ScreenOrientation = ScreenOrientation.Landscape,
  15. ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize
  16. )]
  17. public class MainActivity : AndroidGameActivity
  18. {
  19. private FarseerPhysicsGame _game;
  20. private View _view;
  21. protected override void OnCreate(Bundle bundle)
  22. {
  23. base.OnCreate(bundle);
  24. _game = new FarseerPhysicsGame();
  25. _view = _game.Services.GetService(typeof(View)) as View;
  26. SetContentView(_view);
  27. _game.Run();
  28. }
  29. }
  30. }