MainActivity.cs 866 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using Android.App;
  3. using Android.Content.PM;
  4. using Android.OS;
  5. using Android.Views;
  6. using Microsoft.Xna.Framework;
  7. namespace RenderTarget2DSample.Android
  8. {
  9. [Activity(Label = "RenderTarget2D", MainLauncher = true, Icon = "@drawable/icon",
  10. Theme = "@style/Theme.Splash", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)]
  11. public class MainActivity : AndroidGameActivity
  12. {
  13. private RenderTarget2DSampleGame _game;
  14. private View _view;
  15. protected override void OnCreate(Bundle bundle)
  16. {
  17. base.OnCreate(bundle);
  18. _game = new RenderTarget2DSampleGame();
  19. _view = _game.Services.GetService(typeof(View)) as View;
  20. SetContentView(_view);
  21. _game.Run();
  22. }
  23. }
  24. }