2019-09-01 11:56:12 +02:00
|
|
|
using Android.App;
|
|
|
|
using Android.Content.PM;
|
|
|
|
using Android.OS;
|
|
|
|
using Android.Views;
|
2020-04-19 03:20:25 +02:00
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
using MLEM.Extensions;
|
2020-02-24 14:03:53 +01:00
|
|
|
using MLEM.Misc;
|
2019-09-01 11:56:12 +02:00
|
|
|
|
2019-12-05 22:09:11 +01:00
|
|
|
namespace Demos.Android {
|
2020-04-19 03:20:25 +02:00
|
|
|
[Activity(
|
|
|
|
Label = "@string/app_name",
|
|
|
|
MainLauncher = true,
|
|
|
|
Icon = "@drawable/icon",
|
|
|
|
AlwaysRetainTaskState = true,
|
|
|
|
LaunchMode = LaunchMode.SingleInstance,
|
|
|
|
ScreenOrientation = ScreenOrientation.UserLandscape,
|
|
|
|
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize
|
|
|
|
)]
|
|
|
|
public class Activity1 : AndroidGameActivity {
|
|
|
|
|
|
|
|
private GameImpl game;
|
|
|
|
private View view;
|
2019-09-01 11:56:12 +02:00
|
|
|
|
|
|
|
protected override void OnCreate(Bundle bundle) {
|
|
|
|
base.OnCreate(bundle);
|
2020-04-19 03:20:25 +02:00
|
|
|
|
2020-02-24 14:03:53 +01:00
|
|
|
TextInputWrapper.Current = new TextInputWrapper.Mobile();
|
2020-04-19 03:20:25 +02:00
|
|
|
this.game = new GameImpl();
|
|
|
|
// reset MlemGame width and height to use device's aspect ratio
|
2020-04-19 03:24:43 +02:00
|
|
|
this.game.GraphicsDeviceManager.ResetWidthAndHeight(this.game.Window);
|
2020-02-01 21:16:10 +01:00
|
|
|
// disable mouse handling for android to make emulator behavior more coherent
|
2020-04-19 03:20:25 +02:00
|
|
|
this.game.OnLoadContent += game => game.InputHandler.HandleMouse = false;
|
|
|
|
this.view = this.game.Services.GetService(typeof(View)) as View;
|
|
|
|
|
|
|
|
this.SetContentView(this.view);
|
|
|
|
this.game.Run();
|
2019-09-01 11:56:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|